From: Kevin Ryde <user42@zip.com.au>
Subject: scm_difference big - -inum
Date: Fri, 22 Aug 2003 11:18:33 +1000 [thread overview]
Message-ID: <87wud64hhy.fsf@zip.com.au> (raw)
[-- Attachment #1: Type: text/plain, Size: 172 bytes --]
I fixed a bit of a gremlin in "-",
* numbers.c (scm_difference): Correction to bignum - negative inum.
* tests/numbers.test (-): Exercise bignum - inum.
[-- Attachment #2: numbers.c.big-sub-inum.diff --]
[-- Type: text/plain, Size: 512 bytes --]
--- numbers.c.~1.197.~ 2003-07-29 09:27:59.000000000 +1000
+++ numbers.c 2003-08-21 17:06:30.000000000 +1000
@@ -3370,7 +3370,10 @@
{
SCM result = scm_i_mkbig ();
- mpz_sub_ui (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (x), yy);
+ if (yy >= 0)
+ mpz_sub_ui (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (x), yy);
+ else
+ mpz_add_ui (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (x), -yy);
scm_remember_upto_here_1 (x);
if ((sgn_x < 0 && (yy > 0)) || ((sgn_x > 0) && yy < 0))
[-- Attachment #3: numbers.test.big-sub-inum.diff --]
[-- Type: text/plain, Size: 587 bytes --]
--- numbers.test.~1.30.~ 1970-01-01 10:00:01.000000000 +1000
+++ numbers.test 2003-08-21 17:07:04.000000000 +1000
@@ -1784,7 +1784,15 @@
(pass-if "-inum - +bignum"
(= #x-100000000000000000000000000000001
- (- -1 #x100000000000000000000000000000000))))
+ (- -1 #x100000000000000000000000000000000)))
+
+ (pass-if "big - inum"
+ (= #xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
+ (- #x100000000000000000000000000000000 1)))
+
+ (pass-if "big - -inum"
+ (= #x100000000000000000000000000000001
+ (- #x100000000000000000000000000000000 -1))))
;;;
;;; *
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
reply other threads:[~2003-08-22 1:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87wud64hhy.fsf@zip.com.au \
--to=user42@zip.com.au \
/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).