The function `expt' acts strangely when given certain rational second arguments
Here is the system info you requested, followed by an example of the apparent bug. (expt x y) is nothing at all like its true value, when
y is the rational number you will see below.
Another strange thing is that changing custom:default-float-format produces completely different behavior.
.................................
uname -a ==> Linux mn001 4.15.0-128-generic #131-Ubuntu SMP Wed Dec 9 06:57:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
clisp --version ==>
GNU CLISP 2.49.60+ (2017-06-25) (built on lgw01-amd64-012.buildd [127.0.1.1])
Software: GNU C 7.3.0
gcc -falign-functions=4 -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type -Wmissing-declarations -Wimplicit -Wno-sign-compare -Wno-format-nonliteral
-Wno-shift-negative-value -O -fwrapv -fno-strict-aliasing -DENABLE_UNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -Wl,-Bsymbolic-functions -Wl,-z,relro
libgnu.a -lreadline -lncurses -ldl -lffcall -lsigsegv
SAFETY=0 TYPECODES WIDE_HARD GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
libsigsegv 2.11
libreadline 5.2
libffcall 2.0
Features:
(READLINE REGEXP WILDCARD SYSCALLS I18N LOOP COMPILER CLOS MOP CLISP ANSI-CL
COMMON-LISP LISP=CL INTERPRETER LOGICAL-PATHNAMES SOCKETS GENERIC-STREAMS
SCREEN FFI GETTEXT UNICODE BASE-CHAR=CHARACTER WORD-SIZE=64 PC386 UNIX)
C Modules: (clisp i18n syscalls regexp readline)
Installation directory: /usr/lib/clisp-2.49.60+/
User language: ENGLISH
Machine: X86_64 (X86_64) mn001.cm.cluster [172.16.2.236]
.................................
"Welcome to GNU CLISP 2.49.60+ (2017-06-25) http://clisp.org/"
(lisp-implementation-version) ; "2.49.60+ (2017-06-25) (built on lgw01-amd64-012.buildd [127.0.1.1])"
(setq rat 460536752677/8796093022208) ; 460536752677/8796093022208
(type-of rat) ; RATIO
(expt 0 rat) ; 0
(expt 1 rat) ; 1
(expt 2 rat) ; 1.0 !
(expt 3 rat) ; 1.0 !
(expt 2.0 rat) ; 1.0 !
(expt 3/2 rat) ; 1.0 !
(expt 2/3 rat) ; EXPT: floating point underflow
(setq rat (coerce rat 'single-float)) ; 0.052356966
(expt 2 rat) ; 1.0369576
(exp ( rat (log 2))) ; 1.0369576
(setq rat (coerce rat 'double-float)) ; 0.052356967066430116d0
(expt 2 rat) ; 1.0369576444521136d0
(setq rat (coerce rat 'long-float)) ; 0.052356967066430115665L0 0
(expt 2 rat) ; 1.036957644452113654L0
custom:default-float-format ; SINGLE-FLOAT
(setq custom:default-float-format 'double-float) ; DOUBLE-FLOAT
(expt 2 rat) ; 1.036 8631299144577d0 still wrong!
(expt 2 rat) ; 1.036 9576444521136d0
Is there some way to edit the bug report above? I just wanted to neaten it up in a couple of places.
Thanks!