Recent posts

#21
newLISP in the real world / Re: Lint and/or code formattin...
Last post by itistoday - February 15, 2024, 10:16:31 AM
I normally use Parinfer
#22
newLISP in the real world / Lint and/or code formatting pr...
Last post by dukester - February 15, 2024, 06:28:46 AM
Is there one hiding somewhere? I searched this Forum and the Home site w/o any luck.
#23
newLISP in the real world / Re: sub bug?
Last post by cameyo - January 17, 2024, 06:24:00 AM
From the newLISP manual:
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.
#24
newLISP in the real world / Re: sub bug?
Last post by cameyo - January 14, 2024, 08:44:30 AM
Some test:

(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"


In C++:
#include <iostream>

using namespace std;

int main()
{
    cout<<(1e16 - 1) << endl;
    cout<<(10000000000000000 - 1);
    return 0;
}
=> 1e+16
=> 9999999999999999
#25
newLISP in the real world / sub bug?
Last post by vashushpanov - January 11, 2024, 07:12:11 PM
> (sub 9999999999999999,0 9999999999999998,0)
=> 2
> (- 9999999999999999 9999999999999998)
=> 1
#26
newLISP in the real world / Re: rotate bug?
Last post by cameyo - January 09, 2024, 09:47:22 AM
Thanks!!
#27
newLISP in the real world / Re: rotate bug?
Last post by vashushpanov - January 09, 2024, 01:50:57 AM
in file nl-liststr.c replace string
if (length <= 1 || count == 0 || length == labs(count))
to
if (length <= 1 || count == 0 || length == labs(count) || count % length == 0)

and recompile NewLisp
#28
newLISP in the real world / rotate bug?
Last post by cameyo - December 19, 2023, 05:23:26 AM
Maybe a bug of "rotate" when negative rotations and absolute rotations multiple of length of list.

(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

Workaround:
(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")

#29
newLISP in the real world / Reverse lowercase to uppercase...
Last post by cameyo - December 18, 2023, 10:58:19 AM
Given a string, how to reverse lowercase to uppercase and vice versa with a "regex"?
#30
newLISP and the O.S. / Re: Build newLISP for win10 64...
Last post by IVShilov - December 16, 2023, 11:13:24 AM
Thank you!