[J3] Question on TINY example

Malcolm Cohen malcolm at nag-j.co.jp
Wed Jun 22 22:05:55 UTC 2022


Hi Mark,

 

The example is correct.

 

It says “TINY (X) has the value 2−127 for real X whose model is as in 16.4, NOTE 1.”

 

That model is not IEEE-754, and makes no claim to be IEEE-754. The model for real values in 16.4 normative text is a much simpler model than IEEE-754; it is the “Brown model”.

 

Fortran does not require IEEE-754 arithmetic. We should not change that.

 

Please do not attempt to correct what is not broken.

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Mark LeAir via J3
Sent: Thursday, June 23, 2022 2:41 AM
To: j3 at mailman.j3-fortran.org
Cc: Mark LeAir <mleair at nvidia.com>
Subject: [J3] Question on TINY example

 

Another one of our compiler engineers pointed this out to me.  Do we agree this example needs fixing?

 

In F’2018, 16.9.191, the example has TINY(x) == 2**(-127) for default real.  I think that should be 2**(-126).

 

32-bit IEEE-754 has an exponent bias of 127.  For example, 1.0 is 0x3f800000, whose exponent field is 127.  So the smallest normal value, which has an exponent field of 1, is 2**(-126) times 1.0.  And TINY() is the smallest normal (full precision) value.

 

If this example is fixed, then so should the example for RANGE (16.9.158).

 

If the example for TINY() is not wrong, then the floating-point model used for examples is not IEEE-754, and if that’s the case, that should be fixed.

 

The example for TINY() in draft F’202X is the same (16.9.209).

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20220623/22726e2b/attachment.htm>


More information about the J3 mailing list