Archived

This topic is now archived and is closed to further replies.

aeleneski

i

Recommended Posts

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

Share this post


Link to post
Share on other sites
.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 ] ::::

Share this post


Link to post
Share on other sites