Re: 1364 issue 140 and negative exponents

From: Kurt Baty (kurt@wsfdb.wsfdb.com)
Date: Mon May 05 2003 - 13:00:13 PDT

  • Next message: Kurt Baty: "Re: 1364 issue 140 and negative exponents"

    Precedence: bulk

    > I am not sure what you are trying to convey with that
    > first $display statement before the main loop in your
    > test program.

    Yes, I to noticed the

    > 2 ** -1 = 1
    > -2 ** -1 = -1

    rounding cases so the extra display statement shows that
    verilog-XL does in fact round the real value 0.5
    to the integer value 1

    >
    > Are you trying to show that reals are being rounded
    > to nearest as opposed to being rounded towards zero?
    >
    > 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".

    > 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".

    >
    > >From James' email today and from the discussion this morning, I had
    > thought the desired results would be:
    >
    > 2 ** -1 = 0
    > -2 ** -1 = 0
    >

    I too was taken in!! (fished-in?!)

            kurt

    > Kurt Baty wrote:
    > >
    > > Precedence: bulk
    > >
    > > > From drm@xilinx.com Mon May 5 13:41:55 2003
    > > >
    > > > > 2 ** -1 = 1 = 0.5
    > > > > -2 ** -1 = -1 = -0.5
    > > >
    > >
    > > please note that:
    > >
    > > initial
    > > begin
    > > x_real = 0.5;
    > > x = x_real;
    > > $display("x = %0d = x_real =",x,x_real);
    > > $display;
    > > for(y=limit;y>=-limit;y=y-1) begin
    > >
    > > displays:
    > >
    > > Highest level modules:
    > > ieee_etf_140_test
    > >



    This archive was generated by hypermail 2.1.4 : Mon May 05 2003 - 13:07:58 PDT and
    sponsored by Boyd Technology, Inc.