Re: (log #c(0 1) #c(0 -1)) errors
making either of the coponents of the first #c() float avoids that bug but gets a different one: === > (log #c(0e0 1) #c(0 -1)) #C(-0.0 -0.0) > (log #c(0 1e0) #c(0 -1)) #C(-0.0 -0.0) === but leaving the first #c() rational and making the second float does not avoid it. otoh, all float gets the correct results: === > (log #c(0.0 1.0) #c(0.0 -1.0)) #C(-1.0 0.0) > (log #c(0l0 1l0) #c(0l0 -1l0)) #C(-1.0l0 0.0l0) === -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
Re: (log #c(0 1) #c(0 -1)) errors
>>>>> "P" == PR writes: P> I also noticed that setting: P> (si::trap-fpe t nil) P> changes the result to: P> (log #c(0 1) #c(0 -1)) P> #C(# #) ah. interesting. thanks. i hadn't thought to test that. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
Re: (log #c(0 1) #c(0 -1)) errors
origin/develop as of commit 858687605134788f52b904fc2bc365462e2d6ac9 fails with the same error. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
(log #c(0 1) #c(0 -1)) errors
With 21.2.1 I get: >> (log #c(0 1) #c(0 -1)) Debugger received error of type: DIVISION-BY-ZERO # Error flushed. gcl, sbcl and ccl all return #C(-1.0 0.0). other non-lisp software agrees. i haven't yet tried master. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
Re: bug in (log)
i should have realized this even before noticing ecl's limitation for logs of ratios, but at least i finally did since i'monly using log to find the exponent for an arbitrary precision replacement for format's ~e, it works to truncate first. so i ended up with this: (defun ilog (n (base nil base-p)) "return floor of base b log of n" (let ((s (if (< n 1) -1 1)) (trunc-n (truncate (if (< n 1) (/ n) n (floor (* s (if base-p (log trunc-n base) (log trunc-n)) One could use let* and then test s when choosing between n and (/ n), but i choose instead to let the compiler optimize the two calls to (< n 1). that makes my ~e replacement work exactly as desired on all lisps i've tried. (I have a ~// function which chooses output baed on the arg's type, with ratios done via that print-e-significant-digits function and everything else using write.) -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
Re: --norc --shell fails
this works: #!/usr/bin/env -S ecl --norc --shell -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
Re: bug in (log)
it looks like that bug only harms ratio. bignum integer seems to be ok. so aworkarount is, in the caseof a ratio, to take the difference of the logs of the numerator and the denominator. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
bug in (log)
(gitlab is uusable; i have to report here.) ecl 21.2.1 gives: > (log 1/6319748715279270675921934218987893281199411530039296) Debugger received error of type: DIVISION-BY-ZERO # Error flushed. whereas other cl's (i testyed sbcl and ccl) give results like: ? (log 1/6319748715279270675921934218987893281199411530039296) -119.27552 I tested on amd64 (gentoo) and arm64 (debian and netbsd) with identical results. i did not have a musl box or other bsd to test on. run with --no-trap-fpe, the result is #. another example is: (truncate (log 1/6319748715279270675921934218987893281199418867)) Debugger received error of type: ARITHMETIC-ERROR # whereas this works: (truncate (log 1/631974871527927067592193421898789328119941867)) -103 -0.27893066 which of course suggests that the issue is c's long double's precision. it looks like ecl could use an mpq log function; https://github.com/linas/anant might work. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
--norc --shell fails
with 21.2.1, when running a script which has hash-bang line: #!/usr/bin/ecl --norc --shell i get: Unknown command line option --norc --shell. in general, hash-bang lines can only have an executable and zero or one options. the filename is not added when there are two options. it would be best if there were single-character options for --norc and --shell, so they could be combined into one -option. or, alternatively, --shell might imply --norc and there could be a function in ext: which runs the rc file(s) for those times (if any) when --rc --shell would be preferred. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6
manual typo
At: https://common-lisp.net/project/ecl/static/manual/Characters.html#Characters it looks like the tabe has the 'With Unicode' and 'Without Unicode' entries backwards. -JimC -- James Cloos OpenPGP: 0x997A9F17ED7DAEA6