Issue 59153 - MOD() returns negative values for large input
Summary: MOD() returns negative values for large input
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: OOo 2.0
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: oc
QA Contact: issues@sc
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2005-12-09 18:51 UTC by villeroy
Modified: 2017-05-20 11:41 UTC (History)
3 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Testcases, that show that accuracy can be better for pure integral numbers (33.67 KB, application/vnd.oasis.opendocument.spreadsheet)
2009-04-22 15:01 UTC, Regina Henschel
no flags Details
uses fmod in case of pure integral number in denominator (1.12 KB, text/plain)
2009-04-22 15:02 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description villeroy 2005-12-09 18:51:22 UTC
Found when testing issue 59112 "Off-by-one calculation int() and floor() with
large inputs". May be related.
MOD(293045370521579;5) returns -1 rather than 4.
Comment 1 aziem 2005-12-09 22:41:02 UTC
Confirm OOo 2.0.0 Windows.
Comment 2 frank 2005-12-15 13:55:26 UTC
Hi Eike,

yours ?

Frank
Comment 3 ooo 2005-12-16 12:34:23 UTC
Accepted.

The input value seems to be on the very border of representable accuracy..
Comment 4 ooo 2006-04-24 14:29:41 UTC
Can't schedule in time frame, retargeting to OOo2.0.4.
Comment 5 ooo 2006-07-19 16:45:27 UTC
Won't make it in timeframe for 2.0.4, retargeting to OOo2.x
Comment 6 Regina Henschel 2009-04-22 14:59:40 UTC
The values are calculated with approx-routines. That is necessary for decimal
inputs. But we can calculate the remainder directly, when input is a pure
integral number. This gives a better accuracy then. I'll attach patch and
test-cases.
Comment 7 Regina Henschel 2009-04-22 15:01:14 UTC
Created attachment 61733 [details]
Testcases, that show that accuracy can be better for pure integral numbers
Comment 8 Regina Henschel 2009-04-22 15:02:29 UTC
Created attachment 61734 [details]
uses fmod in case of pure integral number in denominator
Comment 9 ooo 2009-04-22 17:06:05 UTC
Thanks! Scheduled for inclusion in CWS odff06.
Comment 10 ooo 2009-04-29 23:50:57 UTC
In cws odff06:

revision 271397
sc/source/core/tool/interpr2.cxx
Comment 11 ooo 2009-09-03 21:02:34 UTC
Reassigning to QA for verification.
Comment 12 oc 2009-09-09 13:53:16 UTC
verified in internal build cws_odff06