Sqr函數

用於傳回平方根。

格式
Sqr (數值)

參數

數值
以實數值或運算式指定。

傳回值
用於傳回平方根。

說明
用於傳回平方根。

常見錯誤

  • 負數運算子

    數值為負數時會發生錯誤。

參照
Abs函數, And運算子, Atan函數, Atan2函數, Cos函數, Int函數, Mod運算子, Not運算子, Or運算子, Sgn函數, Sin函數, Str$函數, Tan函數, Val函數, Xor運算子

Sqr函數範例
以下是在命令視窗中使用Sqr函數的範例。

>print sqr(2)
 1.414214
>

以下是使用Sqr的簡易程式範例。

Function sqrtest
    Real x
    Print "Please enter a numeric value:"
    Input x
    Print "The Square Root of ", x, " is ", Sqr(x)
Fend