I have a double variable with three figures after the dot.
how can I make it round,
for example:
1.124 = 1.120
1.126 = 1.130
how can I make it round,
for example:
1.124 = 1.120
1.126 = 1.130
Enter extern Variables into a alert window if missed. 2 replies
Variables 18 replies
Why can't I divide two variables? 3 replies
How to enter external variables? 1 reply
Define every MQL4 variables, functions? 4 replies
DislikedI have a double variable with three figures after the dot. how can I make it round, for example: 1.124 = 1.120 1.126 = 1.130Ignored
Disliked{quote} but i want to round just the last figure and this function rounds till the integer , from 1.123 to 1.0Ignored
DislikedI have a double variable with three figures after the dot. how can I make it round, for example: 1.124 = 1.120 1.126 = 1.130Ignored
Disliked{quote} quiet- on that same page is MathCell() and MathFloor() in addition you can use DoubleToStr() https://docs.mql4.com/convert/doubletostr if none of those work can you give an example of the result you are expectingIgnored
double Variable=1.12348934; Print("DoubleToString:"+DoubleToString(Variable,2)); Print("NormalizeDouble:"+NormalizeDouble(Variable,2));
double Variable=1.1299999; Print("DoubleToString:"+DoubleToString(Variable,3)); Print("NormalizeDouble:"+NormalizeDouble(Variable,3));
Disliked{quote} but i want to round just the last figure and this function rounds till the integer , from 1.123 to 1.0Ignored
double valA = 1.12837462; printf("Before NormalizeDouble, valA is %.8f",valA); valA = NormalizeDouble(valA, 2); printf("After NormalizeDouble, valA is %.8f",valA);
double value=0.9731300000000001; double value2=NormalizeDouble(value,Digits); Print(value2);
double Yuvarla(double Sayi) { double _sayi1=MathRound(Sayi*MathPow(10,Digits)); double _sayi2=_sayi1/MathPow(10,Rakam); return _sayi2; }