| |
|
|
Sven Bader | for the Translation some C++ Codes to XProfan supplant I the % Operator always through one MOD, though with unexpected Ergebnissen. either The Eingabewerte or the Result go into Integer umgwandelt.
the weicht from the Behavior of C++ and the Date Taschenrechner ex, which too numbers with Dezimalstellen accepted.
One example: 5.5 MOD 2 are 1.5 therefore 2*2 remainder 1.5
In XProfan yields The same bill 1.0, there either The 5.5 to 5.0 transformed becomes or the Result of 1.5 on 1.0.
here one small Listing to that understand and of/ one Solution
Übersehe I something in XProfan, there a Einestellung or a others Operator or goes it only with the Hilfsfunktion? |
|
|
| |
|
|
|
H.Brill | there in the Help MOD INTEGER as Parameter indicated are, clutching there well (X)Profans interne automatic Typumwandlung. the meets well on The Eingabeparameter as well as the Result To.
but wozu need one Float and MOD ? I need the not more than, if I z.B. 10it to put , straight or ungerade numbers a pool rausfischen wants.
with
is correct it Yes and it comes 0 out. |
|
|
| Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 02/24/23 ▲ |
|
|
|
|
Sven Bader | thanks for your response! The employment would still likewise reasonable as Division with Floats. one would like know, How often a number into others fit or even how much thereafter yet unverteilt spare remaining.
whom Ganzzahligen Divisionsrest use I in the practice speedy method something only each x-ten Schleifendurchgang To make.
The actually employment is his Spezialfall, its The Conversion of HSV in RGB colours. there's there thoroughly too such functions without MOD but the code had very quick works, and so I it as Einzeiler in a Def-function needed.
I work with Profan2Cpp and there is, How I even again nachgemessen have one Proc circa factor 350 slower as one Def, in XProfan 11 lying the factor with 1,1. the misleading sometimes To ungewöhnlichen "Stunts".
to Lesbarkeit let I in the rule yet a comment with the Original-function in the View source but so sees the Result then from
Def modu(2) (!(1) - !(2) * int(!(1) / !(2)))
def hsvToR(3) (if(((!(1) >= 60) AND (!(1) < 120)) OR ((!(1) >= 240) AND (!(1) < 300)) , (!(3) * !(2)) * (1.0 - abs( modu(!(1) / 60.0,2) - 1.0)), if(((!(1) >= 120) AND (!(1) < 240)), 0.0 , !(3) * !(2))) + (!(3) - (!(3) * !(2))))
def hsvToG(3) (if(((!(1) >= 0) AND (!(1) < 60)) OR ((!(1) >= 180) AND (!(1) < 240)) , (!(3) * !(2)) * (1.0 - abs(modu(!(1) / 60.0,2) - 1.0)), if(((!(1) >= 60) AND (!(1) < 180)), !(3) * !(2), 0.0)) + (!(3) - (!(3) * !(2))))
def hsvToB(3) (if((!(1) >= 0) AND (!(1) < 120), 0, if(((!(1) >= 180) AND (!(1) < 300)) , !(3) * !(2) , (!(3) * !(2)) * (1.0 - abs(modu(!(1) / 60.0, 2) - 1.0)))) + (!(3) - (!(3) * !(2))))
|
|
|
| |
|
|
|
H.Brill | it shining really so, that MOD only whom Integeranteil takes. the shining in C++, FreePascal etc. but too so To his.
Perhaps can but too with Inline - ASM what make, if it circa speed goes. with Set("AsmMode", 1) can itself indeed The Bytes together search, around the whole too with others Profanversionen through reaches To benefit.
there müßtest You time Volkmar in Paules Forum ask. would be Yes interestingly, there it indeed a crowd on FPU-command gives, The Fließkomma-Arithmetik rule.
The knows itself in ASM for version X4 to some extent well from. |
|
|
| Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 02/24/23 ▲ |
|
|
|
|
H.Brill | Sven Bader (24.02.2023)
I work with Profan2Cpp and there is, How I even again nachgemessen have one Proc circa factor 350 slower as one Def, in XProfan 11 lying the factor with 1,1. the misleading sometimes To ungewöhnlichen "Stunts".
The factor 350 lying but well to profane2Cpp yourself. loudly RGH should Procs at least just as quick worn out go. to faster Abarbeitung (C - code) was indeed Profan2Cpp virtual.
Sven Bader (24.02.2023)
since in XProfan too mehrzeilige functions (with Proc) possible are (ex Version 7.6), should these vorgezogen go. you'll at least just as quick worn out and are additionally in the rule too übersichtlicher and therefore leichter To understand.
|
|
|
| Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 02/24/23 ▲ |
|
|
|
|
Sven Bader | you have right, I had for Profan factor 1,1 erwähnt. means in Profan is a Proc straight time 10% slower, what completely ok is. in a, what P2Cpp there power, sure such a thing komplexes How globale Variables and Stukturen Verify and the function provide.
Profan2Cpp is Yes still faster, too with Procs, in amount having we Yes mostly already a 4-stelligen factor in the comparison to profane. its with only always a little bit to juggle, I whom code readable and compatible to profane hold would like but in the doubt a Speed-optimization sooner zugunsten of P2CPP entscheide.
I had incidentally not the screen, that MOD in C++ How in Profan reacted... possible was my Codevorlage too PHP or JS basiert. |
|
|
| |
|
|
|
H.Brill | If it on speed ankommt, is even ASM still first electoral. If I something like need, take so did i gladly PureBasic. the power then reinen FASM-output. if need be goes too a .DLL (Wrapper-DLL). mere can I,may I these only for my own tack benefit and The DLL on others Programmer not transmit. though I lebenslanges Update have, have I letztes year not updated. The Author (Fred) is Here's the next time C-Backend umgeswitcht. probably is it leichter, new command / functions To implementieren. Since there it in C certainly too tonnenweise .libs, The defined Funktionalitäten provide. so similar becomes it too RGH with designed Units made having. one need Yes not always the wheel new To invent. |
|
|
| Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 02/24/23 ▲ |
|
|
|
|
Sven Bader | usually fit the Speed, Defs are quick enough and Procs are ok except for items, The very often called go. sometimes reicht it simply, a Loop of outside to inside the Proc To verlagern.
to that understanding, what "langsam" is: The Proc-appeal lasts about a µs means 1/1.000.000 second or there are about 1000 Proc-Aufrufe per ms possible.
with one game with 60fps have I one Budget of about 16ms per Frame and I a CPU not fully auslasten would like are 1.000 Proc-Aufrufe per Frame means 1ms already plenty, its indeed yet something into functions drin, what too yet carryed out go would like
One Def need in the comparison 0,002 µs or. 0.000002 ms or. 0.000000002 s
, everything Profan2CPP. yet was means another Assembler necessary. |
|
|
| |
|
|
|
H.Brill | The experience, The I made have, are The internen creep of XProfan. The are too vastly faster as The own While with or Repeat programmierten. The MoveListProc is there very interestingly, straight what Arrays concerns. it standing Yes each spare, what in the MoveListProc happens.
here time one Test, where any 3 Opportunities measured go :
Declare Long a[], float a, e
Cls
Set("Decimals", 2)
SetSize a[], 30000
Mat a[] < 1
Mat a[] + 1
MoveListProc
Parameters string s, int i
If Get("MoveListMode") = 1
AddStrings(0, s)
Endif
ENDPROC
Proc Testproc
Parameters Long w
AddStrings(0, Str $(w))
ENDPROC
a = Val(DT("GetTime", 1, !NOW))
ClearList
Move("ArrToList", a[])
e = Val(DT("GetTime", 1, !NOW))
Print "Zeit with Move : ", e - a, "Sekunden"
set("MoveListMode", 1)
a = Val(DT("GetTime", 1, !NOW))
ClearList
move("ArrToList", a[])
e = Val(DT("GetTime", 1, !NOW))
Print "Zeit with MoveListProc : ", e - a, "Sekunden"
a = Val(DT("GetTime", 1, !NOW))
ClearList
WhileLoop 0, SizeOf(a[]) - 1
TestProc(a[&LOOP])
EndWhile
e = Val(DT("GetTime", 1, !NOW))
Print "Zeit with Loop + Proc : ", e - a, "Sekunden"
Print "Taste to that terminate..."
WaitKey
I hope, I have with the whom sec correctly. made. |
|
|
| Benutze XPROFAN X3 + FREEPROFAN Wir sind die XProfaner. Sie werden von uns assimiliert. Widerstand ist zwecklos! Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.
Was die Borg können, können wir schon lange. | 02/24/23 ▲ |
|
|
|
|
funkheld | with Purebasic goes it too without Wrapper as Procedure-Dll The is complete spare for all tack. |
|
|
| |
|
|