Take some time to learn how floating point number work and are stored:
To help understand (debugging purposes) the format of real number also look at the follow printing formats — PrintFormat
a
double
A real number in format [−]0xh.hhhh p±dd, where h.hhhh – mantissa in the form of hexadecimal digits, using "abcdef", dd - One or more digits of exponent. Number of decimal places is determined by the accuracy specification
A
double
A real number in format [−]0xh.hhhh P±dd, where h.hhhh – mantissa in the form of hexadecimal digits, using "ABCDEF", dd - One or more digits of exponent. Number of decimal places is determined by the accuracy specification

- www.mql5.com
I am trying to figure out how to convert a double that has zeros in front (eg, 0.0341 or 0.00020) to an integer (eg, 0.0341 to 341 or 0.00020 to 20). All zeros before the first non-zero digit should be dropped and the first non-zero digit to the last digit should form an integer.
The idea is to get number of decimal digits after the point, then multiply by 10^digits
long RemoveDecimalPoint(double number) { double pwr=1.0; while(MathRound(number*pwr)/pwr != number) pwr*=10; return long(number*pwr); } void OnStart() { RemoveDecimalPoint(0.0341); // 341 RemoveDecimalPoint(0.00020); // 2 RemoveDecimalPoint(-0.0341); // -341 }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to figure out how to convert a double that has zeros in front (eg, 0.0341 or 0.00020) to an integer (eg, 0.0341 to 341 or 0.00020 to 20). All zeros before the first non-zero digit should be dropped and the first non-zero digit to the last digit should form an integer.