#### Archived

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

# i

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

## Recommended Posts

i [Edited by - aeleneski on April 24, 2006 11:18:08 PM]

##### Share on other sites
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 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 ] ::::

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 10
• 9
• 9
• 11
• 11
• ### Forum Statistics

• Total Topics
633690
• Total Posts
3013339
×