float to bfloat



The point of this seems to be that a float can be converted into an
exact equivalent rational number, like 0.333333333334  can be converted
to 3333333333334/100000000000    or whatever that is reduced to
lowest terms and typed with the right number of 3333... .
OR one could observe that a very compact rational number, 1/3, is quite
close to that float value, and decide to rationalize it to 1/3, even though
it isn't the absolute closest.

Which would you like?  My recollection is that there is some "epsilon" in
the rationalize code in maxima.  If you set it to less than 
one-unit-in-the-last-place
(ULP) of the single or double float representation, then you get the version
that Stavros wants.  If you set it to something less, (like 2 ULP) then 
you would
get  1/3 --> floats to  0.33333334  --> bfloats to 
0.3333333333333333333333333333
instead of                          -->            
0.3333333434534534436426908

I would prefer having that epsilon around if possible.

RJF


Raymond Toy wrote:

>>>>>>"Stavros" == Stavros Macrakis <stavros.macrakis@verizon.net> writes:
>>>>>>            
>>>>>>
>
>    Stavros> Raymond explains that floattofp rationalizes the float first, and adds
>    Stavros> "I agree that there should be fuzz digits, but it is rather nice to see
>    Stavros> the bigfloat looks like an obvious extension."
>
>    Stavros> bfloat should not be in the business of guessing -- it should represent
>    Stavros> the precise float in question.
>
>Oh, I definitely agree, but it is rather nice. :-)
>
>    Stavros> By the way, there are some bugs in older versions of fixfloat (my
>    Stavros> 588346, 789053) but apparently they have been fixed.
>
>    Stavros> Willis, Ray -- didn't we discuss all this over a year ago?  I think the
>    Stavros> only reason we didn't convert to integer-decode-float at that time was
>    Stavros> that it was buggy in GCL.  In GCL 2.5.0, (integer-decode-float 1.0)
>    Stavros> crashes (my GCL Support Request #101688 of Jan 2003) -- this is reported
>    Stavros> fixed now.
>
>Don't recall the exact issues, but since Camm says
>integer-decode-float is fixed now, I'll try to fix the bfloat issue.
>
>Ray
>
>_______________________________________________
>Maxima mailing list
>Maxima@www.math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>  
>