Raymond Toy wrote:
> Raymond Toy wrote:
>
>> After a bit more testing, I'll check in this code.
>>
>>
> I've done some testing with random numbers with exponents from 10^5 to
> 2*10^5. What I see is that about 4-5% of the time the fast conversion
> is off by one bit from the exact conversion. Can't seem to make it any
> better.
>
Forgot to mention that the difference only happens for negative
exponents. I have not encountered a case where there is a difference
for positive exponents.
Anyway, I've checked in the change. There two variables that can be
used to control the routine. (These should probably be removed once
we're comfortable with the routine.)
fast_bfloat_conversion enables or disables the fast algorithm. It
defaults to true.
fast_bfloat_threshold is the minimum exponent for which the fast routine
is used. It defaults to 100000.
If you want to play with extra precision above what is already done, set
*fast-bfloat-extra-bits* to something other than the default of 0.
Ray