Skip to main content
gamedev.net
🔒 Locked

i

Started by aeleneski 1 reply 300+ views
Original Post
aeleneski
aeleneski
i [Edited by - aeleneski on April 24, 2006 11:18:08 PM]
dmikesell
dmikesell
You''re probably passing a double to the function instead of a float. Doubles have more precision than floats, so if you truncate it to a float you may lose some precision, hence the message.

How are you calling the function? Literal floating point numbers (e.g. 10.45) are doubles unless you specify that they are floats (e.g. 10.45f).

--
Dave Mikesell Software & Consulting
IFooBar
IFooBar
.01 is a double and .01f is a float. All constant decimal numbers should be followed by an ''f'' to specify that they are float. So your offending line is

subtotal = (1 - (discount * .01)) * installed_price;

change to

subtotal = (1.0f - (discount * .01f)) * installed_price;


:::: [ Triple Buffer ] ::::
[size=2]aliak.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.