Bug 10400 - Bug in the double sqrt routine. Result should be corr. rounded according to the IEEE standard.
Summary: Bug in the double sqrt routine. Result should be corr. rounded according to t...
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc   
(Show other bugs)
Version: 6.0
Hardware: i386
OS: Linux
medium
high
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-03-28 22:59 UTC by shane.story
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-03-28 23:32:32 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description shane.story 2000-03-28 22:59:35 UTC
#include <stdio.h>
#include <float.h>
#include <math.h>

double sqrt(double);

main()
{
double x, y, r;



*((int*)&x+1) = 0x3d2ffffe;
*(int*)&x = 0x7fffffff;

printf("x                %08X%08X %.16e \n\n", *(((int*)&x) + 1),
*((int*)&x
);

y = sqrt(x);

printf("result           %08X%08X %.16e \n", *(((int*)&y) + 1),
*((int*)&y),

*((int*)&r+1) = 0x3e8fffff;
*(int*)&r = 0x3ffffdbf;
printf("result should be %08X%08X %.16e \n", *(((int*)&r) + 1),
*((int*)&r),

}

It reports the following
x                      3D2FFFFE7FFFFFFF 5.6843378203226540e-14

result                3E8FFFFF3FFFFDC0 2.3841849383641896e-07
result should be 3E8FFFFF3FFFFDBF 2.3841849383641894e-07


The machine is running:


Red Hat Release 6.0 (hedwig)
Kernel 2.2.5-15smp on an i686

Comment 1 Cristian Gafton 2000-03-28 23:32:59 UTC
The representation is outside of the bounds of representation. 15 precision
digits is the most you can do on a double (well, that's what is guaranteed)


Note You need to log in before you can comment on or make changes to this bug.