Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding to .01 not working 1

Status
Not open for further replies.

ginaburg

Technical User
Jul 14, 2004
62
US
I am using Crystal 8.5
I have a numeric field that formatting is set to
Decimal 1.0
Rounding 0.1

The numbers on the report are:
1.3
2.3
2.6
1.2

The total of this field is also rounded the same as above but the answer I am getting is 7.5 and it should be 7.4

If I use rounding as
Decimal 1.00
Rounding 0.10 I get the following
1.30
2.62
2.32
1.22

I still get 7.5 as the total. Is it somehow adding the 2's at the end to get 7.5?

What am I doing wrong?
I hope this is enough information.

Thanks
Gina
 
I don't use 8.5 but I believe that sometimes I find rounding errors if you use both the field format to round and the formula @round({field},2). Try one or the other individually.
Also, in testing your data in example 2 with my HP, I found that setting it to display 2 decimal places produced 7.46 but 1 decimal place produced 7.5 correctly. Sounds like the field format is taking precedence.
 
Formatting only deals with the display of the numbers. The value of the number does not change. If you have a value of 2.62 in the database and you format it to only show one decimal, the report displays 2.6 but the actual value is still 2.62.

If you want to actually change the value of the number, truncate the numbers to a certain decimal and then add them.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top