Ask Your Question

MASSIVE round() bug

asked 2020-12-01 12:36:51 +0200

420blazeitfgt gravatar image

updated 2020-12-01 13:09:36 +0200

Please watch the video. ROUND() precision problem.

ODF file in question

edit retag flag offensive close merge delete


If you have to report a bug - turn to - or provide an example file showing the "bug" so anybody could have a chance to reproduce your "bug". Watching a blurry video definitely won't help to find out what's going on.

Opaque gravatar imageOpaque ( 2020-12-01 12:51:23 +0200 )edit

Please upload an ODF type sample document here.

Zizi64 gravatar imageZizi64 ( 2020-12-01 13:00:12 +0200 )edit

I have uploaded the ODF file here, please take a look.

420blazeitfgt gravatar image420blazeitfgt ( 2020-12-01 13:08:43 +0200 )edit

Data>Calculate>Recalculate or F9 does also the trick.

ajlittoz gravatar imageajlittoz ( 2020-12-01 13:35:30 +0200 )edit

Reference information: OP reported tdf#138595 (from my perspective not a bug).

Opaque gravatar imageOpaque ( 2020-12-01 17:30:11 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-12-01 13:52:23 +0200

Opaque gravatar image

updated 2020-12-01 18:38:23 +0200


your problem is "accumulating" rounding errors. If you are performing calculation with currencies, you need to round each value to 2 decimal digits: But you perform:

in C38: =B38*$K$2/8*24 instead of =ROUND(B38*$K$2/8*24;2)
in G38: =F38*$K$2/8*24 instead of =ROUND(F38*$K$2/8*24;2)
in N38: =M38*$K$2/8*1,5*24 instead of =ROUND(M38*$K$2/8*1,5*24;2)

and at the end you get unpredictable results (though I admit that it is not clear [at least to me], why there is absolutely no indication of that).

edit flag offensive delete link more


C38, Employee earns THB51 per hour, and has worked for 56 hours. Results in EXACTLY 2856.00

N38, Employee earns 1.5 times the normal working hour for overtime,(51*1.5=76.5). Has worked for 13 hours. Results in EXACTLY 994.50

Q38, Total employee earning, 2856.00+994.50 = EXACTLY 3850.50

R38, 57.00 subtracted from total earnings

S38, Net earning, is 3850.50 minus 57.00. Results in EXACTLY 3793.50

I don't see anywhere that any rounding errors could accumulate?

420blazeitfgt gravatar image420blazeitfgt ( 2020-12-07 12:17:38 +0200 )edit

From where did you read that you could see it? - my answer is about experience and testing your file and (little) knowledge of IEEE 754 floating point aritmetic.

Opaque gravatar imageOpaque ( 2020-12-07 12:48:54 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-12-01 12:36:51 +0200

Seen: 71 times

Last updated: Dec 01 '20