Back to index

glibc  2.9
Defines | Typedefs | Functions | Variables
test-powerpc-snan.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <fenv.h>
#include <signal.h>
#include <setjmp.h>
#include <errno.h>
#include "../test-skeleton.c"

Go to the source code of this file.

Defines

#define _GNU_SOURCE
#define __USE_GNU
#define TEST_FUNC(NAME, FLOAT)
#define TEST_FUNCTION   do_test ()

Typedefs

typedef long double ldouble

Functions

void init_signaling_nan ()
static float snan_float (void)
static double snan_double (void)
static ldouble snan_ldouble (void)
void myFPsighandler (int signal, siginfo_t *info, void *context)
int set_sigaction_FP (void)
int remove_sigaction_FP (void)
static void check (const char *testname, int result)
static int do_test (void)

Variables

int dest_offset
char * dest_address
double value = 123.456
double zero = 0.0
float SNANf
double SNAN
long double SNANl
static sigjmp_buf sigfpe_buf
static int errors = 0

Define Documentation

#define __USE_GNU

Definition at line 22 of file test-powerpc-snan.c.

#define _GNU_SOURCE

Definition at line 21 of file test-powerpc-snan.c.

#define TEST_FUNC (   NAME,
  FLOAT 
)

Definition at line 135 of file test-powerpc-snan.c.

#define TEST_FUNCTION   do_test ()

Definition at line 382 of file test-powerpc-snan.c.


Typedef Documentation

typedef long double ldouble

Definition at line 81 of file test-powerpc-snan.c.


Function Documentation

static void check ( const char *  testname,
int  result 
) [static]

Definition at line 127 of file test-powerpc-snan.c.

{
  if (!result) {
    printf ("Failure: %s\n", testname);
    errors++;
  }
}

Here is the call graph for this function:

static int do_test ( void  ) [static]

Definition at line 369 of file test-powerpc-snan.c.

{
  init_signaling_nan();

  float_test();
  double_test();
#ifndef NO_LONG_DOUBLE
  ldouble_test();
#endif

  return errors != 0;

Here is the call graph for this function:

Definition at line 46 of file test-powerpc-snan.c.

{
    union {
       double _ld16;
       double _d8;
       unsigned int _ui4[4];
       float _f4;
    } nan_temp;
    
    nan_temp._ui4[0] = 0x7fa00000;
    SNANf = nan_temp._f4;

    nan_temp._ui4[0] = 0x7ff40000;
    nan_temp._ui4[1] = 0x00000000;
    SNAN = nan_temp._d8;

    nan_temp._ui4[0] = 0x7ff40000;
    nan_temp._ui4[1] = 0x00000000;
    nan_temp._ui4[2] = 0x00000000;
    nan_temp._ui4[3] = 0x00000000;
    SNANl = nan_temp._ld16;
}

Here is the caller graph for this function:

void myFPsighandler ( int  signal,
siginfo_t *  info,
void *  context 
)

Definition at line 91 of file test-powerpc-snan.c.

{
  siglongjmp(sigfpe_buf, 0);
}

Here is the caller graph for this function:

Definition at line 112 of file test-powerpc-snan.c.

{
    struct sigaction sa;
    /* restore default RT signal handler via sigaction */
    sa.sa_flags = SA_SIGINFO;
    sa.sa_handler = SIG_DFL;
    sigemptyset(&sa.sa_mask);
    sigaction(SIGFPE, &sa, NULL);

    return 0;
}

Here is the call graph for this function:

int set_sigaction_FP ( void  )

Definition at line 99 of file test-powerpc-snan.c.

{
    struct sigaction sa;
    /* register RT signal handler via sigaction */
    sa.sa_flags = SA_SIGINFO;
    sa.sa_sigaction = &myFPsighandler;
    sigemptyset(&sa.sa_mask);
    sigaction(SIGFPE, &sa, NULL);

    return 0;
}

Here is the call graph for this function:

static double snan_double ( void  ) [static]

Definition at line 76 of file test-powerpc-snan.c.

{
  return SNAN;
}
static float snan_float ( void  ) [static]

Definition at line 70 of file test-powerpc-snan.c.

{
  return SNANf;
}
static ldouble snan_ldouble ( void  ) [static]

Definition at line 84 of file test-powerpc-snan.c.

{
  return SNANl;
}

Variable Documentation

char* dest_address

Definition at line 35 of file test-powerpc-snan.c.

Definition at line 34 of file test-powerpc-snan.c.

int errors = 0 [static]

Definition at line 124 of file test-powerpc-snan.c.

sigjmp_buf sigfpe_buf [static]

Definition at line 43 of file test-powerpc-snan.c.

double SNAN

Definition at line 40 of file test-powerpc-snan.c.

float SNANf

Definition at line 39 of file test-powerpc-snan.c.

long double SNANl

Definition at line 41 of file test-powerpc-snan.c.

double value = 123.456

Definition at line 36 of file test-powerpc-snan.c.

double zero = 0.0

Definition at line 37 of file test-powerpc-snan.c.