c语言math库函数绝对值,求绝对值 怎么用标准库函数 我只会自己判断

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

ISO C11(N1570)

f,F A double argument representing a floating-point number is converted to decimal notation in the style [−]ddd.ddd, where the number of digits after the decimal-point character is equal to the precision specification. If the precision is missing, it is taken as 6; if the precision is zero and the # flag is not specified, no decimal-point character appears. If a decimal-point character appears, at least one digit appears before it. The value is rounded to the appropriate number of digits.

A double argument representing an infinity is converted in one of the styles

[-]inf or [-]infinity — which style is implementation-defined. A double argument representing a NaN is converted in one of the styles [-]nan or [-]nan(n-char-sequence) — which style, and the meaning of any n-char-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, respectively.277)

277) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning; the # and 0 flag characters have no effect.

e,E A double argument representing a floating-point number is converted in the

style [−]d.ddd e±dd, where there is one digit (which is nonzero if the argument is nonzero) before the decimal-point character and the number of digits after it is equal to the precision; if the precision is missing, it is taken as 6; if the precision is zero and the # flag is not specified, no decimal-point character appears. The value is rounded to the appropriate number of digits. The E conversion specifier produces a number with E instead of e introducing the exponent. The exponent always contains at least two digits, and only as many more digits as necessary to represent the exponent. If the value is zero, the exponent is zero.

A double argument representing an infinity or NaN is converted in the style of an f or F conversion specifier.

g,G A double argument representing a floating-point number is converted in

style f or e (or in style F or E in the case of a G conversion specifier),

depending on the value converted and the precision. Let P equal the

precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.

Then, if a conversion with style E would have an exponent of X:

— if P > X ≥ −4, the conversion is with style f (or F) and precision

P − (X + 1).

— otherwise, the conversion is with style e (or E) and precision P − 1.

Finally, unless the # flag is used, any trailing zeros are removed from the

fractional portion of the result and the decimal-point character is removed if

there is no fractional portion remaining.

A double argument representing an infinity or NaN is converted in the style

of an f or F conversion specifier.

printf的%lf在通常扩展中同%f。

%g视条件取%f或%e。详细格式和条件如上。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值