Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The trouble with computers is that they do what you tell them, not what you want. -- D. Cohen


devel / comp.sys.apple2.programmer / Re: IIGS SANE Bugs and Quirks

SubjectAuthor
* IIGS SANE Bugs and QuirksStephen Heumann
`* Re: IIGS SANE Bugs and QuirksHugh Hood
 +- Re: IIGS SANE Bugs and Quirksfadden
 `- Re: IIGS SANE Bugs and QuirksStephen Heumann

1
IIGS SANE Bugs and Quirks

<spu316$65n$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=200&group=comp.sys.apple2.programmer#200

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: stephen.heumann@gmail.com (Stephen Heumann)
Newsgroups: comp.sys.apple2.programmer
Subject: IIGS SANE Bugs and Quirks
Date: Tue, 21 Dec 2021 20:37:26 -0600
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <spu316$65n$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="e99a7a12d65b6e9a1975920065d7022f";
logging-data="6327"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dXhMZTYwtD19KIrDGPuV//QQNhon4txw="
User-Agent: Unison/2.2
Cancel-Lock: sha1:voAVlwaCB1KgXyQzvZLJoDHGcsI=
 by: Stephen Heumann - Wed, 22 Dec 2021 02:37 UTC

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

Re: IIGS SANE Bugs and Quirks

<8NednbHob691mFn8nZ2dnUU7-cvNnZ2d@earthlink.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=201&group=comp.sys.apple2.programmer#201

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 22 Dec 2021 23:15:19 -0600
Date: Wed, 22 Dec 2021 23:15:19 -0600
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.4.0
Subject: Re: IIGS SANE Bugs and Quirks
Content-Language: en-US
Newsgroups: comp.sys.apple2.programmer
References: <spu316$65n$1@dont-email.me>
From: hughhood@earthlink.net (Hugh Hood)
In-Reply-To: <spu316$65n$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Message-ID: <8NednbHob691mFn8nZ2dnUU7-cvNnZ2d@earthlink.com>
Lines: 65
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 208.189.119.51
X-Trace: sv3-TdUWi+dxgjllpLkYn/4UuAxgEWE5HlHNkzuUNd5tR0oo/6YRx3RzMHRLnapDiju4MB+4wI+7McYsKdP!0UdtStEFTk8X77uEGNM3pyTIH25Gm6ceXHaWVv8GegMR4QMaMdVdK6mtBVS7gqGzsMfzGaOXcBn+!dTQygldVnzblX25+IWHOKl8cdLbTv4MahzQ=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Original-Bytes: 3716
 by: Hugh Hood - Thu, 23 Dec 2021 05:15 UTC

On 12/21/2021 8:37 PM, Stephen Heumann wrote:

> * 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.
>

Stephen,

For some reason the math error and specifically the number 2147483648
struck a memory I had about a similar issue with UltraMacros for AppleWorks.

I finally found that it was referenced in Joe L. Walter's UltraMacros
Reference Manual. I've quoted it below, but don't really know if it will
be of any help to you. If not, please disregard.

>
> The extended math commands allow 26 special Ultra 4 variables to
> handle numbers ranging from negative 21 million to positive 21
> million with up to two decimal places.

> This allows you to calculate financial transactions without needing
> the spreadsheet, or to do any other math which is beyond the range of
> Ultra's normal 0-65535 limits.

> One limitation is that the result of a multiplication or division can
> not exceed 214,748.36, at least if you want an accurate answer.
> Additions and subtractions work all the way up to the maximum value.
> Multiplications and divisions are limited because of the need to
> maintain two decimal place accuracy.

> Ed: Because of this "limitation" for multiplication or division I
> would hesitate to use these extended math commands unless I knew for
> sure that there was no chance my data could exceed the limitation.
> Practice safe Hex, create a spreadsheet and do the calculations
> there.

> Here are the ranges. (The second columns have commas to make the
> numbers more readable, but you can't use commas in your macros. You
> must write the numbers as they appear in the first columns of each
> group.)

> Extended Variables Normal Ultra 4 (integers only)
> --------------------------------------------------------------
>
> Lowest: -21,474,836.47 0
> Highest: 21,474,836.47 65,535

What I don't understand is this -- supposedly the AppleWorks Spreadsheet
doesn't suffer from these limitations, but I know for certain that it
uses the SANE package.

Hugh Hood

Re: IIGS SANE Bugs and Quirks

<cca847a1-5255-42be-bd89-f80fc57dcfcdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=202&group=comp.sys.apple2.programmer#202

  copy link   Newsgroups: comp.sys.apple2.programmer
X-Received: by 2002:ac8:7d47:: with SMTP id h7mr2205841qtb.486.1640275277675;
Thu, 23 Dec 2021 08:01:17 -0800 (PST)
X-Received: by 2002:a05:6808:124e:: with SMTP id o14mr2115835oiv.91.1640275277254;
Thu, 23 Dec 2021 08:01:17 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.sys.apple2.programmer
Date: Thu, 23 Dec 2021 08:01:17 -0800 (PST)
In-Reply-To: <8NednbHob691mFn8nZ2dnUU7-cvNnZ2d@earthlink.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.130.68.111; posting-account=UAtoeQoAAADrX7T-MHdWWRC4Fzf0dsLP
NNTP-Posting-Host: 24.130.68.111
References: <spu316$65n$1@dont-email.me> <8NednbHob691mFn8nZ2dnUU7-cvNnZ2d@earthlink.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <cca847a1-5255-42be-bd89-f80fc57dcfcdn@googlegroups.com>
Subject: Re: IIGS SANE Bugs and Quirks
From: fadden@fadden.com (fadden)
Injection-Date: Thu, 23 Dec 2021 16:01:17 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 5
 by: fadden - Thu, 23 Dec 2021 16:01 UTC

On Wednesday, December 22, 2021 at 9:15:26 PM UTC-8, Hugh Hood wrote:
> What I don't understand is this -- supposedly the AppleWorks Spreadsheet
> doesn't suffer from these limitations, but I know for certain that it
> uses the SANE package.

Do the 8-bit and 16-bit SANE packages have different limitations?

Re: IIGS SANE Bugs and Quirks

<sq2s3s$p8j$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=203&group=comp.sys.apple2.programmer#203

  copy link   Newsgroups: comp.sys.apple2.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: stephen.heumann@gmail.com (Stephen Heumann)
Newsgroups: comp.sys.apple2.programmer
Subject: Re: IIGS SANE Bugs and Quirks
Date: Thu, 23 Dec 2021 16:10:04 -0600
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <sq2s3s$p8j$1@dont-email.me>
References: <spu316$65n$1@dont-email.me> <8NednbHob691mFn8nZ2dnUU7-cvNnZ2d@earthlink.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="3009e6886c5c61ebc721efaf4f976d2e";
logging-data="25875"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/JLperLumkUodirzJVPPjA5nL6SJfwRs4="
User-Agent: Unison/2.2
Cancel-Lock: sha1:4+45B3FInV/lgp5DXi7xQ6ajjO4=
 by: Stephen Heumann - Thu, 23 Dec 2021 22:10 UTC

On 2021-12-23 05:15:19 +0000, Hugh Hood said:

> For some reason the math error and specifically the number 2147483648
> struck a memory I had about a similar issue with UltraMacros for
> AppleWorks.

2147483648 is 2^31, so the range of values that can be represented in a
signed 32-bit number is -2147483648 to 2147483647. I noticed the bug
in SANE by testing the behavior at the limits of various types,
although the bug can also affect other values.

> I finally found that it was referenced in Joe L. Walter's UltraMacros
> Reference Manual. I've quoted it below, but don't really know if it
> will be of any help to you. If not, please disregard.
<description from UltraMacros manual snipped>
>
> What I don't understand is this -- supposedly the AppleWorks
> Spreadsheet doesn't suffer from these limitations, but I know for
> certain that it uses the SANE package.

From the description you quoted, it sounds like the special variables
in UltraMacros use a 32-bit fixed point representation with two digits
after the decimal point. That is not a format used by SANE, so
UltraMacros probably does the computations directly without going
through SANE.

The AppleWorks spreadsheet is different and does use SANE. However, it
uses the 8-bit 6502 version of it, which I haven't tested. It is
possible it might have some of the same issues I found, but I don't
know, and even if it did I'm not sure if that would actually affect
anything in AppleWorks.

--
Stephen Heumann

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor