mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-22 20:40:29 +02:00
* numbers.c (scm_divide): Fix (/ 0). Thanks to Keith Wright for
reporting the bug.
This commit is contained in:
parent
84aff7a7f2
commit
164826d3ae
3 changed files with 11 additions and 2 deletions
1
THANKS
1
THANKS
|
@ -23,3 +23,4 @@ For fixes or providing information which led to a fix:
|
|||
Ken Raeburn
|
||||
Bill Schottstaedt
|
||||
Momchil Velikov
|
||||
Keith Wright
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2001-11-22 Dirk Herrmann <D.Herrmann@tu-bs.de>
|
||||
|
||||
* numbers.c (scm_divide): Fix (/ 0). Thanks to Keith Wright for
|
||||
reporting the bug.
|
||||
|
||||
2001-11-21 Marius Vollmer <mvo@zagadka.ping.de>
|
||||
|
||||
* Makefile.am (install-exec-hook): Prepend $(DESTDIR) to filename.
|
||||
|
|
|
@ -3707,10 +3707,13 @@ scm_divide (SCM x, SCM y)
|
|||
if (SCM_UNBNDP (x)) {
|
||||
SCM_WTA_DISPATCH_0 (g_divide, s_divide);
|
||||
} else if (SCM_INUMP (x)) {
|
||||
if (SCM_EQ_P (x, SCM_MAKINUM (1L)) || SCM_EQ_P (x, SCM_MAKINUM (-1L))) {
|
||||
long xx = SCM_INUM (x);
|
||||
if (xx == 1 || xx == -1) {
|
||||
return x;
|
||||
} else if (xx == 0) {
|
||||
scm_num_overflow (s_divide);
|
||||
} else {
|
||||
return scm_make_real (1.0 / (double) SCM_INUM (x));
|
||||
return scm_make_real (1.0 / (double) xx);
|
||||
}
|
||||
} else if (SCM_BIGP (x)) {
|
||||
return scm_make_real (1.0 / scm_i_big2dbl (x));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue