定義
絕對值函式的定義是:


其他記號
在計算機語言或
計算器中,絕對值函式常記作abs(x) 。
(4)與
符號函式的關係:∣x∣=
sgn(x)·x 或 x=sgn(x)·∣x∣。
幾何意義
∣x∣表示x軸上的點 x 到原點的距離。
∣x―a∣表示x軸上的點 x 到點a的距離。
計算機
計算機中的一個常用函式類型,它包含在<stdlib.h>頭檔案里。
常見用法如下
(1)int 型
int abs(int x);
(2)long 型
long labs(int x);
(3)double型
double fabs(double x);