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

Make f128 crate and struct be a command line option #745

Closed
LegNeato opened this issue Nov 27, 2022 · 2 comments
Closed

Make f128 crate and struct be a command line option #745

LegNeato opened this issue Nov 27, 2022 · 2 comments

Comments

@LegNeato
Copy link
Contributor

LegNeato commented Nov 27, 2022

As it is, code with long double includes an unmaintained crate that only works on Linux (and may even be broken there): f128. It looks like rust_decimal with the c_repr feature could be a potential path forward.

Related to #154.

@kkysen kkysen changed the title Consider using rust_decimal for long double Consider using rust_decimal for long double Nov 28, 2022
@kkysen
Copy link
Contributor

kkysen commented Nov 28, 2022

A few points:

  • f128 is not unmaintained; the README.md says "This crate is currently in maintenance mode.".

  • long double in C can map to very different things. msvc uses double for long double, for example (though we don't support Windows at all at this point). So trying to have good cross-platform behavior with long double is really hard, and c2rust transpile doesn't have a good cross-platform story in the first place due to the preprocessor.

  • I'm confused how rust_decimal could help, though. It looks like it's for a 96-bit decimal representation, while long double is often f128 aka IEEE754 binary128. Am I misreading things?

  • Given f128 is not a community standard at all, and until there is an f128 or long double (c_long_double) in std/core, we could also make what crate and struct gets used for f128 support be a command-line option.

@LegNeato
Copy link
Contributor Author

LegNeato commented Dec 2, 2022

No, you are correct, I think this is invalid (got confused by "The corresponding target layout is 128 bit aligned" in the rust_decimal docs) and a command option is the correct path.

@LegNeato LegNeato changed the title Consider using rust_decimal for long double Make f128 crate and struct be a command line option Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants