From: "Göran Weinholt" <goran@weinholt.se>
To: 14916@debbugs.gnu.org
Subject: bug#14916: Fixnum procedures can be made to return non-fixnums
Date: Sat, 20 Jul 2013 07:56:21 +0200 [thread overview]
Message-ID: <8738r9ai62.fsf@industria.weinholt.se> (raw)
[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]
Hello schemers,
the fxdiv procedure from (rnrs) fails to check that its result is
representable as a fixnum:
scheme@(guile-user)> (import (rnrs))
scheme@(guile-user)> (fxdiv (least-fixnum) -1)
$1 = 2305843009213693952
It should raise an &implementation-restriction. Here are a few other
examples of the same problem:
scheme@(guile-user)> (fxdiv-and-mod (least-fixnum) -1)
$2 = 2305843009213693952
$3 = 0
scheme@(guile-user)> (fxdiv0 (least-fixnum) -1)
$4 = 2305843009213693952
scheme@(guile-user)> (fxdiv0-and-mod0 (least-fixnum) -1)
$5 = 2305843009213693952
$6 = 0
scheme@(guile-user)> (fxarithmetic-shift-left (greatest-fixnum) 1)
$7 = 4611686018427387902
scheme@(guile-user)> (fxarithmetic-shift (greatest-fixnum) 1)
$8 = 4611686018427387902
Tested with Guile 2.0.9.40-824b-dirty on an amd64 system.
Regards,
--
Göran Weinholt <goran@weinholt.se>
"Detta skall jag visa dig medelst ett stort papper som jag har fyllt
med faktiska upplysningar!" -- August Strindberg
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
next reply other threads:[~2013-07-20 5:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-20 5:56 Göran Weinholt [this message]
2013-08-17 3:32 ` bug#14916: Fixnum procedures can be made to return non-fixnums Mark H Weaver
2013-08-17 7:55 ` Göran Weinholt
2016-06-21 7:20 ` Andy Wingo
2016-06-22 15:32 ` Mark H Weaver
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8738r9ai62.fsf@industria.weinholt.se \
--to=goran@weinholt.se \
--cc=14916@debbugs.gnu.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).