cast(int) getting an unexpected number

Joel Christensen joelcnz at gmail.com
Wed Nov 4 03:14:36 PST 2009


Input:
import std.stdio;
void main() {
	float f=0.01;
	writefln("%0.2f->%d",f,cast(int)(f*100f));
}

Output:
0.01->0

Comment:
What!?


More information about the Digitalmars-d-learn mailing list