You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! While I was making a simple fractal explorer, I stumbled across this.
The below minimal working example initializes a certain FBig<Zero, 2> then manually sets its precision. With with_base::<10>(), the operation internally crashes. This only happens on 32-bit targets: wasm32-unknown-unknown and i686-pc-windows-msvc reproduce this bug. With normal 64-bit targets the code executes perfectly.
use dashu::float::{FBig, round::mode::Zero};use std::str::FromStr;fnmain(){let str = "-1.1111111111111101110010001101011001000101000110010100101001011010100101011101111101001011111000000110001101000111001011010100010000000110110111010000100101100011001110011101110101111101110000101010100001010010011111010010000010001011001111011010011110111001111001011100001101101011010011110100100110100111100110000010110010110010101011010010000010100100111001111110010011000000000101101111100001011000111111101000110011011101111010100000000100011010011011010000000111111110001110000010001100011000100111000100111011010100111101010111101001111011101010111100001100110001010010011";// Initialize a normal base-2 float, then convert it to base-10.let num = FBig::<Zero,2>::from_str(str).unwrap();println!("precision: {}", num.precision());println!("base-10 representation: {}",
num.clone().with_base::<10>().value());// Now set the original number's precision, and convert it to base-10.let num = num.with_precision(586).value();println!("precision: {}", num.precision());println!("base-10 representation: {}",
num.clone().with_base::<10>().value());}
32-bit output
precision: 578
base-10 representation: -1.9999661944503703041843468850635057967553124154072485151176192294480158424234268438137612977886891381228704640656094986435381057574477216648567249609280392009533217665484389
precision: 586
thread 'main' (19236) panicked at C:\_______\dashu-float-0.5.0\src\error.rs:94:5:
arithmetic operations with the infinity are not allowed!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\i686-pc-windows-msvc\debug\dashu-bug.exe` (exit code: 101)
Hello! While I was making a simple fractal explorer, I stumbled across this.
The below minimal working example initializes a certain
FBig<Zero, 2>then manually sets its precision. Withwith_base::<10>(), the operation internally crashes. This only happens on 32-bit targets:wasm32-unknown-unknownandi686-pc-windows-msvcreproduce this bug. With normal 64-bit targets the code executes perfectly.32-bit output
64-bit output