Page 1 of 1

mat BUG

Posted: Tue Jul 26, 2016 8:33 pm
by kosh
Hello Lutz.

"mat" function returns incorrect value on 64-bit system.
(This problem is confirmed on Windows and macOSX both 32/64-bit)

Code: Select all

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.

Re: mat BUG

Posted: Tue Jul 26, 2016 9:56 pm
by rickyboy
Here too.

Code: Select all

$ 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.

Re: mat BUG

Posted: Wed Jul 27, 2016 1:54 am
by Lutz
Thanks Kosh and Rickyboy, now working:

http://www.newlisp.org/downloads/develo ... nprogress/

Code: Select all

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