view dstep/coreservices/carboncore/fp.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 21, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.carboncore.fp;

version (Tango)
	import tango.stdc.math;

else
	import std.c.math;


//import dstep.AvailabilityMacros;
import dstep.coreservices.carboncore.ConditionalMacros;
import dstep.coreservices.carboncore.MacTypes;
import dstep.internal.Version;


alias short relop;

const SIGDIGLEN = 36;

extern (C)
{
	extern
	{
		const double pi;
	}
}

enum
{
	GREATERTHAN = 0,
	LESSTHAN = 1,
	EQUALTO = 2,
	UNORDERED = 3
}

struct decimal
{
	byte sgn;
	byte unused;
	short exp;
	
	struct
	{
		ubyte length;
		ubyte[SIGDIGLEN] text;
		ubyte unused_;
	}
}

struct decform
{
	byte style;
	short unused;
	short digits;
}

extern (C)
{
	double compound (double rate, double periods);
	double annuity (double rate, double periods);
	double randomx (double* x);
	short relation (double x, double y);
	void num2dec (decform* f, double x, decimal* d);
	double dec2num (decimal* d);
	void dec2str (decform* f, decimal* d, char* s);
	void str2dec (char* s, short* ix, decimal* d, short* vp);
	float dec2f (decimal* d);
	short dec2s (decimal* d);
	int dec2l (decimal* d);
	double x80tod (extended80* x80);
	void dtox80 (double* x, extended80* x80);
	void x80told (extended80* x80, double* x);
	void ldtox80 (double* x, extended80* x80);
}