y = (-1 * Int((-1 * x * y) / 100)) + y0 <-- isn't a negative * negative = positive? How is this any different from the ELSE case?
y = (-1 * Int((-1 * x * y) / 100)) + y0 <-- isn't a negative * negative = positive? How is this any different from the ELSE case?
if (x < 0 and y > 0) or (x > 0 and y < 0) then
y = (-1 * Int((-1 * x * y) / 100)) + y0
else
y = int(x * y / 100) + y0
end if
QB64
200574 60372774 120544974 180717174 240889374
301061574 309886830
4.637000000002445 seconds
FreeBasic
200574 60372774 120544974 180717174 240889374 301061574 309886830
2.118056500097737 seconds
well done bplus :)
Only 2 real changes here:
...
2) I took out the negative multiplication and swapped to negation, which we always process fast. (-1 * x isn't as efficient as -x, for example.)
I purposefully did not try to optimize it for any single language, but rather wanted the same code for each language.
Can anyone make a significant drop?
All I was doing was as I was asked here: