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
@fxsaber NormalizeDouble rounds to decimal places, which is different from rounding to significant digits. SF is 1-15 or 17 inclusive. There is no 0.
Didn't understand.
NormalizeDouble(12.345, 2) -> 12.35
RoundToSignificantDigits(12.345, 2) -> 12
EqualDouble() is used to compare suspected equal amounts like 1.123456 and 1.23456789
also can be used very large numbers like 1234567891234.1234 and 1234567891234.1255
without knowing the decimal digits in the numbers you comapre against each other.https://www.wikiwand.com/en/Significant_figures
https://chem.libretexts.org/Bookshelves/General_Chemistry/Book%3A_Chem1_(Lower)/04%3A_The_Basics_of_Chemistry/4.06%3A_Significant_Figures_and_Rounding
https://www.calculatorsoup.com/calculators/math/significant-figures-rounding.php
Forum on trading, automated trading systems and testing trading strategies
Libraries: Math Utils
fxsaber, 2023.02.21 21:01
You need to learn how to make proper performance measurements.
21 times faster.
@fxsaber I did not check after you, yesterday!
But, when I came back today, I found you benchmarked it wrongly. You just benchmarked the modulo % operator, but with some compiler's internal optimizations you got that unrealistic difference.
I used this simple benchmark to re-check. Both functions are fast enough. So, no change!
@fxsaber I did not check after you, yesterday!
But, when I came back today, I found you benchmarked it wrongly. You just benchmarked the modulo % operator, but with some compiler's internal optimizations you got that unrealistic difference.
I used this simple benchmark to re-check. Both functions are fast enough. So, no change!
You are drawing wrong conclusions.
// 200000000.0
means the function calls were not optimized by the compiler. I do not know why you manipulate the 3rd argument, leave it as a default parameter and re-test.
Use a simple loop.
means the function calls were not optimized by the compiler. I do not know why you manipulate the 3rd argument, leave it as a default parameter and re-test.
Use a simple loop.
Unfortunately, you do not understand what you are measuring.
Disable compiler optimizations and give it a try.
So, why to disable? I write the function, then I depend on the optimizing compiler.
Otherwise, I would program in assembly like in the old days :-)