MQL4 Bug with Comparison

 

Hello, I am completely new to this forum. I am looking for a place to report the following bug in MQL4:


Consider the following simpliflied code:
//***************************************************************************
#property copyright "Copyright 2012, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
double value = 0;
double a = 0;
double b = 0;
double comparison_value = 0;

int start()
{
value = 1.32356000;
a = 1.32357000;
b = 0.00001000;

comparison_value = a - b;

if(value==comparison_value){
Alert("true");
}else{
Alert("false");
}
return (0);
}
//*******************************************************************************

This code will output "false" in the Alert window even though logically it should return true.

setting comparison_value directly to 1.32356000 like this:

comparison_value = 1.32356000;

Will cause the correct response of outputting "true" in the Alert window.

The problem is worked around by putting in this line before the comparison occurs:

comparison_value = StrToDouble(DoubleToStr((next_bar_open + jump_value),8));

The developers of MQL4 should look into this.

The problem occurs not for all numbers but only some combinations of values for "value", "a" and "b".

 
Anomaly_5:

Hello, I am completely new to this forum. I am looking for a place to report the following bug in MQL4:


Consider the following simpliflied code:

<CODE REMOVED>

This code will output "false" in the Alert window even though logically it should return true.

Please read some other posts before posting . . .

Please edit your post . . . please use the SRC button to post code: How to use the SRC button.


Then, when you have edited your post . . . read this thread from start to end: Can price != price ?