shithub: femtolisp

ref: d9d5b07e060c0c53f17a1428566049f6b1123f3c
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
}