ISSUE 274

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 274
Category errata
Synopsis LRM does not specify how Infinity and NaNs to be displayed for
State open
Class errata-discuss
Arrival-DateJan 26 2003
Originator Shalom Bresticker <Shalom.Bresticker@motorola.com>
Release 2001b: 17.1
Environment
Description


--
Shalom Bresticker Shalom.Bresticker@motorola.com
Design & Reuse Methodology Tel: +972 9 9522268
Motorola Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 441478



Fix
Audit-Trail

From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Shalom.Bresticker@motorola.com
Cc:
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be displayed for real numbers
Date: Thu, 21 Aug 2003 19:39:37 -0400 (EDT)

I suspect that all tools just use the C stdio library to format their real
numbers for displaying. We certainly do. The C standard does not specify
how these values should be displayed (as should be expected, since the C
standard does not assume IEEE floating point). This could result in slight
format differences between platforms. I have no interest in reinventing
the C stdio formatting capabilities, especially since those routines may
have been optimized using specialized knowledge of floating point algorithms.

So I would oppose specifying anything that might prevent using those routines.

Steven Sharp
sharp@cadence.com

From: Shalom.Bresticker@freescale.com
To: Steven Sharp <sharp@cadence.com>
Cc: etf-bugs@boyd.com
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be
displayed for real numbers
Date: Wed, 19 May 2004 10:58:34 +0300 (IDT)

Hi, I'm catching up on mail that I've left in my Inbox many months ago.
Not that I don't have work to do, just a little bored...

Anyway...

But the IEEE Verilog standard DOES specify use of IEEE Std 754.

By chance, I was reading an old interview with Prof. William Kahan,
one of the key developers of 754 (an extremely interesting person,
see the publications at the end of his home page,
http://www.cs.berkeley.edu/~wkahan/). He pointed out that 754 is a
software standard as well as a hardware standard.

I want and expect to get consistent results from my Verilog programs
on all platforms which I can easily run a diff on.

The C standard does in fact specify output formats of real numbers,
including how to handle Infinity and Nan. I would accept using the
same specification as the C standard. It might even be possible to
reference the appropriate section of the C standard, just as we
reference 754. The C standard does allow a little flexibility.

In fact, maybe we should consider that large parts of the I/O routine
definitions could be replaced by references to the appropriate places in
the C standard.

But as long as the Verilog LRM is stand-alone, it must specify how
Infinity and NaN are to be displayed.


On Thu, 21 Aug 2003, Steven Sharp wrote:

> I suspect that all tools just use the C stdio library to format their real
> numbers for displaying. We certainly do. The C standard does not specify
> how these values should be displayed (as should be expected, since the C
> standard does not assume IEEE floating point). This could result in slight
> format differences between platforms. I have no interest in reinventing
> the C stdio formatting capabilities, especially since those routines may
> have been optimized using specialized knowledge of floating point algorithms.
>
> So I would oppose specifying anything that might prevent using those routines.

From: "Vreugdenhil, Gordon" <gordon_vreugdenhil@mentorg.com>
To: etf-bugs@boyd.com
Cc:
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be
displayed for real numbers
Date: Wed, 19 May 2004 07:11:42 -0700

Shalom, I agree that we should essentially adopt C rules for
reals. Note, however, that there is variance between C libs
in the capitalization of NaN and Inf -- some vendors use
"NaN" and "Inf" while others use "nan" and "inf". I don't think
that the standards specify that aspect of the behavior.

Gord.
--
--------------------------------------------------------------------
Gordon Vreugdenhil, Staff Engineer 503-685-0808
Model Technology (Mentor Graphics) gordonv@model.com

From: Shalom.Bresticker@freescale.com
To: "Vreugdenhil, Gordon" <gordon_vreugdenhil@mentorg.com>
Cc: etf-bugs@boyd.com
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be
displayed for real numbers
Date: Wed, 19 May 2004 17:32:02 +0300 (IDT)

The draft C standard that I have (from Aug 3, 1998) says about the f format:

A double argument representing an infinity is converted in one of the styles [-]inf or [-]infinity which style is implementation-defined. A double argument representing a NaN is converted in one of the styles [-]nan or [-]nan(n-char-sequence) which style, and the meaning of any n-char-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, respectively.

Of course, we could be more flexible about capatilization.

Shalom

> Shalom, I agree that we should essentially adopt C rules for
> reals. Note, however, that there is variance between C libs
> in the capitalization of NaN and Inf -- some vendors use
> "NaN" and "Inf" while others use "nan" and "inf". I don't think
> that the standards specify that aspect of the behavior.

--
Shalom Bresticker Shalom.Bresticker @freescale.com
Design & Reuse Methodology Tel: +972 9 9522268
Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478

[ ]Freescale Internal Use Only
[ ]Freescale Confidential Proprietary

From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Shalom.Bresticker@freescale.com
Cc:
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be displayed for real numbers
Date: Wed, 19 May 2004 13:17:07 -0400 (EDT)

I suspect that all existing implementations just call C sprintf() to format
real numbers for display. I can't imagine why they would do anything else.
As a practical matter, the standard shouldn't specify anything that conflicts
with that.

Steven Sharp
sharp@cadence.com

From: Shalom.Bresticker@freescale.com
To: Steven Sharp <sharp@cadence.com>
Cc: etf-bugs@boyd.com
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be
displayed for real numbers
Date: Wed, 19 May 2004 21:45:02 +0300 (IDT)

> I suspect that all existing implementations just call C sprintf() to format
> real numbers for display. I can't imagine why they would do anything else.
> As a practical matter, the standard shouldn't specify anything that conflicts
> with that.

The point is (one point, anyway) that the user has a right to know in advance
what his program will print in such a case. This came up when we were
discussing the power operator. It never occurred to me, for example, that
I might get an output with non-numeric characters. If I were writing a
program or script to read that output, I would have to take that into
account.

No one is suggesting to conflict with C.

Shalom

From: Steven Sharp <sharp@cadence.com>
To: sharp@cadence.com, Shalom.Bresticker@freescale.com
Cc: etf-bugs@boyd.com
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be displayed for real numbers
Date: Wed, 19 May 2004 14:52:58 -0400 (EDT)

I notice that the LRM doesn't fully describe the capabilities of the real
number formats either. It just says they "have the full formatting
capabilities available in the C language."

Steven Sharp
sharp@cadence.com

From: Shalom Bresticker <Shalom.Bresticker@freescale.com>
To: Steven Sharp <sharp@cadence.com>
Cc: Shalom Bresticker <Shalom.Bresticker@motorola.com>, etf-bugs@boyd.com
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be
displayed for real numbers
Date: Thu, 20 May 2004 07:39:00 +0300

Hmmm. That is itself a statement which needs to be verified.
I.e., does what is explicitly specified in the Verilog LRM contradict anything
from C?

Shalom


Steven Sharp wrote:

> I notice that the LRM doesn't fully describe the capabilities of the real
> number formats either. It just says they "have the full formatting
> capabilities available in the C language."
>
> Steven Sharp
> sharp@cadence.com

--
Shalom Bresticker Shalom.Bresticker @freescale.com
Design & Reuse Methodology Tel: +972 9 9522268
Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478

[ ]Freescale Internal Use Only
[ ]Freescale Confidential Proprietary



From: Shalom.Bresticker@freescale.com
To: Steven Sharp <sharp@cadence.com>
Cc: etf-bugs@boyd.com
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be
displayed for real numbers
Date: Thu, 20 May 2004 22:15:15 +0300 (IDT)

On Thu, 20 May 2004, Steven Sharp wrote:

> > Hmmm. That is itself a statement which needs to be verified.
> > I.e., does what is explicitly specified in the Verilog LRM contradict anything
> > from C?
>
> The statement is only referring to the real formats (%e, %f, %g). That
> statement and a simple example are the only things specified for them in
> the LRM.

I know.

> This statement also doesn't specify a C standard version, which could be
> an issue if the formatting capabilities for reals have changed in C.

That's exactly the point.
I have a draft version of the ISO standard, I don't have the final version.
But this draft does not seem to be 100% identical to what the Verilog LRM
says in some of the details.

Shalom

--
Shalom Bresticker Shalom.Bresticker @freescale.com
Design & Reuse Methodology Tel: +972 9 9522268
Freescale Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 5441478

[ ]Freescale Internal Use Only
[ ]Freescale Confidential Proprietary

From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Shalom.Bresticker@freescale.com
Cc:
Subject: Re: errata/274: LRM does not specify how Infinity and NaNs to be displayed for real numbers
Date: Thu, 20 May 2004 14:11:54 -0400 (EDT)

> Hmmm. That is itself a statement which needs to be verified.
> I.e., does what is explicitly specified in the Verilog LRM contradict anything
> from C?

The statement is only referring to the real formats (%e, %f, %g). That
statement and a simple example are the only things specified for them in
the LRM.

This statement also doesn't specify a C standard version, which could be
an issue if the formatting capabilities for reals have changed in C.

Steven Sharp
sharp@cadence.com

Unformatted
real numbers

Hosted by Boyd Technology