Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocating double arrays from C in 32 bits #7203

Closed
vicuna opened this issue Mar 31, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Mar 31, 2016

Original bug ID: 7203
Reporter: braibant
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2017-09-24T15:33:00Z)
Resolution: fixed
Priority: normal
Severity: minor
Target version: 4.03.1+dev
Fixed in version: 4.04.0 +dev / +beta1 / +beta2
Category: runtime system and C interface
Monitored by: @hhugo

Bug description

Reading section 19.4.4 Allocating blocks of the manual, there is apparently no function to allocate an array of floating point numbers of size n.

To implement that, users must check the word-size, and perform the right caml_small(n, Double_array_tag) invocation, where n depends on the word-size and the number of values in the array.

Would it be possible to add a convenience function in byterun/alloc.c?

@vicuna

This comment has been minimized.

Copy link
Author

commented Apr 5, 2016

Comment author: @damiendoligez

caml_make_float_vect does what you need, but beware: if the argument is too large, it will raise an OCaml exception.

@vicuna

This comment has been minimized.

Copy link
Author

commented Apr 5, 2016

Comment author: @sliquister

caml_make_float_vect is not exposed, but it shows how to do the allocation:

caml_alloc(n * Double_wosize, Double_array_tag)

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 26, 2016

Comment author: @gasche

Fixed in trunk by merging #534 -- a60ce5a .

@vicuna vicuna closed this Sep 24, 2017

@vicuna vicuna added the stdlib label Mar 14, 2019

@vicuna vicuna added this to the 4.03.1 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.