ref: 6d724e4899ea1e4e7164e98dfead7e3815372297
dir: /llt/lltinit.c/
#ifdef __plan9__ #include <u.h> #include <libc.h> #else #include <stdlib.h> #include <stdio.h> #include <stdarg.h> #include <math.h> #include <locale.h> #endif #include "dtypes.h" #include "timefuncs.h" #include "ios.h" #include "random.h" #include "utf8.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(); #ifdef __plan9__ D_PNAN = NaN(); D_NNAN = NaN(); *(u64int*)&D_NNAN |= 1<<31; D_PINF = Inf(1); D_NINF = Inf(-1); 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 D_PNAN = strtod("+NaN",NULL); D_NNAN = -strtod("+NaN",NULL); D_PINF = strtod("+Inf",NULL); D_NINF = strtod("-Inf",NULL); F_PNAN = strtof("+NaN",NULL); F_NNAN = -strtof("+NaN",NULL); F_PINF = strtof("+Inf",NULL); F_NINF = strtof("-Inf",NULL); #endif }