Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers and more
Posted: Sun Jun 05, 2022 4:43 pm
thabk you 

http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8843369000005623 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8588957000010851 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8535100999997667 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8651286999993317 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 0.8615126999993663 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 1.376355700000204 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time 15.84586130000025 seconds
Code: Select all
In(1) := f(x?) := Pause(0.01)
evaluation time: 0.067ms
In(2) := Iterate(f(x), {x, 1, 100});
evaluation time: 1058.806ms
In(3) := IterateParallel(f(x), {x, 1, 100});
evaluation time: 144.861ms
Code: Select all
XIncludeFile "../Lizard/Library/Lizard.pbi"
; Lizard always has to be initialized first.
If Lizard::Initialize("../Lizard/Library") ; Define here the path of the Lizard.dll location.
Debug "Lizard kernel has been initialized. Version "+Lizard::Version()
Else
Debug "Lizard kernel initialization failed!"
End
EndIf
Define In$, Out$, Dec$
;EX1
In$ = "Calculate(3 * 479207)"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => 1.43762e6 ; did not ask for this scientific notation
;EX2
In$ = "ToInteger(Calculate(3 * 479207))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; ==> 1437621 ; ok
;EX3
In$ = "ToInteger(Calculate(3 * 4657387907292887))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => 13972163721878660; wrong, should be 13972163721878661
;EX4
In$ = "ToInteger(Calculate(3 * 4657387907292887, 20))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => ok
;EX5
In$ = "ToInteger(Calculate(3 * 6825132555633339069956470743970633775870071, 20))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; 20475397666900017209869403903378106225786880 => wrong so 20 is Not enough For long integer-strings
;EX6
Out$ = "6825132555633339069956470743970633775870071"
Dec$ = Str(Len(Out$))
In$ = "ToInteger(Calculate(3 * " + Out$ + ", " + Dec$ + "))"
Out$ = Lizard::Evaluate(In$)
Debug Out$ ; => ok
; Details
; Integer numbers can be of any size And are Not limited To the word size of the processor.
; Integer numbers are always exact values.
;Questions:
;1. Where is the documentation of Evaluate()? I did not find it.
;2. How can I force output to be string format like in EX2.
;3. What am I doing wrong in EX3?
;4. Is Ex6 the way to go? Can I make it better/faster?
;5. Integer numbers are always exact values says the documentation, is this correct or am I doing something wrong?
Dear Al_the_dutch,Al_the_dutch wrote: Mon Oct 21, 2024 10:04 pm Hi STARGÅTE,
First let me thank you so much, this is great. I am using your script language and it is amazing fast and very useful.
But I have some questions.I hope you or other users can help me out.
Questions:
1. Where is the documentation of Evaluate()? I did not find it.
2. How can I force output to be string format like in EX2.
3. What am I doing wrong in EX3?
4. Is Ex6 the way to go? Can I make it better/faster?
5. Integer numbers are always exact values says the documentation, is this correct or am I doing something wrong?
KR Al