- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Nothing is faster, more stable, or easier to maintain than code that doesn’t exist.
Result = Int(Number.f(.d))
Result = Sign(Number.f(.d))
Huh??? Your code sample has very distinctive .f (float) but my code uses 4 or 8 byte integer default, depending on PB version.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Nothing is faster, more stable, or easier to maintain than code that doesn’t exist.
The function INT() expects a float so all variables within the function parameters are internally converted to floats. That is why the % function gets upset.
You can break the formula up to avoid the error.
TassyJim wrote: Tue Nov 12, 2024 2:41 am
The function INT() expects a float so all variables within the function parameters are internally converted to floats. That is why the % function gets upset.
The int() in the first line is OK because the % is outside the int() brackets.
I am not sure if you can call this a 'bug' or a 'feature' of PureBasic.
Jim
Hi Jim,
OK, so I deleted the words Int and Int from the equation, leaving the parentheses in place but got the same exact error, so it can't be solely the Int() function causing the issue. Something else going on there.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Nothing is faster, more stable, or easier to maintain than code that doesn’t exist.
sign() does the same thing. It converts to floats so cannot contain % within the brackets.
An intermediate variable is the only way around the issue as far as I can see.
TassyJim wrote: Tue Nov 12, 2024 5:58 am
sign() does the same thing. It converts to floats so cannot contain % within the brackets.
An intermediate variable is the only way around the issue as far as I can see.
OK, so the sign() is the "something else going on".
Yes I had already broken the one liner down into multiple lines in my original code: viewtopic.php?p=409551&hilit=DSTday+%3D ... et#p409551
Look for Procedure DSTformula(
Recently ran into some inconsistencies so I am backtracking to try to figure out where the code jumps off track. Developed the formula and code before my brain surgery and now its like trying to read greek.
- - - - - - - - - - - - - - - -
Randy
I *never* claimed to be a programmer.
Nothing is faster, more stable, or easier to maintain than code that doesn’t exist.