Hello to everybody...
I would like get the integer part of a double number, so I guessed to use the library function MathTrunc() (https://www.mql5.com/en/docs/standardlibrary/mathematics/stat/mathsubfunctions/statmathtrunc)
but such function is not recognized by the compiler.
How could I use it ?
Use the function MathRound()
It's not the same identical thing...
I would like get the integer part of a double number, whitout the rounding...
For example MathRound(4.9) gets 5; instead my goal is to get 4 !!!
And, in addition, I saw that MathTrunc() is well documented in the site; so I wondered the compiler does not compile it.
a) You have to include Math.mqh in your program, here are the docs
MQL5 Reference / Language Basics / Preprocessor / Including Files (#include)
b) If you only wanted to use MathTrunc() MathFloor() is like truncation
I suspect that the MathTrunc () function is not present in MQL4. In the code editor functions directory, I did not find such a function. But in the directory on the site it is.
If you want to use a library function you should probably include the library.
Otherwise MathFloor/floor (MathCeil/ceil for negative numbers) will give you the same result. Or just casting into integer.
I would like get the integer part of a double number