Rounding numbers in MT4 via NormalizeDouble - page 10

 
Алексей Тарабанов:
In the early 1980s, Antonina Loseva, a graduate of Noginsk programming school, was working under my careful guidance. Here is how she solved the problem of rounding to integers: int A = double B + 0.5

Thanks for your story, now "int A = double B + 0.5" is solved: int A = (int)MathCeil(double B);

But the question in this case is how to cut without rounding.

 
lilita bogachkova:

Thanks for your story, now "int A = double B + 0.5" is solved: int A = (int)MathCeil(double B);

But in this case it is a question of how to cut without rounding.

It is easy to cut without rounding, just do not round (do not increase double by 0.5 rounding step).

Compare your construction to mine in terms of speed, and yours is incorrect, sorry...

 
Dmitry Fedoseev:

DoubleToStr(0.9999,3)=1.000

So, draw your conclusions.

What does 3 have to do with it? We're using Bid and Digits.

I don't know what you're talking about. In another thread, I chatted about it for three pages. That how to cut here for example on your example not knowing the number of fractional characters and you proved that 0-and do not count and right.

DoubleToStr(0.9999,4)

and then mode one character

 
Алексей Тарабанов:

Trimming without rounding is easy, just don't round (don't increase double by 0.5 rounding step).

...

Code?

 
Vasyl Nosal:

int A =double B

Is your heart pounding?

 
Vasyl Nosal:

What does 3 have to do with it? We're using Bid and Digits.

I don't know what you're talking about. In another thread, I chatted about it for three pages. That how to cut here for example on your example not knowing the number of fractional characters and you proved that the 0-and do not count and right.

I don't know what you got there. We kind of truncate to a given number of characters.
 
Алексей Тарабанов:

int A =double B

Is your heart pounding?

Is this code already?

This is even betterNormalizeDouble(1.15-0.05,1);

:)))))))))))))))

 
Dmitry Fedoseev:
I don't know what you're on about. We seem to discard up to a set number of characters.
We do. But we convert the double to a string over the whole number of fractional characters.
 
Vasyl Nosal:

Is this code already?

This is even betterNormalizeDouble(1.15-0.05,1);

:)))))))))))))))

Yes, it's fun...
 
Vasyl Nosal:

...

DoubleToStr(0.99999,4)

and then mode one character

How about this?