_clear87, _clearfp

From RAD Studio
Jump to: navigation, search

Go Up to float.h Index


Header File

float.h

Prototype

unsigned int _clear87 (void);
unsigned int _clearfp (void);

Description

Clears the floating-point status word.

_clear87 clears the floating-point status word, which is a combination of the 80x87 status word and other conditions detected by the 80x87 exception handler.

_clearfp is identical to _clear87 and is for Microsoft compatibility.

Return Value

The bits in the value returned indicate the floating-point status before it was cleared. For information on the status word, refer to the constants defined in float.h.

Portability

POSIX ANSI C ANSI C++ Win32 Win64 macOS
_clear87 +
_clearfp +

Example

#include <stdio.h>
#include <float.h>

int main(void) {
	float x;
	double y = 1.5e-100;
	printf("\nStatus 87 before error: %X\n", _status87());
	x = y; /* create underflow and precision loss */
	printf("Status 87 after  error: %X\n", _status87());
	_clear87();
	printf("Status 87 after  clear: %X\n", _status87());
	y = x;
	return 0;
}