Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #5930
| From | Stephen Heumann <stephen.heumann@gmail.com> |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | IIGS SANE Bugs and Quirks |
| Date | 2021-12-21 20:37 -0600 |
| Organization | A noiseless patient Spider |
| Message-ID | <spu316$65n$1@dont-email.me> (permalink) |
I've recently been doing some work using SANE (updating the ORCA/C math libraries, which should be available in a new release hopefully fairly soon). In the course of that, I've run into some situations where SANE's behavior is buggy or differs from the documentation. In particular, the first issue below is a definite bug, and programs calling SANE may wish to work around it (e.g. by not calling FX2L/FX2C on negative numbers). The others issues are less serious and at least some are errors in the documentation rather than bugs in SANE, but anyone using SANE should be aware of them. * FX2L and FX2C can yield the wrong value for certain negative integers (e.g. -2147483648). I think the numbers affected are negative integers that have zeros in at least the bottom 16 bits (in two’s-complement representation). For such numbers, the errors occur fairly frequently but not always. They seem to occur even more commonly (maybe always) if the bottom 32 bits are zero. This only seems to affect integer inputs, not non-integer numbers that round to such integers. * Conversions of out-of-range values to comp do not always yield the comp NAN. This may be related to the above issue. * The definition of the SANE extended format allows for what are sometimes called unnormalized numbers, where the integer part i is 0, the fraction f is nonzero, and the exponent is not the minimum possible value. In all cases, the exact same numeric value can be represented as a normalized number (with i=1) or a subnormal number (with i=0 and the minimum possible exponent). The manual includes unnormalized numbers within its definition of “denormalized” numbers, but FCLASSX actually classifies them as normalized, even in the case where their value is subnormal. (AFAIK SANE does not output unnormalized numbers, so this should rarely come up in practice.) * For the FREM calls, Apple Numerics Manual 2nd Ed., p.94 says “The Y register receives $80 if n is negative and 0 otherwise,” but p. 253 says “sign(Yreg) ← sign of n”. These descriptions are inconsistent with each other in the case of 65816 SANE (with 16-bit registers), and it turns out neither of them is quite right. It appears that the low-order eight bits of Y are set to $80 or 0, but the high-order bits may not be 0 or have the sign as described. * Apple Numerics Manual 2nd Ed., p. 256 shows comparisons where the type of DST varies but SRC is always extended. The actual behavior is the reverse of this: SRC varies and DST is always extended. I think this is a misprint in the manual. The behavior is described correctly on p. 96, and also (for 6502 SANE) in the corresponding table in Apple Numerics Manual 1st Ed. * “The fclass functions should return the sign of the passed number in n-bit and Y. They do not report the sign at all, though, which has to be considered a bug.” (Noted by Soenke Behrens in lsaneglue docs.) I've also posted a copy of this list that I will keep updated if I find additional issues: https://gist.github.com/sheumann/594fae25142102e0eb8521cc8c81b6f6 -- Stephen Heumann
Back to comp.sys.apple2.programmer | Previous | Next — Next in thread | Find similar
IIGS SANE Bugs and Quirks Stephen Heumann <stephen.heumann@gmail.com> - 2021-12-21 20:37 -0600
Re: IIGS SANE Bugs and Quirks Hugh Hood <hughhood@earthlink.net> - 2021-12-22 23:15 -0600
Re: IIGS SANE Bugs and Quirks fadden <fadden@fadden.com> - 2021-12-23 08:01 -0800
Re: IIGS SANE Bugs and Quirks Stephen Heumann <stephen.heumann@gmail.com> - 2021-12-23 16:10 -0600
csiph-web