We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
long double
Given:
#define _GNU_SOURCE #include <stdio.h> #include <math.h> #define _PI_180 (M_PIl / 180.0) #define _180_PI (180.0 / M_PIl) int main(void) { printf("%LF\n", _PI_180); printf("%LF\n", _180_PI); return 0; }
$ ./c-test 0.017453 57.295780
But the converted rust version:
$ target/debug/test -NAN -NAN
The generated code is:
#![allow(dead_code, mutable_transmutes, non_camel_case_types, non_snake_case, non_upper_case_globals, unused_assignments, unused_mut)] use ::c2rust_out::*; extern "C" { fn printf(_: *const libc::c_char, _: ...) -> libc::c_int; } unsafe fn main_0() -> libc::c_int { printf( b"%LF\n\0" as *const u8 as *const libc::c_char, f128::f128::new(3.141592653589793238462643383279502884) / f128::f128::new(180.0f64), ); printf( b"%LF\n\0" as *const u8 as *const libc::c_char, f128::f128::new(180.0f64) / f128::f128::new(3.141592653589793238462643383279502884), ); return 0 as libc::c_int; } pub fn main() { unsafe { ::std::process::exit(main_0() as i32) } }
I suspect (but have not checked that) f128 is not compatible with x87 80-bit long double and this conversion is just incorrect!
Software versions:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Given:
But the converted rust version:
The generated code is:
I suspect (but have not checked that) f128 is not compatible with x87 80-bit long double and this conversion is just incorrect!
Software versions:
The text was updated successfully, but these errors were encountered: