Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SANE Conversion Patch

67 views
Skip to first unread message

Stephen Heumann

unread,
Mar 27, 2023, 7:08:00 PM3/27/23
to
I've just released a patch that fixes a bug in SANE (the Standard Apple
Numerics Environment) on the IIGS. The bug is that when SANE is used
to convert a number from a floating-point type to an integer type, it
may give the wrong result for certain numbers. Specifically, the
numbers that may be affected are certain negative multiples of 65536
(e.g. -8388608, -65536000, etc).

This is a pretty obscure issue, but I've run into it when working on
the floating-point code in the ORCA/C libraries, so I figured I'd make
a patch to fix it. The patch and documentation are available here:

https://github.com/sheumann/SANEConvPatch

The download also includes a test program that you can use to see some
examples of the conversion errors and confirm that they are fixed after
you apply the patch.

--
Stephen Heumann

I am Rob

unread,
Mar 27, 2023, 9:31:10 PM3/27/23
to
I believe there was another SANE patch at one time. What did that one fix?

And what Applications might I run into problems with, without the patch?

Stephen Heumann

unread,
Mar 27, 2023, 10:16:43 PM3/27/23
to
On 2023-03-28 01:31:09 +0000, I am Rob said:

> I believe there was another SANE patch at one time. What did that one fix?

There was a patch called SANE.Fix that was meant to fix a different
SANE bug that existed in System 6.0 and earlier. That bug was fixed in
System 6.0.1, so SANE.Fix is no longer necessary. (See my patch's
README for some more details.)

> And what Applications might I run into problems with, without the patch?

I'm not aware of any specific application that triggers this bug.
Realistically, it's pretty unlikely that any program you use will do
these specific conversion operations on these specific numbers (which
is probably why nobody found and fixed the bug before).

That said, it definitely is possible to trigger it, e.g. by doing type
casts from floating-point to integer types in C code, and you might not
even know if some program is giving incorrect results because of this
issue.

--
Stephen Heumann

0 new messages