Developer Guide and Reference

ID 767253
Date 10/31/2024
Public
Document Table of Contents

Non-Computational Operations Functions

Many routines in the libbfp754 Library are more optimized for Intel® microprocessors than for non-Intel microprocessors.

The Intel® IEEE 754-2008 Binary Conformance Library supports the following functions for non-computational operations:

is754version1985

Description: The function returns 1, if and only if this programming environment conforms to IEEE Std. 754-1985, otherwise returns 0.

Calling interface:
int __binary_is754version1985(void);

NOTE:

This function in this library always returns 0.

is754version2008

Description: The function returns 1, if and only if this programming environment conforms to IEEE Std. 754-2008, otherwise returns 0.

Calling interface:
int __binary_is754version2008(void);

NOTE:

This function in this library always returns 1.

class

Description: The function returns which class of the ten classes (signalingNaN, quietNaN, negativeInfinity, negativeNormal, negativeSubnormal, negativeZero, positiveZero, positiveSubnormal, positiveNormal, positiveInfinity) the input floating-point number x belongs.

Return value

Class

0

signalingNaN

1

quietNaN

2

negativeInfinity

3

negativeNormal

4

negativeSubnormal

5

negativeZero

6

positiveZero

7

positiveSubnormal

8

positiveNormal

9

positiveInfinity

Calling interface:
int __binary32_class(float x);
int __binary64_class(double x);

isSignMinus

Description: The function returns 1, if and only if its argument has negative sign.

Calling interface:
int __binary32_isSignMinus(float x);
int __binary64_isSignMinus(double x);

isNormal

Description: The function returns 1, if and only if its argument is normal (not zero, subnormal, infinite, or NaN).

Calling interface:
int __binary32_isNormal(float x);
int __binary64_isNormal(double x);

isFinite

Description: The function returns 1, if and only if its argument is finite (not infinite or NaN).

Calling interface:

isZero

Description: The function returns 1, if and only if its argument is ±0.

Calling interface:
int __binary32_isZero(float x);
int __binary64_isZero(double x);

isSubnormal

Description: The function returns 1, if and only if its argument is subnormal.

Calling interface:
int __binary32_isSubnormal(float x);
int __binary64_isSubnormal(double x);

isInfinite

Description: The function returns 1, if and only if its argument is infinite

Calling interface:
int __binary32_isInfinite(float x);
int __binary64_isInfinite(double x);

isNaN

Description:The function returns 1, if and only if its argument is a NaN.

Calling interface:
int __binary32_isNaN(float x);
int __binary64_isNaN(double x);

isSignaling

Description: The function returns 1, if and only if its argument is a signaling NaN.

Calling interface:
int __binary32_isSignaling(float x);
int __binary64_isSignaling(double x);

isCanonical

Description: The function returns 1, if and only if its argument is a finite number, infinity, or NaN that is canonical.

Calling interface:
int __binary32_isCanonical(float x);
int __binary64_isCanonical(double x);

NOTE:

This function in this library always returns 1, as only canonical floating-point numbers are expected.

radix

Description:The function returns the radix of the format of the input floating-point number.

Calling interface:
int __binary32_radix(float x);
int __binary64_radix(double x);

NOTE:

This function in this library always returns 2, as the library is intended for binary floating-point numbers.

totalOrder

Description: The function returns 1 if and only if two floating-point inputs x and y is total ordered and 0 otherwise.

Calling interface:
int _binary32_totalOrder(float x, float y);
int _binary64_totalOrder(double x, double y);

totalOrderMag

Description:totalOrderMag(x, y) is the same as totalOrder(abs(x), abs(y)).

Calling interface:
int _binary32_totalOrderMag(float x, float y);
int _binary64_totalOrderMag(double x, double y);

lowerFlags

Description: The function lowers the flags of the exception group specified by the input.

Value

Exception name

1

__BFP754_INVALID

2

__BFP754_DIVBYZERO

4

__BFP754_OVERFLOW

8

__BFP754_UNDERFLOW

16

__BFP754_INEXACT

Calling interface:
void __binary_lowerFlags(int x);

raiseFlags

Description: The function raises the flags of the exception group specified by the input.

Calling interface:
void __binary_raiseFlags(int x);

testFlags

Description: The function returns 1, if and only if any flag of the exception group specified by the input is raised, and 0 otherwise.

Calling interface:
int __binary_testFlags(int x);

testSavedFlags

Description: The function returns 1, if and only if any flag of the exception group specified by the input y is raised in x, and 0 otherwise.

Calling interface:
int __binary_testSavedFlags(int x, int y);

restoreFlags

Description: The function restores the flags to their states represented in x.

Calling interface:
void __binary_restoreFlags(int x);

saveFlags

Description: The function returns a representation of the state of all status flags.

Calling interface:
int __binary_saveFlags(void);

getBinaryRoundingDirection

Description: The function returns an integer representing the rounding direction in use.

Value

Exception name

0

__BFP754_ROUND_TO_NEAREST_EVEN

1

__BFP754_ROUND_TOWARD_POSITIVE

2

__BFP754_ROUND_TOWARD_NEGATIVE

3

__BFP754_ROUND_TOWARD_ZERO

Calling interface:
int __binary_getBinaryRoundingDirection(void);

setBinaryRoundingDirection

Description: The function sets the rounding direction based on input integer.

Calling interface:
void __binary_setBinaryRoundingDirection(int x);

saveModes

Description: The function saves the values of all dynamic-specifiable modes.

Calling interface:
int __binary_saveModes(void);

NOTE:

saveModes behaves in the same way as getBinaryRoundingDirection does, as the rounding mode is the only dynamic-specifiable mode supported.

restoreModes

Description:The function restores the values of all dynamic-specifiable modes to the input.

Calling interface:
int __binary_restoreModes(void);

NOTE:

restoreModes behaves in the same way as setBinaryRoundingDirection does, as the rounding mode is the only dynamic-specifiable mode supported.

defaultMode

Description: The function sets the values of all dynamic-specifiable modes to default.

Calling interface:
void __binary_defaultMode(void);

NOTE:

defaultMode sets the rounding-direction attribute to roundTiesToEven, as the rounding mode is the only dynamic-specifiable mode supported.