1 2 Previous Next 18 Replies Latest reply on Feb 29, 2016 1:25 PM by Vaughan

# How do I have the result of a calculation NOT be rounded up?

I have a calculation that calculates sales tax.

Where I am having a problem is in a case like this:  The resulting tax amount is 1.045.  Filemaker rounds this up to 1.05, but in fact the tax that we are charged is 1.04.  How to I prevent the calculation result from being rounded up?

• ###### 1. Re: How do I have the result of a calculation NOT be rounded up?

Filemaker does NOT round calculations if you don't tell him to.

If you want to exaggerate, use SetPrecision

• ###### 2. Re: How do I have the result of a calculation NOT be rounded up?

Thanks for the reply siplus.  I don't see how precision is going to help me tho (I am new to filemaker so am learning).

In my example, the result of my calculation is 1.045.  In my layout I have the number formatted to display as 2 decimals to the right.  But it rounds up.  I don't want it to.  (If the result was 1.055 then I DO want it to)

• ###### 3. Re: How do I have the result of a calculation NOT be rounded up?

It's a display thing, but internally the number remains as it is.

1.04499999 will remain 1.04, 1.045 will appear as 1.05.

Your preference is to see 1.045 as 1.04, throwing away the 0.005,  my preference is to see it as 1.05, treating the 0.005 as enough significant to be rounded up to 0.01. It seems that I win.

If you don't like it, you will have to create a calc field which acts the way you like and use that for the display.

Possible candidate:

Let ([

decpoint = Left (1/2;1);

separation = Substitute(YourTable::YourNumber; decpoint; ¶)];

GetValue(separation;1) & decpoint & Left(GetValue(separation;2);2)

)

• ###### 5. Re: How do I have the result of a calculation NOT be rounded up?

That's it!  Thank you Beverly.  Works perfectly.

Like I said.  I am learning..

• ###### 6. Re: How do I have the result of a calculation NOT be rounded up?

scoostraw wrote:

Like I said.  I am learning..

that's why I used a formula containing various elements that you'll hit upon, one day...

• ###### 7. Re: How do I have the result of a calculation NOT be rounded up?

I may have spoken a bit too soon.  There appears to be a quirk in our vendor's system in how they are calculating sales tax.

The tax rate is .055.

For a purchase of \$19.00 that is \$1.045.  (They charged me \$1.04)

For a purchase of \$5.00, that is \$0.275. (They charged me \$0.28).

In one they rounded up, and the other one down.

So I'm probably gonna have to live with being off a penny here and there.  Weird.

• ###### 8. Re: How do I have the result of a calculation NOT be rounded up?

this IS weird. Unless their formula rounds down over \$ 10 and up under it.

• ###### 9. Re: How do I have the result of a calculation NOT be rounded up?

Yeah could be.  Who the heck knows....

Thanks guys for the help.  I'm sure I'll be back.

• ###### 10. Re: How do I have the result of a calculation NOT be rounded up?

The vendor must have some underlying logic going on, such as that suggested by siplus. I assume from your reference to a vendor that this is a solution you are building for them, so you should find out from them what their business logic is and then design your calculation to reflect that. And, for what it's worth, my approach in money calcs is to do no rounding until the final price, as only then does money actually change hands.

• ###### 11. Re: How do I have the result of a calculation NOT be rounded up?

No I am doing this for my own business.  But you make a good point.  It may be a good idea not to do any rounding or truncating until the very end.

• ###### 12. Re: How do I have the result of a calculation NOT be rounded up?

This is my 'business logic'. I don't truncate or round until the rest is done.

I don't know about everywhere, but the .01 difference is ignored many places and in fact the US IRS ignores any decimal on its returns.

If you are talking about precision that is not currency, then that's a different matter. And I don't try to round or truncate such aggregated numbers.

beverly

• ###### 13. Re: How do I have the result of a calculation NOT be rounded up?

scoostraw wrote:

No I am doing this for my own business.  But you make a good point.  It may be a good idea not to do any rounding or truncating until the very end.

Consider making a field that allow the entry of an over-ride value, so you can enter the exact amount of tax that the vendor calculated, if it differs from yours.

• ###### 14. Re: How do I have the result of a calculation NOT be rounded up?

Another good thought.  I already do that for another field.  Maybe I'll do the same here.

I just was not expecting there to be any discrepancy like there is.  Not that it's a big deal I guess.

Thanks Vaughn.

1 2 Previous Next