public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Panicz Maciej Godek <godek.maciek@gmail.com>, kawa <kawa@sourceware.org>
Subject: Re: Comparison of numerical types
Date: Sun, 21 Jan 2024 13:14:01 -0800	[thread overview]
Message-ID: <30b9affb-a96f-4e1f-888e-25b384ef1251@bothner.com> (raw)
In-Reply-To: <CAMFYt2Y1A6D_fziA-tYYXGNdCk24AGx2PuDVfhyCC65vQie+Og@mail.gmail.com>

On 1/21/24 02:11, Panicz Maciej Godek via Kawa wrote:
> The equality and comparison predicates on gnu.math.UByte, gnu.math.UInt and
> gnu.math.ULong require that they are compared with objects of the same type.

no, that is not the case - or at least I don't think it should be
> 
> This results in situations, where numbers with identical print
> representations are not equal (in the sense of both "equal?" and "=") to
> each other, and where the "less than" operator behaves counter-intuitively:

>> (define b0 (gnu.math.UByte:valueOf (as byte 241)))
>> (= b0 241)
> #f
>> (< b0 242)
> #f
> 
> Is there any particular reason for such behavior?

Just a bug. Fixed now.

My guess is this was a copy-paste error - I copied code from the UShort
implementation into the UByte implementation, incorrectly.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

      reply	other threads:[~2024-01-21 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-21 10:11 Panicz Maciej Godek
2024-01-21 21:14 ` Per Bothner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30b9affb-a96f-4e1f-888e-25b384ef1251@bothner.com \
    --to=per@bothner.com \
    --cc=godek.maciek@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).