Re: First --with-long-double, then _Decimal64!

How many pieces have to be in place to make a --with-Decimal64 option
that works similarly to --with-long-double in configure?

Not many.  Search for GNM_WITH_LONG_DOUBLE
and its counterpart over in goffice.

However, ...

1. You are going to need versions of the math functions
    in the C library that works with your type.  sin, cos, sqrt,
    pow, etc.

2. You need compiler support.  The compiler must do the
    right thing for *, /, +, -, etc.  The compiler must have
    a way of specifying decimal constants of the relevant
    type.  Also, the type cannot need a constructor,
    a destructor, or special assignment handling.


John Harrison's paper shows that in many cases, if you have 80 bit
long doubles, you can just cast your _Decimal64 to long double and pass
it to the existing long double libc function to get accurate results, at
least for transcendentals.

I have actually met John a couple of times.  Without having
read this particular paper of his, I can tell you that he probably
assumes that the C library's long-double functions are accurate
to begin with.  For glibc that just isn't true.  Also, my gut feeling
is that going from exact to long-double to Decimal64 will
occasionally give you the wrong last bit.  For example, if my
memory serves me right, you need something like 119 bits
of log's result before can guarantee correct rounding to plain
old double.  I'm sure John's paper spells this out in all its glory.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]