(+) and (inc)

For the Compleat Fan
Locked
alex
Posts: 100
Joined: Thu Mar 10, 2005 2:27 pm
Location: Russia

(+) and (inc)

Post by alex »

(+) and (inc)

Code: Select all

newLISP v.8.8.0 on Win32 MinGW, execute 'newlisp -h' for more info.

> (setq num 2147483646)
2147483646
> (+ num 5)
-2147483645
> (inc 'num 5)
2147483651
>
Why?

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Could it be that:
If num is supplied, inc always returns the result as floating point even for integer input arguments.
I notice that

Code: Select all

(add num 5)
also gives 2147483651...

Locked