-
Notifications
You must be signed in to change notification settings - Fork 2
Odd behaviour with floats & printf #16
Copy link
Copy link
Open
Description
I've encountered an odd behaviour with floats and printf where the output returned is not the value you've provided:
We have the following code:
import "std.csp";
fn main(): i32 {
using std::io;
macro PI { 3.14159265358979323846 }
let pi: f32 = 1.2;
let num: i32 = 55;
printf("%i\n", num);
printf("%f\n", PI!);
printf("%f\n", pi);
<- 0;
}
The output is:
55
3.0000000000
1.0000000000
Does CSpydr not use the same formatting rule as C? Is there something done wrong in this example or there is a deeper underlying problem causing this? As you can see, the integer is printed out fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels