shithub: femtolisp

ref: 518cfe8d0c1a6eb4f90cdb68861fe0cd3a2e0d74
dir: /nan.c/

View raw version
#include "platform.h"
#include "nan.h"
#include "ieee754.h"

double D_PNAN, D_NNAN, D_PINF, D_NINF;

void
nan_init(void)
{
	D_PNAN = D_NNAN = strtod("+NaN", nil);
	D_PINF = D_NINF = strtod("+Inf", nil);

	union ieee754_double *d;
	d = (union ieee754_double *)&D_NNAN;
	d->ieee.negative = 1;
	d = (union ieee754_double *)&D_NINF;
	d->ieee.negative = 1;
}