QuotenewLISP has two types of basic arithmetic operators: integer (+ - * /) and floating point (add sub mul div).
The arithmetic functions convert their arguments into types compatible with the function's own type: integer function arguments into integers, floating point function arguments into floating points.
(format "%.20f" (sub 9999999999999999 9999999999999998))
=> "2.00000000000000000000" (error)
(format "%.20f" (sub 999999999999999 999999999999998))
=> "1.00000000000000000000" (ok)
(format "%.20f" (sub 8888888888888889 8888888888888888))
=> "1.00000000000000000000" (ok)
(format "%.20f" (sub 1000000000000000 999999999999999))
=> "1.00000000000000000000" (ok)
(format "%.20f" (sub 10000000000000000 9999999999999999))
=> "0.00000000000000000000" (error)
(format "%.20f" (sub 10000000000000000 1))
=> "10000000000000000.00000000000000000000"
(format "%.20f" (sub 10000000000000000 2))
=> "9999999999999998.00000000000000000000"
(format "%.20f" (sub 10000000000000000 3))
=> "9999999999999996.00000000000000000000"
(format "%.20f" (sub 10000000000000000 4))
=> "9999999999999996.00000000000000000000"
(format "%.20f" (sub 10000000000000000 5))
=> "9999999999999996.00000000000000000000"
(format "%.20f" (sub 10000000000000000 6))
=> "9999999999999994.00000000000000000000"
#include <iostream>
using namespace std;
int main()
{
cout<<(1e16 - 1) << endl;
cout<<(10000000000000000 - 1);
return 0;
}
=> 1e+16
=> 9999999999999999
(rotate '("1" "A" "B" "2") 8)
;-> ("1" "A" "B" "2")
(rotate '("1" "A" "B" "2") -8)
;-> ("1") ;ERROR
(rotate '("1" "A" "B" "2") 12)
;-> ("1" "A" "B" "2")
(rotate '("1" "A" "B" "2") -12)
;-> ("1") ;ERROR
(rotate lst (- (% r (length lst))))
(rotate '("1" "A" "B" "2") (- (% 12 4)))
;-> ("1" "A" "B" "2")
(rotate '("1" "A" "B" "2") (- (% 8 4)))
;-> ("1" "A" "B" "2")