what's the max value for a real ??
Author Message
what's the max value for a real ??

I am writing a filter in Verilog with real variables.

In Verilog, aren't real variables 64 bits, giving them
a range of like +/- 1.0E32 or something ??

A few of my filter coefficients have values like 1.8E+22.

Thanks very much.

Sent via Deja.com http://www.*-*-*.com/

Sat, 01 Mar 2003 05:20:28 GMT
what's the max value for a real ??

Quote:

> I am writing a filter in Verilog with real variables.

> In Verilog, aren't real variables 64 bits, giving them
> a range of like +/- 1.0E32 or something ??

> A few of my filter coefficients have values like 1.8E+22.

> Thanks very much.

> Sent via Deja.com http://www.deja.com/

Real numbers in Verilog are exactly the IEEE 754 (I think) standard,
and hence are the same things you get in fortran or C for double
precision or double, respectively; and hence your range is from
1.7976E+308 to 2.2250E-308, assuming you stick with normaized numbers.

Check out various web references, by typing "IEEE 754 real numbers"
into your favorite search engine; I got interesting ones, including
http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html

--

_    //     Sr VP Technology             650-934-6888
\  //      Verisity Design              650-934-6801 FAX
\//       <http://www.verisity.com>    408-202-1137 Cell
--------------------------------------------------------------
Get my verilog emacs mode from        <http://www.verilog.com>

Wed, 02 Apr 2003 09:17:38 GMT
what's the max value for a real ??

Quote:

>> I am writing a filter in Verilog with real variables.

>> In Verilog, aren't real variables 64 bits, giving them
>> a range of like +/- 1.0E32 or something ??

>> A few of my filter coefficients have values like 1.8E+22.

>> Thanks very much.

>> Sent via Deja.com http://www.deja.com/

>Real numbers in Verilog are exactly the IEEE 754 (I think) standard,
>and hence are the same things you get in FORTRAN or C for double
>precision or double, respectively; and hence your range is from
>1.7976E+308 to 2.2250E-308, assuming you stick with normaized numbers.

Correct me if I'm wrong, but I don't think the LRM has anything to say
about real numbers. The closest it gets is specifying that arithmetic
operators should treat reals as "signed, floating point", which
doesn't mean much. I can't see anywhere where the minimum range of a
real is given. The bibliography references 754, but I don't know why.

In practice, the compiler vendor will code up reals in the format used
by the processor, which will be IEEE754 in all the cases I know of, so
you can probably assume you've got single-precision 754 if nothing
else.

Evan

Sun, 06 Apr 2003 03:00:00 GMT
what's the max value for a real ??

Quote:

>>> I am writing a filter in Verilog with real variables.

>>> In Verilog, aren't real variables 64 bits, giving them
>>> a range of like +/- 1.0E32 or something ??

>>> A few of my filter coefficients have values like 1.8E+22.

>>> Thanks very much.

>>> Sent via Deja.com http://www.deja.com/

>>Real numbers in Verilog are exactly the IEEE 754 (I think) standard,
>>and hence are the same things you get in FORTRAN or C for double
>>precision or double, respectively; and hence your range is from
>>1.7976E+308 to 2.2250E-308, assuming you stick with normaized numbers.

>Correct me if I'm wrong, but I don't think the LRM has anything to say

I stand corrected - I had an email (which doesn't seem to have been
copied here) pointing out that the \$realtobits and \$bitstoreal
conversion functions, on p204, do expect and produce 64-bit IEEE754.

Evan

Mon, 07 Apr 2003 03:00:00 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages