shithub: femtolisp

ref: d66b628e7ce513210cf583e5a3d91e328267ba01
dir: /llt/lltinit.c/

View raw version
#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();

    D_PNAN = strtod("+NaN",NULL);
    D_NNAN = -strtod("+NaN",NULL);
    D_PINF = strtod("+Inf",NULL);
    D_NINF = strtod("-Inf",NULL);
#ifdef __plan9__
    F_PNAN = D_PNAN;
    F_NNAN = D_NNAN;
    F_PINF = D_PINF;
    F_NINF = D_NINF;
#else
    F_PNAN = strtof("+NaN",NULL);
    F_NNAN = -strtof("+NaN",NULL);
    F_PINF = strtof("+Inf",NULL);
    F_NINF = strtof("-Inf",NULL);
#endif
}