[In this question I don't want to consider the properties specific to

IEEE 754 and mean to be general as much as possible. And this

question arises when reading the answer to C90 DR025.]

Suppose an implementation that issues no diagnostic even when meets

a fp constant like 9e9999 which is greater than DBL_MAX because it

defines the range of representable values for double as from -infinity

to infinity. Is this implementation conforming? Note, according to the

standard, that the positive infinity does not qualify as /type/_MAX

since it is not a fp number. So in other words, should the range of

representable values for the fp types be from -/type/_MAX to

/type/_MAX inclusive? The relevant wording seems to say yes:

5.2.4.2.2p9

- maximum representable finite floating-point number ...

~~~~~~~~~~~~~

6.4.4p2 (constraints)

The value of a constant shall be in the range of representable

~~~~~~~~~~~~~

values for its type.

Is this interpretation correct?

Thanks in advance.

Yes. If the implementation defines the range of representable values

as -infinity to +infinity, then all values are representable. Some

values convert exactly to a machine representation, other values

convert to a machine representation that is approximately equal to

the value (so is an inexact conversion).

Not if -infinity and +infinity are valid machine representations.

There are three cases to consider:

0.1 value between DBL_MIN and DBL_MAX

1e-99999 value between zero and DBL_MIN

9e+99999 value between DBL_MAX and infinity

All three cases are not exactly representable (assumes non-decimal

FLT_RADIX).

All three numbers are bounded by a pair of machine representations.

---

Fred J. Tydeman Tydeman Consulting

XXXX@XXXXX.COM Testing, numerics, programming

+1 (775) 358-9748 Vice-chair of J11 (ANSI "C")

Sample C99+FPCE tests: http://www.yqcomputer.com/

Savers sleep well, investors eat well, spenders work forever.

1. JW Fundies write a "JW Child Abuse" page in Wikipedia

2. "Comparison to integral constant is useless; the constant is outside the range of type 'int'"

3. VBA and FP 2002 / FP 2003 and the FP SDK

4. FP default-values and diagram "constants" can change in LabVIEW 6.1 and 7.1

5. FP Mail forms NT 4.0 w/ FP 2002 Ext to 2003 w/ FP 2002

6. "Un-representable DateTime"

7. Quantum dots (or whatever quantum representable in finite space) and Exponential Turing Machines

9. Find next machine-representable number (or Delphi version of "nextafter")

10. Multiply constant by date range

11. Public Range Constant - how do I?

12. Named Ranges vs. Constant Addresses, sheet protection, Guidanc

13. Assign a 2D array of constant values to a range

14. How do I select a date range in a FP 2003 DB results page?

15. How can I have a range of values select a constant value

2 post • Page:**1** of **1**