Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2002 09:31:05 -0800 (PST)
From:      David Monniaux <monniaux@genievre.ens.fr>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/35381: incorrect floating-point display of large values when using round-upward IEEE mode
Message-ID:  <200202271731.g1RHV5d29073@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         35381
>Category:       misc
>Synopsis:       incorrect floating-point display of large values when using round-upward IEEE mode
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 27 09:40:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     David Monniaux
>Release:        4.4
>Organization:
ENS
>Environment:
FreeBSD airelle 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Mon Jan  7 11:46:25 CET 2002     root@airelle:/usr/src/sys/compile/AIRELLE  i386

>Description:
Very large floating-point values (very close to the maximal non
infinite number for the current IEEE precision mode, i.e.
DBL_MAX = 1.7976931348623157E+308 when left to the default)
are displayed incorrectly if the system has been put in
round-upward mode (using fpsetround()).

The output string is not even a valid number (contains a colon
in place of a digit).

>How-To-Repeat:
#include <ieeefp.h>
#include <stdio.h>

main()
{
  fpsetround(FP_RP);
  printf("%g\n", 1E308);
}

airelle% ./essai 
:e+307

^^ incorrect display
>Fix:
Save/restore the floating-point rounding mode
(and possibly precision mode) around library functions that expect
a particular mode.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200202271731.g1RHV5d29073>