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

Some pre-SRFI-ish thoughts on arithmetic

68 views
Skip to first unread message

Masanori Ogino

unread,
Jan 31, 2023, 10:45:04 AM1/31/23
to
Hi,

I had come up with some ideas last night. I am not sure if it is suitable for c.l.s., r7rs-work, or somewhere else, though...

- A language binding of ISO/IEC 10967 (Language Independent Arithmetic; LIA). It is basically a clarification on semantics of arithmetic functions.

- Reviving SRFI 73 (Exact Infinities). Not only it is required by LIA if a language provides so-called big integers, but they are sometimes useful as sentinel values and such.

- Configurable precision decimal. It is implementable with what RnRS provides but doing efficiently without low-level support seems not easy.

- Fixed-width decimal, i.e. radix 10 flonums.

Talk to me if you feel that any of the above is in fact worth drafting a document. It is also ok to tell me that they are worthless, though.

Best,
Masanori

co...@ccil.org

unread,
Feb 1, 2023, 2:15:14 AM2/1/23
to
On Tuesday, January 31, 2023 at 10:45:04 AM UTC-5, masano...@gmail.com wrote:

> - A language binding of ISO/IEC 10967 (Language Independent Arithmetic; LIA). It is basically a clarification on semantics of arithmetic functions.

I'll have to read the DISes before I can make a judgment on that.

Also worth looking at is ISO/IEC 11404:2007, General Purpose Datatypes. This is freely available from ISO at <https://standards.iso.org/ittf/PubliclyAvailableStandards/c039479_ISO_IEC_11404_2007(E).zip>.

Also worth looking at is ISO/IEC
> - Reviving SRFI 73 (Exact Infinities). Not only it is required by LIA if a language provides so-called big integers, but they are sometimes useful as sentinel values and such.

I don't think these are very useful: 1/0 is made of exact numbers, but it is not itself an exact number. However, if you are going to have them, you might as well have 0/0, or exact NaN, as well -- I don't really understand why SRFI 73 excludes it.

> - Configurable precision decimal. It is implementable with what RnRS provides but doing efficiently without low-level support seems not easy.
>
> - Fixed-width decimal, i.e. radix 10 flonums.

If it's fixed point, it can't be floating point too. You can squeeze a slightly larger range out of fixed-point decimal (for a given number of bits), but floating decimal has a standard (IEEE 754:2008) that is isomorphic to IEEE 754 binary floats.

Masanori Ogino

unread,
Feb 1, 2023, 6:45:07 AM2/1/23
to
Hi Cowan,

Thank you for your comments.

> > - A language binding of ISO/IEC 10967 (Language Independent Arithmetic; LIA). It is basically a clarification on semantics of arithmetic functions.
> I'll have to read the DISes before I can make a judgment on that.

The International Standard ISO/IEC 10967 series are freely available on the website iirc.

> Also worth looking at is ISO/IEC 11404:2007, General Purpose Datatypes. This is freely available from ISO at <https://standards.iso.org/ittf/PubliclyAvailableStandards/c039479_ISO_IEC_11404_2007(E).zip>.

Indeed. I have little interest on ISO/IEC 11404 at this moment, though.

> > - Reviving SRFI 73 (Exact Infinities). Not only it is required by LIA if a language provides so-called big integers, but they are sometimes useful as sentinel values and such.
> I don't think these are very useful: 1/0 is made of exact numbers, but it is not itself an exact number. However, if you are going to have them, you might as well have 0/0, or exact NaN, as well -- I don't really understand why SRFI 73 excludes it.

It was my fault to say reviving SRFI 73, which is misleading.

My intention is introducing a way to represent the upper and lower limits of integer. We can consider such limits without making 1/0 valid. In this context, NaN as a value is unnecessary, because 0/0 is invalid as well.

> > - Configurable precision decimal. It is implementable with what RnRS provides but doing efficiently without low-level support seems not easy.
> >
> > - Fixed-width decimal, i.e. radix 10 flonums.
> If it's fixed point, it can't be floating point too. You can squeeze a slightly larger range out of fixed-point decimal (for a given number of bits), but floating decimal has a standard (IEEE 754:2008) that is isomorphic to IEEE 754 binary floats.

Yes, it is what I meant. Fixed-width decimals ex. 128-bit floating point decimals as defined in IEEE 754-2008 and -2019.

Best,
Masanori

Masanori Ogino

unread,
Feb 2, 2023, 12:24:31 AM2/2/23
to
Hi again,

> > > - Reviving SRFI 73 (Exact Infinities). Not only it is required by LIA if a language provides so-called big integers, but they are sometimes useful as sentinel values and such.
> > I don't think these are very useful: 1/0 is made of exact numbers, but it is not itself an exact number. However, if you are going to have them, you might as well have 0/0, or exact NaN, as well -- I don't really understand why SRFI 73 excludes it.
> It was my fault to say reviving SRFI 73, which is misleading.
>
> My intention is introducing a way to represent the upper and lower limits of integer. We can consider such limits without making 1/0 valid. In this context, NaN as a value is unnecessary, because 0/0 is invalid as well.

So, in the end, exactness was unrelated.

Making (integer? +inf.0) and (integer? -inf.0) #t seems enough for LIA. Doing so, however, violates R7RS, section 6.2.4.

> Positive infinity is regarded as an inexact real (but not rational) number that ...
> Negative infinity is regarded as an inexact real (but not rational) number that ...

Best,
Masanori

Masanori Ogino

unread,
Feb 6, 2023, 2:25:09 PM2/6/23
to
Hi,

> > My intention is introducing a way to represent the upper and lower limits of integer. We can consider such limits without making 1/0 valid. In this context, NaN as a value is unnecessary, because 0/0 is invalid as well.
> So, in the end, exactness was unrelated.
>
> Making (integer? +inf.0) and (integer? -inf.0) #t seems enough for LIA. Doing so, however, violates R7RS, section 6.2.4.
>
> > Positive infinity is regarded as an inexact real (but not rational) number that ...
> > Negative infinity is regarded as an inexact real (but not rational) number that ...
>

Here is the full paragraph:

> Positive infinity is regarded as an inexact real (but not rational) number that represents an indeterminate value greater than the numbers represented by all rational numbers. Negative infinity is regarded as an inexact real (but not rational) number that represents an indeterminate value less than the numbers represented by all rational numbers.

This definitions above intentionally lack relations between real numbers and infinities.

I think we can define infinities differently so that we can specify them as just “special numbers” and make the position in the numerical tower implementation-defined. Any opinions, anyone?

Best,
Masanori
0 new messages