This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/23395] New: fmod repeated subtraction algorithm introduces round off errors
- From: "irv at princeton dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Tue, 10 Jul 2018 18:42:42 +0000
- Subject: [Bug math/23395] New: fmod repeated subtraction algorithm introduces round off errors
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=23395
Bug ID: 23395
Summary: fmod repeated subtraction algorithm introduces round
off errors
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: irv at princeton dot com
Target Milestone: ---
Created attachment 11120
--> https://sourceware.org/bugzilla/attachment.cgi?id=11120&action=edit
Source code that illustrates the problem.
Consider the attached source code that computes fmod(x, y) for the values
x=100, 10, ..., 1.0e-6, y = x/100. The result should always be close to 0. The
problem is that the fmod() implementation in sysdeps/ieee754/dbl-64/e_fmod.c
does repeated subtraction, which causes round off error to accumulate.
For the case where x > 0, y > 0, y < x, I show a different algorithm in
newfmod() that avoids that round off error.
This is on Intel chips, under Ubuntu (but it happens for any distribution on
Intel).
Since the implementation of fmod() is 25 years old, it ought to be fixed.
--
You are receiving this mail because:
You are on the CC list for the bug.