In VW7.8 Float nextBefore is broken for powers of two

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

In VW7.8 Float nextBefore is broken for powers of two

Nicolas Cellier

Let's take a power of two

    e := (Float emin + 1 to: Float emax) atRandom.
    f := 16r800000 asFloat * (2 raisedTo: e + 1 - Float precision).

We have:
    f unitOfLeastPrecision = (16r1 asFloat * (2 raisedTo: e + 1 - Float precision)).

With VW7.8 definition of nextBefore, which subtract f - f unitOfLeastPrecision,
we obtain:
    f nextBefore = (16r7FFFFF asFloat * (2 raisedTo: e + 1 - Float precision)).
and once normalized:
    f nextBefore = (16rFFFFFE asFloat * (2 raisedTo: e - Float precision)).

But there is another Float in between these two,
    16rFFFFFF asFloat * (2 raisedTo: e - Float precision) < f.
    16rFFFFFF asFloat * (2 raisedTo: e - Float precision) > f nextBefore.

Yay, we sometimes need to subtract ulp/2...

Nicolas

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: In VW7.8 Float nextBefore is broken for powers of two

Andres Valloud-6
We know about this.  The idea is to fix this little problem and a bunch
of other stuff with a single work push.

On 7/29/2012 4:58 PM, Nicolas Cellier wrote:

>
> Let's take a power of two
>
>      e := (Float emin + 1 to: Float emax) atRandom.
>      f := 16r800000 asFloat * (2 raisedTo: e + 1 - Float precision).
>
> We have:
>      f unitOfLeastPrecision = (16r1 asFloat * (2 raisedTo: e + 1 - Float precision)).
>
> With VW7.8 definition of nextBefore, which subtract f - f unitOfLeastPrecision,
> we obtain:
>      f nextBefore = (16r7FFFFF asFloat * (2 raisedTo: e + 1 - Float precision)).
> and once normalized:
>      f nextBefore = (16rFFFFFE asFloat * (2 raisedTo: e - Float precision)).
>
> But there is another Float in between these two,
>      16rFFFFFF asFloat * (2 raisedTo: e - Float precision) < f.
>      16rFFFFFF asFloat * (2 raisedTo: e - Float precision) > f nextBefore.
>
> Yay, we sometimes need to subtract ulp/2...
>
> Nicolas
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc