mat BUG

Started by kosh, July 26, 2016, 01:33:45 PM

Previous topic - Next topic

kosh

Hello Lutz.



"mat" function returns incorrect value on 64-bit system.

(This problem is confirmed on Windows and macOSX both 32/64-bit)


C:>newlisp -v
newLISP v.10.7.0 32-bit on Windows IPv4/6 UTF-8 libffi.

C:>newlisp -e "(mat * '((1 2 3) (4 5 6)) -1)"
((-1 -2 -3) (-4 -5 -6))

C:>newlisp-x64 -v
newLISP v.10.7.0 64-bit on Windows IPv4/6 UTF-8 libffi.

C:>newlisp-x64 -e "(mat * '((1 2 3) (4 5 6)) -1)"
((1.844674407370955e+019 3.68934881474191e+019 5.534023222112866e+019) (7.378697629483821e+019
  9.223372036854776e+019 1.106804644422573e+020))


Regards.

rickyboy

#1
Here too.


$ uname -srm
OpenBSD 6.0 amd64
$ newlisp -v
newLISP v.10.7.0 64-bit on BSD IPv4/6 UTF-8.
$ newlisp -e "(mat * '((1 2 3) (4 5 6)) -1)"
((1.844674407370955e+19 3.68934881474191e+19 5.534023222112865e+19) (7.378697629483821e+19
  9.223372036854776e+19 1.106804644422573e+20))

Thanks, kosh, for finding this.
(λx. x x) (λx. x x)

Lutz

#2
Thanks Kosh and Rickyboy, now working:



http://www.newlisp.org/downloads/development/inprogress/">http://www.newlisp.org/downloads/develo ... nprogress/">http://www.newlisp.org/downloads/development/inprogress/



newLISP v.10.7.1 64-bit on OSX IPv4/6 UTF-8 libffi, options: newlisp -h

> (mat * '((1 2 3) (4 5 6)) -1)
((-1 -2 -3) (-4 -5 -6))

> (mat * '((1 2 3) (4 5 6)) (float -1)) ;; on 10.7.0 64-bit cast the scalar argument as a float
((-1 -2 -3) (-4 -5 -6))
>


On broken 64-bit versions cast the scalar argument as a float as shown in the example