Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
christos committed Mar 19, 2011
1 parent d807d49 commit 2d7b777
Show file tree
Hide file tree
Showing 97 changed files with 19,873 additions and 910 deletions.
32 changes: 29 additions & 3 deletions lib/libc/gdtoa/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
$NetBSD: README,v 1.1.1.1 2006/01/25 15:18:40 kleink Exp $

This directory contains source for a library of binary -> decimal
and decimal -> binary conversion routines, for single-, double-,
and extended-precision IEEE binary floating-point arithmetic, and
Expand Down Expand Up @@ -58,7 +56,9 @@ two letters:
whose sum is the desired value

For decimal -> binary conversions, there are three families of
helper routines: one for round-nearest:
helper routines: one for round-nearest (or the current rounding
mode on IEEE-arithmetic systems that provide the C99 fegetround()
function, if compiled with -DHonor_FLT_ROUNDS):

strtof
strtod
Expand Down Expand Up @@ -193,6 +193,9 @@ in the buffer, if the buffer was long enough, or 0. Other forms of
conversion are easily done with the help of gdtoa(), such as %e or %f
style and conversions with direction of rounding specified (so that, if
desired, the decimal value is either >= or <= the binary value).
On IEEE-arithmetic systems that provide the C99 fegetround() function,
if compiled with -DHonor_FLT_ROUNDS, these routines honor the current
rounding mode.

For an example of more general conversions based on dtoa(), see
netlib's "printf.c from ampl/solvers".
Expand Down Expand Up @@ -334,5 +337,28 @@ Compiling g__fmt.c, strtod.c, and strtodg.c with -DUSE_LOCALE causes
the decimal-point character to be taken from the current locale; otherwise
it is '.'.

Source files dtoa.c and strtod.c in this directory are derived from
netlib's "dtoa.c from fp" and are meant to function equivalently.
When compiled with Honor_FLT_ROUNDS #defined (on systems that provide
FLT_ROUNDS and fegetround() as specified in the C99 standard), they
honor the current rounding mode. Because FLT_ROUNDS is buggy on some
(Linux) systems -- not reflecting calls on fesetround(), as the C99
standard says it should -- when Honor_FLT_ROUNDS is #defined, the
current rounding mode is obtained from fegetround() rather than from
FLT_ROUNDS, unless Trust_FLT_ROUNDS is also #defined.

Compile with -DUSE_LOCALE to use the current locale; otherwise
decimal points are assumed to be '.'. With -DUSE_LOCALE, unless
you also compile with -DNO_LOCALE_CACHE, the details about the
current "decimal point" character string are cached and assumed not
to change during the program's execution.

On machines with a 64-bit long double and perhaps a 113-bit "quad"
type, you can invoke "make Printf" to add Printf (and variants, such
as Fprintf) to gdtoa.a. These are analogs, declared in stdio1.h, of
printf and fprintf, etc. in which %La, %Le, %Lf, and %Lg are for long
double and (if appropriate) %Lqa, %Lqe, %Lqf, and %Lqg are for quad
precision printing.

Please send comments to David M. Gay (dmg at acm dot org, with " at "
changed at "@" and " dot " changed to ".").
2 changes: 0 additions & 2 deletions lib/libc/gdtoa/arithchk.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* $NetBSD: arithchk.c,v 1.1.1.1 2006/01/25 15:18:40 kleink Exp $ */

/****************************************************************
Copyright (C) 1997, 1998 Lucent Technologies
All Rights Reserved
Expand Down
2 changes: 0 additions & 2 deletions lib/libc/gdtoa/dmisc.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* $NetBSD: dmisc.c,v 1.1.1.1 2006/01/25 15:18:40 kleink Exp $ */

/****************************************************************
The author of this software is David M. Gay.
Expand Down
Loading

0 comments on commit 2d7b777

Please sign in to comment.