shithub: femtolisp

ref: 19887e156a7fe98c224793b4f95f42035e604645
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",nil);
    D_NNAN = strtod("-NaN",nil);
    D_PINF = strtod("+Inf",nil);
    D_NINF = strtod("-Inf",nil);
#if defined(__plan9__)
    u32int x;
    x = 0x7fc00000; memmove(&F_PNAN, &x, 4);
    x = 0xffc00000; memmove(&F_NNAN, &x, 4);
    x = 0x7f800000; memmove(&F_PINF, &x, 4);
    x = 0xff800000; memmove(&F_NINF, &x, 4);
#else
    F_PNAN = strtof("+NaN",nil);
    F_NNAN = -strtof("+NaN",nil);
    F_PINF = strtof("+Inf",nil);
    F_NINF = strtof("-Inf",nil);
#endif
}