'Float' problem

 

I have the line :

float  f_val=0.3;

I recive the message "truncation of constant value" when i compile the code.The value of f_val is : '0.300000011920929'.Why f_val is truncate?


MT5 Build 250 , MQL5 Build 249

 
dudufx posted  :

I have the line :

I recive the message "truncation of constant value" when i compile the code.The value of f_val is : '0.300000011920929'.Why f_val is truncate?


MT5 Build 250 , MQL5 Build 249



 

use suffix "f" for float point constants with single precision

float f_val=0.3f;