Re: rounding
From: Richard Maine (nospam_at_see.signature)
Date: 06/08/04
- Next message: Jugoslav Dujic: "Re: Turning compiler optimizations off causes segmentation fault"
- Previous message: beliavsky_at_aol.com: "Re: C++ wrapper for a fortran77 program??"
- In reply to: Robert Corbett: "Re: rounding"
- Next in thread: Robert Corbett: "Re: rounding"
- Reply: Robert Corbett: "Re: rounding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 08 Jun 2004 08:20:32 -0700
robert.corbett@sun.com (Robert Corbett) writes:
> The Fortran 95 standard can and has been interpreted as requiring
> NINT(X) to return values more than 0.5 away from X....
I would call that claim misleading. Perhaps one could argue, while
dancing with the angels on the head of a pin, that it *CAN* be
interpreted that way, insomuch as anything can be interpreted anyway,
but that would make the point rather abstract. It is likely also true that
it has at least once been interpreted this way by someone. I presume
that's why Bob submitted f90 interp 200 (and his colleague Keith
Bierman submitted 202). So yes, one could say that Bob contributed to
motivating the rewording that was done in corrigenda 2 of f95 (and is
thus is officially part of f95 and also is in the draft of f2003).
However, note that if anyone interpreted the standard that way, it was
*NOT* J3/WG5 - or anyway, that wasn't the final answer. I realize
that Bob didn't explicitly say that the interpretation alluded to was
an official interpretation from J3/WG5, but it would sure be easy to
get that misimpression. (Looks to me like Giles took the bait).
The official interpretation on the question is below
----------------------------------------------------------------------
NUMBER: 000012
TITLE: Evaluation of Intrinsic Procedures
KEYWORDS: Algorithm, Mathematical, Computational
DEFECT TYPE: Erratum
STATUS: Included in corrigendum/complete
QUESTION:
1. When the standard specifies an algorithm for computing a
mathematical procedure, must a processor use the specified
algorithm?
Example: ANINT is defined as INT (A + 0.5). On some processors
ANINT (16 000 001.0) evaluates to 16 000 002.0 using
this algorithm.
2. May a processor return a mathematically equivalent result in the
evaluation of a numeric intrinsic procedure?
Example: If ANINT (16 000 001.0) can be computed as the more
expected 16 000 001.0, may a processor do so?
ANSWER:
1. No, a processor is not required to use the algorithm from the
standard.
2. Yes, a processor may return the mathematically equivalent result
in the evaluation of any numeric intrinsic procedure.
DISCUSSION:
The use of an algorithm in the definitions for intrinsic procedures is
intended to describe the end result. It is not intended to require
that a processor use a particular method of achieving that result.
Thus, an algorithm specifies the mathematical results, not the
computational results, of the evaluation of intrinsic procedures.
This standard does not require a processor to use a particular
accuracy or precision. Section 1.4, "Exclusions", states in part:
"This standard does not specify: . . .
(6) The physical properties of the representation of quantities
and the method of rounding, approximating, or computing
numeric values on a particular processor." [1:26, 1:37-38]
The edits correct the definitions of the results for the intrinsic
functions ANINT and NINT to be expressed in mathematical terms.
EDITS:
On page 231, subclause 13.14.10, Result Value paragraph [231:16-17]. Replace by
<Result Value.> The result is the integer nearest A, or if there are
two integers equally near A, the result is whichever such integer
has the greater magnitude.
On page 259, subclause 13.14.77, Result Value paragraph [259:9-10]. Replace by
<Result Value.> The result is the integer nearest A, or if there are
two integers equally near A, the result is whichever such integer
has the greater magnitude.
SUBMITTED BY: Keith H. Bierman
HISTORY: 95-247r1 m134 Submitted as F90 interp 000202 with proposed
response, approved 9-4, subsumes F90 interp
000200.
95-256 m134 Ballot failed, 10-6
95-260 m135 Proposed response, no action
96-023 m136 Proposed response, no action
96-054 m137 Proposed response, no action
96-117 m138 Proposed response, no action
97-259r1 m143 Re-submitted as F95 interp 000012 with
proposed response
00-214 m153 Passed unanimously
00-254 m154 Passed J3 letter ballot
00-268 m154 Failed WG5 ballot (N1403)
01-153 m155 Passed unanimously by J3 meeting
01-224r1 m157 Passed by J3 letter ballot
WG5/N1435 Passed by WG5 ballot
01-Nov wg5 edits contained in corrigendum #2 {N1472}
----------------------------------------------------------------------
-- Richard Maine | Good judgment comes from experience; email: my first.last at org.domain | experience comes from bad judgment. org: nasa, domain: gov | -- Mark Twain
- Next message: Jugoslav Dujic: "Re: Turning compiler optimizations off causes segmentation fault"
- Previous message: beliavsky_at_aol.com: "Re: C++ wrapper for a fortran77 program??"
- In reply to: Robert Corbett: "Re: rounding"
- Next in thread: Robert Corbett: "Re: rounding"
- Reply: Robert Corbett: "Re: rounding"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|