shithub: femtolisp

ref: 3f9ca6ff8e3a23a7912e4ccc879025bd6feb2b95
dir: /llt/lltinit.c/

View raw version
#include "llt.h"

double D_PNAN;
double D_NNAN;
double D_PINF;
double D_NINF;
float  F_PNAN;
float  F_NNAN;
float  F_PINF;
float  F_NINF;

void llt_init(void)
{
    randomize();

    ios_init_stdstreams();

    D_PNAN = strtod("+NaN",NULL);
    D_NNAN = strtod("-NaN",NULL);
    D_PINF = strtod("+Inf",NULL);
    D_NINF = strtod("-Inf",NULL);
#if defined(__plan9__)
    u32int x;
    x = 0x7fc00000; memcpy(&F_PNAN, &x, 4);
    x = 0xffc00000; memcpy(&F_NNAN, &x, 4);
    x = 0x7f800000; memcpy(&F_PINF, &x, 4);
    x = 0xff800000; memcpy(&F_NINF, &x, 4);
#else
    F_PNAN = strtof("+NaN",NULL);
    F_NNAN = -strtof("+NaN",NULL);
    F_PINF = strtof("+Inf",NULL);
    F_NINF = strtof("-Inf",NULL);
#endif
}