Losing bits on floats

⚓ Rust    📅 2025-07-02    👤 surdeus    👁️ 5      

surdeus

Warning

This post was published 36 days ago. The information described in this article may have changed.

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Losing bits on floats

There was already topics about FPU in the forum, but don't explain this.

based on the gdb's command ìnfo floatthe float precision is 80bits because the x86 64bits FPU is f80 but in rust max float is f64, in c for instance there islong double`

pub fn main() {
        assert_eq!(3.141592653589793239, // 80bit
                   3.141592653589793);   // 64bit
        println!("true");
}
rustc test.rs
./test
true

I think there is no pure rust solution, using `rug::Float;` would be binded `c` 
Is it possible to use the x86-64  FPU's float?

6 posts - 3 participants

Read full topic

🏷️ rust_feed