mat BUG

Pondering the philosophy behind the language
Post Reply
kosh
Posts: 72
Joined: Sun Sep 13, 2009 5:38 am
Location: Japan
Contact:

mat BUG

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

rickyboy
Posts: 597
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: mat BUG

Post 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.
(λx. x x) (λx. x x)

Lutz
Posts: 5285
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: mat BUG

Post 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

Post Reply