Jump to content
  • Advertisement


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



This topic is 5532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!