Board index » cppbuilder » Simple multiply and divide
Richard
CBuilder Developer |
Simple multiply and divide2007-11-19 02:06:38 AM cppbuilder112 I'm having some difficulty when I multiply numbers. WORD MyWord; float MyFloat; Lets say float is 12.345, I want to multiply it by 1000 so I can retain everything right of the decimal. i.e. 12.345 * 1000 would be 12345 MyWord = MyFloat * 1000; MyWord is now 12000 instead of 12345; So I figure I forgot the float on the multiplier and tried that. MyWord = MyFloat * 1000.0; MyWord is still 12000 instead of 12.345 What is going on and why? TIA, Richard |