guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scm_num2int change


From: Bill Schottstaedt
Subject: scm_num2int change
Date: Thu, 20 Sep 2001 08:37:35 -0700

>       * num2integral.i.c (NUM2INTEGRAL): Report an error when these
>       routines are passed an inexact.  This change in behavior is
>       motivated by concordance with R5RS: It is more common that a
>       primitive doesn't want to accept an inexact for an exact.

This is an inconvenient change.  scm_integer_p 1.0 returns #t, but
I can't use num2int to turn it into 1 anymore.  Where in "num" does it
say "exact num"?  Now before any call I have to check for both exact
and integer.

It also breaks existing Scheme code.  For example, I have

    (let ((mult (expt 2.0 (/ semitones 12.0))))

This now dies if semitones is 12:

wrong-type-arg: (integer-expt Wrong type argument in position ~A: ~S (2 1.0) #f)
Backtrace:
In /home/bil/cl/snd-test.scm:
[edited]
 172: 7* [expt 2.0 1.0]
   ?: 8  (cond ((integer? z2) (if # # #)) ((and # # #) ($expt z1 z2)) (#t (exp 
#)))
   ?: 9  [integer-expt 2.0 1.0]

>(expt 2.0 1.0)
integer-expt: Wrong type argument in position 2: 1.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]