
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Thanks. But this.
PS Slow.
Also, this has round-off erros.
Edit:
This function avoid a lot of corner cases (very fast + accurate):
This function avoid a lot of corner cases (very fast + accurate):
Speeded it up a bit.
Faster than the NormalizeDouble function by 20%.
Speeded it up a bit.
Faster than the NormalizeDouble function by 20%.
Yes, that's an accurate algorithm ( than your first one) to round without round-off errors.
But, you use two lookup operations. For ceil and floor, you will need 3 lookup tables!
Anyway, a little cleaner:
Edit:
Another idea instead of lookup table for exact powers of ten, you could use the "Exponentiation by squaring (Binary exponentiation) algorithm".
This is a lot faster than MathPow(), but it is slower than the lookup table method.