MQL5Book/Scripts/p4/MathPowSqrt.mq5
super.admin 1c8e83ce31 convert
2025-05-30 16:09:41 +02:00

20 lines
953 B
MQL5

//+------------------------------------------------------------------+
//| MathPowSqrt.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#define PRT(A) Print(#A, "=", (A))
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
PRT(MathPow(2.0, 1.5)); // 2.82842712474619
PRT(MathPow(2.0, -1.5)); // 0.3535533905932738
PRT(MathPow(2.0, 0.5)); // 1.414213562373095
PRT(MathSqrt(2.0)); // 1.414213562373095
PRT(MathSqrt(-2.0)); // -nan(ind)
}
//+------------------------------------------------------------------+