|
Dieser Artikel wurde maschinell übersetzt. Bewegen Sie den Mauszeiger über die Sätze im Artikel, um den Originaltext anzuzeigen. Weitere Informationen
|
Übersetzung
Original
|
_control87, _controlfp, __control87_2
unsigned int _control87( unsigned int new, unsigned int mask ); unsigned int _controlfp( unsigned int new, unsigned int mask ); int __control87_2( unsigned int new, unsigned int mask, unsigned int* x86_cw, unsigned int* sse2_cw );
Hinweis
|
|---|
|
|
_control87( _EM_INVALID, _MCW_EM ); // DENORMAL is unmasked by this call _controlfp( _EM_INVALID, _MCW_EM ); // DENORMAL exception mask remains unchanged
_controlfp(_DN_SAVE, _MCW_DN); // Denormal values preserved by software on ALPHA. NOP on x86. _controlfp(_DN_FLUSH, _MCW_DN); // Denormal values flushed to zero by hardware on ALPHA and x86 // processors with SSE2 support. Ignored on other x86 platforms.
Hinweis |
|---|
Hexadezimalwerte
_DN_SAVE _DN_FLUSH | |||
_EM_INVALID _EM_DENORMAL _EM_ZERODIVIDE _EM_OVERFLOW _EM_UNDERFLOW _EM_INEXACT | |||
_IC_AFFINE _IC_PROJECTIVE | |||
_RC_CHOP _RC_UP _RC_DOWN _RC_NEAR | |||
|
|
|
|---|---|
|
|
|
// crt_cntrl87.c
// processor: x86
// This program uses __control87_2 to output the x87 control
// word, set the precision to 24 bits, and reset the status to
// the default.
//
#include <stdio.h>
#include <float.h>
#pragma fenv_access (on)
int main( void )
{
double a = 0.1;
unsigned int control_word_x87;
// Show original x87 control word and do calculation.
control_word_x87 = __control87_2(0, 0,
&control_word_x87, 0);
printf( "Original: 0x%.4x\n", control_word_x87 );
printf( "%1.1f * %1.1f = %.15e\n", a, a, a * a );
// Set precision to 24 bits and recalculate.
control_word_x87 = __control87_2(_PC_24, MCW_PC,
&control_word_x87, 0);
printf( "24-bit: 0x%.4x\n", control_word_x87 );
printf( "%1.1f * %1.1f = %.15e\n", a, a, a * a );
// Restore default precision-control bits and recalculate.
control_word_x87 = __control87_2( _CW_DEFAULT, MCW_PC,
&control_word_x87, 0 );
printf( "Default: 0x%.4x\n", control_word_x87 );
printf( "%1.1f * %1.1f = %.15e\n", a, a, a * a );
}
Nicht zutreffend. Um die Standard-C-Funktion aufrufen, verwenden Sie PInvoke. Weitere Informationen finden Sie unter Plattformaufruf-Beispiele.
Hinweis