Bug 51171

Summary: printf prints denormalized float incorrectly with -mieee
Product: [Retired] Red Hat Linux Reporter: Peter van Hoof <vanhoof>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: fweimer
Target Milestone: ---   
Target Release: ---   
Hardware: alpha   
OS: Linux   
URL: ftp://ftp.cita.utoronto.ca/pub/vanhoof/bug5.c
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-04-01 16:24:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
sample program that illustrates the bug none

Description Peter van Hoof 2001-08-08 00:44:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; SunOS 5.8 sun4m)

Description of problem:
when programs are compiled with -mieee, denormalized single
precision floating point numbers are printed incorrectly

How reproducible:
Always

Steps to Reproduce:
1. gcc -mieee bug5.c -lm
2. a.out

	

Actual Results:  result 1a: 1.175494e-38 -8.733655e+01
result 1b: 1.349571e-308
result 1c: 1.425942e-38


Expected Results:  result 1a: 1.175494e-38 -8.733655e+01
result 1b: 7.129711e-39
result 1c: 1.425942e-38


Additional info:

Expected results were run on a sparc 20 where denormalized
numbers are treated correctly.

Result 1b in the actual results is clearly wrong. However,
result 1c (which is the number printed in result 1b multiplied
with 2) is clearly correct. This suggests that the denormalized
numbers themselves are treated correctly, but that printf
prints them out incorrectly.

All variables in this program are single precision numbers, an
exponent of e-308 is clearly out of range, even for a
denormalized number.

Sample code is available at the URL listed above, and will
also be attached.

Comment 1 Peter van Hoof 2001-08-08 00:45:58 UTC
Created attachment 26754 [details]
sample program that illustrates the bug

Comment 2 George France 2002-04-01 16:24:29 UTC
Its a kernel problem.  I submitted a patch against the 2.4.18 kernel a few days
ago:

http://marc.theaimsgroup.com/?l=linux-kernel&m=101656561600848&w=2

You should be able to back port the patch without any problems.

--George

Comment 3 Phil Copeland 2002-04-02 00:22:46 UTC
As this is now in upstream code and in the upcoming shippable kernel... closing.