07-201 To: J3 From: Malcolm Cohen Subject: UTI 093 Date: 2007 May 01 1. Introduction UTI 093 notes that SET_EXPONENT is "broken" (meaningless) for both INF and NaN. It should also note that it is contradictory for subnormal numbers. This could be processed as an interp or simply fixed in F2008. However, since I would recommend different answers in these cases (see discussion), if we do process it as an interp I would recommend fixing F2008 as a separate issue. Also, if we process this as an interp, although it is mentioned in F03/0042, given the size of that interp (covers all intrinsic functions) it would probably be more productive to make a separate interp. F03/0042 can then be limited to the "mathematical functions" or something. The paper is formatted as an F2008 change but would be easy to modify to be an interp. 2. Discussion The basic philosophical question to be answered is should SET_EXPONENT only return "model" numbers as it claims (the Description says that). Or should it be allowed to return "extended model" numbers? (Reminder: "extended model" allows subnormal numbers.) The evidence in the function is that in F2003 we allowed the argument X to be a number in the extended model. Therefore I conclude that we should also have allowed it to return extended model numbers. The second question is what to do with INF and NaN since neither are representable even in the extended model. There are two obvious and defensible possibilities: (1) they are not allowed as arguments, i.e. it is not standardised and thefore the program is not standard-conforming. (2) they are outside the domain of the function and it should therefore return NaN (and if the argument was an INF, it should raise INVALID). If we are to process this as an interp, I suggest that (1) is clearly the right answer for F2003. However, (2) is clearly a superior answer for F2008. SET_EXPONENT(INF,any) is either INF*0 or INF/INF, depending on how you look at it, and both of those are defined to be NaN by IEEE 754. 3. Edits for 07-007r1 [417:13.7.156p1] "Model number" -> "Number", "model" -> "extended model". {Fix description; this is still not completely accurate - subnormal results are only approximations to the right answer, and 0/INF/NaN are being ignored, but at least we're in the right ballpark. NOTE: As an interp, this is the edit that should be done to F2003.} [418:13.7.156p5+2] Append to paragraph "If X is an IEEE infinity, the result is an IEEE NaN; IEEE_INVALID signals. If X is an IEEE NaN, the result is the same NaN." {Specify the result for IEEE INF and NaN. This is not entirely satisfactory, since we are leaving the previous sentence that is not useful for INF and NaN - I recommend the alternative below. NOTE: This edit is for F2008 only, not as an interp.} RECOMMENDED ALTERNATIVE EDIT: [418:13.7.156p5] Transmogrify paragraph as follows Move the final sentence to the beginning. Insert the new sentences (above). Change "The" to "Otherwise, the". This gives the new paragraph as "If X has the value zero, the result has the same value as X. If X is an IEEE infinity, the result is an IEEE NaN; IEEE_INVALID signals. If X is an IEEE NaN, the result is the same NaN. Otherwise, the result has the value X \times $b^{I-e}$, where $b$ and $e$ are as defined in 13.4 for the representation for the value of X in the model that has the radix of X but no limits on exponent values." [418:UTI 093] Delete if resolved. ===END===