Has anyone come upon rounding errors when doing math calculation and in particular to a cost being multiplied by a markup

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I do not see this every time but it does happen on certain costs. In the example below you will see what is happening

  • 4 x 39.87 and the result is 159.46....should be 159.48
  • 2 x 117.03 and the result is 234.05....should be 234.06
Ones that are right

  • 2 x 56.19 and the result is 112.38
  • 2 x 52.67 and the result is 105.34
I have looked at all of my cost items and they only are entered out to two decimal points, but when I look and the sale after the cost is multiplied by the markup, the result for the individual sale price goes out several decimal points yet I only have it set to two. There is definitely some rounding up and down going on and not sure how to fix that since it is only happening sporadically.
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Chris

Chris

  • 4,430 Points 4k badge 2x thumb

Hi,

Can you post your rounding formula?

Joey,
Quick Base does not make math errors. :)

You number which appears as 39.87 is actually about 39.865.  It only appears as 39.87 since you have it set to display to 2 decimals.

This is probably a calculated currency field.

You will need to round it before doing that Multiplication on presumably Qty.

Round( I assume that you already have a formula field, 0.01) 

Here is the help on Round, see their first example

https://login.quickbase.com/db/6ewwzuuj?a=dr&r=5&rl=dyz
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
No rounding formula to start with but just added this and ran a couple of the items in question though it and it seems to have fixed it.

Round([Unit Cost]*[MU],0.01)
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
....and naturally the customer is holding up payment because the numbers do not match...I have only run around 250 parts quotes and orders through this system and now they bring it up. Must be why we have bad debt and overdue collections...I am always the last to know but am at fault for this.....
Well randomly, they will have been equally over and under charged.  :)
Photo of Joey Zint

Joey Zint

  • 1,870 Points 1k badge 2x thumb
That is a positive outlook....give a little....get a little
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,244 Points 20k badge 2x thumb
>Quick Base does not make math errors. :)

I am pretty sure QuickBase can make rounding errors if the numbers are large enough or if you look at enough precision. 

> 0.1 + 0.2
> 0.30000000000000004
Photo of Matthew Neil

Matthew Neil

  • 31,698 Points 20k badge 2x thumb
Quick Base actually makes rounding errors all the time.  They don't carry the entire value when you are using summary fields and different types of calculations.

You have to force your summary fields to carry more decimal points, and even your formula numeric values to carry more decimal points.
I’m an Engineer, but alas, in this era of post Harvey Weinstein it’s probably no longer appropriate to post a link to the joke. But when I was a student a few decades ago there was a joke with a punch line

“So? I’ll be close enough for all practical purposes.”

The punch line is googleable.