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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple calulation has unexpected results

Status
Not open for further replies.

smibarb

Technical User
Jun 24, 2005
40
CA
Using a simple formula with unexpected results:

2*{#SD}

{#SD}= 0.01, so 2*0.01 should equal 0.02, but returning 0.03 (?)

I am guessing this has to do with the calculation considering than the number of displayed decimal places, but even if I increase the field to show four decimal places, the value is still 0.0100.

Using CR v 11

Thanks for any feedback.
 
Sorry, not sure what you mean by rounding field. If you are referring to the number of decimals specified on the number tab for the field format, it is two, and on the same tab, 'Allow Field Clipping' is not selected (and field clipping is not what I am experiencing, and the same problem exists regardless of the number of decimals specified).

To recap:

If I display running total field {#SD} in the report, the value is 0.01. (or 0.010, or 0.01000, depending how many decimal places I chose to display). Then, in a second formula field, which calculates simply 2*{#SD}, the value is 0.03 (or 0.030, or 0.03000, depending how many decimal places I chose to display). Of course, the result should be 0.02. Unable to explain how 0.01 * 2 = 0.03.
 
Please could you post the logic of the running total?

Also where you are placing each of the fields?

'J
 
This seems to work:

2*(Round ({#SD},2))

Despite the fact that increasing the number of decimal places in the {#SD} field did not show evidence of this, there must be trailing digits that are being considered in the calculation.

Thank you for your thoughts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top