| 総合手引 | セクション 3 | English | オプション |
#include <ieeefp.h>
typedef enum {
FP_RN, /* round to nearest */
FP_RM, /* round down to minus infinity */
FP_RP, /* round up to plus infinity */
FP_RZ /* truncate */
} fp_rnd_t;
fp_rnd_t
fpgetround(void);
fp_rnd_t
fpsetround(fp_rnd_t direction);
typedef enum {
FP_PS, /* 24 bit (single-precision) */
FP_PRS, /* reserved */
FP_PD, /* 53 bit (double-precision) */
FP_PE /* 64 bit (extended-precision) */
} fp_prec_t;
#define fp_except_t int #define FP_X_INV 0x01 /* invalid operation */ #define FP_X_DNML 0x02 /* denormal */ #define FP_X_DZ 0x04 /* zero divide */ #define FP_X_OFL 0x08 /* overflow */ #define FP_X_UFL 0x10 /* underflow */ #define FP_X_IMP 0x20 /* (im)precision */ #define FP_X_STK 0x40 /* stack fault */
fpgetround() 関数は、現在の浮動小数点丸めモードを戻します。
fpsetround() 関数は、浮動小数点丸めモードを設定し、前のモードを 戻します。
fpgetprec() 関数は、現在の浮動小数点精度を戻します。
fpsetprec() 関数は、浮動小数点精度を設定し、前の精度を戻します。
fpgetmask() 関数は、現在の浮動小数点例外マスクを戻します。
fpsetmask() 関数は、浮動小数点例外マスクを設定し、前のマスクを戻します。
fpgetsticky() 関数は、現在の浮動小数点スティッキフラグを戻します。
fpresetsticky() 関数は、浮動小数点スティッキフラグをクリアし、前のフラグ を戻します。
以下は、0 除算によるトラップを防ぐコード例です。
fpsetmask(~FP_X_DZ); a = 1.0; b = 0; c = a / b; fpresetsticky(FP_X_DZ); fpsetmask(FP_X_DZ);
| FPGETROUND (3) | August 23, 1993 |
| 総合手引 | セクション 3 | English | オプション |
このマニュアルページサービスについてのご意見は Ben Bullock にお知らせください。 Privacy policy.
| “ | A typical Unix /bin or /usr/bin directory contains a hundred different kinds of programs, written by dozens of egotistical programmers, each with its own syntax, operating paradigm, rules of use ... strategies for specifying options, and different sets of constraints. | ” |
| — The Unix Haters' handbook | ||