Build 2504 & 2506 Bug

 

I couldn't believe this.

A simple division returns zero without errors. How else can I be guaranteed that my all my previous code is functioning as it was, before these new changes?

void OnStart()
{
        double level = 1/2;
        Print(DoubleToString(level,2));
}

console:

bug

MetaQuotes. Really????? What if I have been losing money due to this? Would you refund me? If now, how can such a basic functionality be erroneous?


For sure, I'm considering other platforms now. This is devastating!!!!!

 

Really ?

 
Nelson Wanyama: A simple division returns zero without errors.
Really! On MT4 v434, division quotient don't give floating point values(Bug??) - MQL4 programming forum 2012.09.18
 
Alain Verleyen:

Really ?

Yep . Try it on any version of any platform

   //A
   double div1=1/2;
   Print("A : 1/2 = "+DoubleToString(div1,2));
   //B
   int portion1=1;
   int portion2=2;
   double div2=portion1/2;
   Print("B : 1/2 = "+DoubleToString(div2,2));
   //C
   double div3=1/portion2;
   Print("C : 1/2 = "+DoubleToString(div3,2));
   //D
   double div4=portion1/portion2;
   Print("D : 1/2 = "+DoubleToString(div4,2));
   //E
   double dp1=1;
   double dp2=2;
   double div5=dp1/dp2;
   Print("E : 1/2 = "+DoubleToString(div5,2));
   //F
   double div6=(double)portion1/(double)portion2;
   Print("F : 1/2 = "+DoubleToString(div6,2));
   //G
   double div7=(double)(1/2);
   Print("G : 1/2 = "+DoubleToString(div7,2));
   //H
   double div8=dp1/2;
   Print("H : 1/2 = "+DoubleToString(div8,2));
 
I'm really confused right now.
 
Lorentzos Roussos:

Yep . Try it on any version of any platform

 
 
Nelson Wanyama:
I'm really confused right now.

It thinks the "1" is an int 

The rule is to have a double type on the ... how do you call the thing that is divided , the divident

 
This topic is ridiculous, sorry guys.
 
Nelson Wanyama:
I'm really confused right now.
maybe try functional notation...
 
Alain Verleyen:
This topic is ridiculous, sorry guys.

Yeah. I'm really sorry😂

 
Alain Verleyen:
This topic is ridiculous, sorry guys.

It's a little ironic that this ties in with our discussion of coming from other languages: there are many in which 1 / 2 = 0.5, not 0. While I'm obviously very used to it, I've always regarded it as a counter-intuitive and pointless trap that 1 is treated as (int)1 regardless of cast/context. It's basically a legacy of times when computing power was too limited to put much intelligence into compilers, rather than a useful feature of a language.

The steps by which you then mis-identify something as an external change rather than a persistent bug in your code are, well... if you've never done it, you're the only programmer on earth who hasn't. 

Reason: