From: Dennis Marsa (drm@xilinx.com)
Date: Mon May 05 2003 - 13:43:07 PDT
Precedence: bulk
Kurt Baty wrote:
>
> > I had figured the results
> >
> > 2 ** -1 = 1
> > -2 ** -1 = -1
> >
> > were a result of rounding to nearest.
> >
>
> Actually, this rounding is not "round nearest"
> this is "round up" (I say "round away-from-zero"
> so as to not be confused in negative numbers).
> 0.5 would round to 0 in "round nearest".
Then I'm confused. If the rounding was "away from zero",
then wouldn't all of the combinations whose real result
is in the range (0.0,1.0) round to an integer result of 1,
and likewise results in the range (-1.0,0.0) would round to
a integer result of -1? Your test program results don't
indicate this.
In case it isn't already obvious, I am not a floating point
expert.
> > But, my specific question is, are these the results you are
> > advocating for these particular operands?
>
> yes, to took x ** y where x,y are integers and converted
> x (integer -> real -> bits(ieee 64 floating point))
>
> did a x_bits ** y using the pow function
>
> function [63:0] pow; // l**r, where l is fp64 and r is integer
>
> converted answer_bits (bits(ieee 64 floating point) -> real -> integer)
>
> and I make the claim that this is the most "math correct answer".
If you applied this methodology to integer division, what result would
you get for 1 / 2?
Dennis
This archive was generated by hypermail 2.1.4
: Mon May 05 2003 - 13:44:16 PDT
and
sponsored by Boyd Technology, Inc.