东莞市鲁鑫塑胶有限公司

主营产品:塑胶原料
产品分类Product Categories
联系我们Contact Us
当前位置: 网站首页>公司新闻

塑胶行情

发布日期:2013-08-22 来自:全球塑胶网

1.绝对值函数

编辑本义项ABS

目录

功 能: 求整型变量的绝对值ORACLE绝对值函数PascalLogo语言VC++语言VB Abs 函数lisp语言展开功 能: 求整型变量的绝对值ORACLE绝对值函数PascalLogo语言VC++语言VB Abs 函数lisp语言展开

C语言

函数名: abs

编辑本段功 能: 求整型变量的绝对值

头文件:stdlib math|[1]用 法: int abs(int i);程序例:#include <cstdlib.h>#include <stdio.h>#include<math.h>int main(void){int number = -1234;printf("number: %d absolute value: %d\n", number, abs(number));return 0;}在C语言中还有fabs,也是求绝对值的。(Java语言中有类似的作用。)

编辑本段ORACLE绝对值函数

格式:Abs(<数值表达式>)功能:求表达式绝对值说明:函数返回值类型与数值表达式的数据类型相同例如:Abs(-3.7),其值为3.7。与C语言中的abs有区别。

编辑本段Pascal

Function Abs( X : Real ) : Longint;功 能: 求数的绝对值例:Begin{ 语句; { ( X数据类型 ) 输出结果 } }Writeln( Abs(-111222333) ); {(Longint) 111222333 }Writeln( Abs(-1112223334324445556) ); {(Int64) 1112223334324445556 }End.Matlab求复数实部与虚部的平方和的算术平方根格式:abs(x)例如:x=1+j;y=abs(x);>>y=1.4142

编辑本段Logo语言

格式

ABS 数字

解释

ABS:求输入数字的绝对值。

例子

?ABS -30结果:30ABS 30结果:30ABS -3 + -4结果:7

编辑本段VC++语言

abs()仅对整型求绝对值对浮点数求绝对值使用fabs()函数。Example/* ABS.C: This program computes and displays* the absolute values of several numbers.*/#include <stdio.h>#include <math.h>#include <stdlib.h>void main( void ){int ix = -4, iy;long lx = -41567L, ly;double dx = -3.141593, dy;iy = abs( ix );printf( "The absolute value of %d is %d\n", ix, iy);ly = labs( lx );printf( "The absolute value of %ld is %ld\n", lx, ly);dy = fabs( dx );printf( "The absolute value of %f is %f\n", dx, dy );}OutputThe absolute value of -4 is 4The absolute value of -41567 is 41567The absolute value of -3.141593 is 3.141593