Oracle Solaris Studio 12.4 Man Pages

Exit Print View

Updated: January 2015
 
 

isinff(3M)

Name

ieee_sun , fp_class , fp_classf , fp_classl , isinf , isinff , isinfl , isnormal , isnormalf , isnormall , issubnormal , issubnormalf , issubnormall , iszero , iszerof , iszerol , signbit , signbitf , signbitl , nonstandard_arithmetic , standard_arithmetic , ieee_retrospective - 其他浮点函数

Synopsis

cc [ flag ... ] file ...  -lsunmath -lm [ library ... ]
#include <sunmath.h>

enum fp_class_type fp_class(double x);
enum fp_class_type fp_classf(float x);
enum fp_class_type fp_classl(long double x);
int isinf(double x);
int isinff(float x);
int isinfl(long double x);
int isnormal(double x);
int isnormalf(float x);
int isnormall(long double x);
int issubnormal(double x);
int issubnormalf(float x);
int issubnormall(long double x);
int iszero(double x);
int iszerof(float x);
int iszerol(long double x);
int signbit(double x);
int signbitf(float x);
int signbitl(long double x);
void nonstandard_arithmetic(void);
void standard_arithmetic(void);
#include <stdio.h>
void ieee_retrospective(FILE *f);

Description

其中的有些函数提供 ANSI/IEEE Std 754-1985 的附录中所建议的功能。

fp_class(x) 返回将 x 标识为零、次正规、正规、无穷大或者静默或信令 NaN 的值。类型 enum fp_class_type<floatingpoint.h> 中定义。

以下函数在指示的条件为真时返回 1,否则返回 0:

isinf(x)

x 是无穷大

isnormal(x)

x 是正规

issubnormal(x)

x 是次正规

iszero(x)

x 是零

signbit(x)

x 的符号位已设置

nonstandard_arithmetic()standard_arithmetic() 在提供更快的替代浮点运算模式但不符合缺省 IEEE 标准的系统上有意义。非标准模式在各种实施之间有差异;例如,非标准模式可能导致将次正规结果设置为零或/并将次正规操作数视为零,或导致其他情况。standard_arithmetic() 恢复为缺省标准模式。在仅提供一种模式的系统上,这些函数无效。

ieee_retrospective(f) 将一条消息输出到 FILE *f 描述的文件,其中列出了所有在调用时有效的非缺省浮点模式和状态,其中包括已发生异常标志、舍入方向和精度模式、启用陷阱的模式以及非标准运算模式。ieee_retrospective() 一般用在程序的末尾以指示可能影响了结果的异常浮点条件。

程序可以随时显式调用 ieee_retrospective()。在 -f77 兼容模式下使用 f95 编译的 Fortran 程序会在其退出前自动调用 ieee_retrospective()。在缺省模式下使用 f95 编译的 C/C++ 程序和 Fortran 程序不会自动调用 ieee_retrospective()。缺省情况下,f95 编译器会对常见异常启用捕获,因此,除非有程序显式禁用捕获或者安装 SIGFPE 处理程序,否则在发生此类异常时程序会立即中止。在 -f77 兼容模式下,编译器不启用捕获,因此在发生浮点异常时,程序会继续执行并通过 ieee_retrospective() 输出向用户提醒这些异常。

Attributes

有关下列属性的说明,请参见 attributes(5):

属性类型
属性值
接口稳定性
Committed(已确定)
MT 级别
MT-Safe(MT 安全)

See also

copysign(3M)、fpclassify(3M)、fex_set_log(3M)、ilogb(3M)、isfinite(3M)、isinf(3M)、isnan(3M)、isnormal(3M)、nextafter(3M)、remainder(3M)、scalbn(3M)、signbit(3M)、attributes(5)、floatingpoint.h(3HEAD)

Notes

根据 C99 的要求,<math.h> 头文件定义名为 isinf()isnormal()signbit() 的宏。这些宏与 isinf()isnormal()signbit() 函数兼容,但在满足对应的条件时,它们可能会返回任何非零值(不一定是 1)。缺省情况下,在包括 <math.h> 的源文件中,引用 isinf()isnormal()signbit() 会导致替代这些宏。要调用实际的 isinf()isnormal()signbit() 函数,源文件不得包括 <math.h>,或者显式取消定义对应的宏。与仅接受 double 类型参数的 isinf()isnormal()signbit() 函数不同,但是宏是通用类型的,即它们的参数可以是类型为 floatdoublelong double 的任何表达式。因此,取消定义宏可能会改变通过非 double 类型的参数使用这些宏的程序的行为。此外,还必须更改这样的程序以使用对应类型(例如 isinff()isinfl() 等)的函数。有关更多信息,请参见 isinf(3M)、isnormal(3M) 和 signbit(3M)。