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

Use GHC.Float functions rather than C code where possible #57

Open
RyanGlScott opened this issue Nov 7, 2021 · 0 comments
Open

Use GHC.Float functions rather than C code where possible #57

RyanGlScott opened this issue Nov 7, 2021 · 0 comments

Comments

@RyanGlScott
Copy link
Collaborator

Currently, bytes defines functions to convert from floating-point values to word values (and vice versa) in i2d.c. However, in base-4.10.0.0 (GHC 8.2) and later, the GHC.Float module offers equivalent functionality in the castDoubleToWord64 function, as well as its cohorts. As far as I can tell, these functions are bit-for-bit compatible, although I'd have to stare at the corresponding Cmm code to know for sure.

If we used the GHC.Float functions instead, we would no longer need to link against C code on recent versions of GHC. This has come up elsewhere in ekmett/bits#7 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant