comparison 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
comparison
equal deleted inserted replaced
10:27e00625790b 11:07194b026fa4
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Jul 21, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.coreservices.carboncore.fp;
8
9 version (Tango)
10 import tango.stdc.math;
11
12 else
13 import std.c.math;
14
15
16 //import dstep.AvailabilityMacros;
17 import dstep.coreservices.carboncore.ConditionalMacros;
18 import dstep.coreservices.carboncore.MacTypes;
19 import dstep.internal.Version;
20
21
22 alias short relop;
23
24 const SIGDIGLEN = 36;
25
26 extern (C)
27 {
28 extern
29 {
30 const double pi;
31 }
32 }
33
34 enum
35 {
36 GREATERTHAN = 0,
37 LESSTHAN = 1,
38 EQUALTO = 2,
39 UNORDERED = 3
40 }
41
42 struct decimal
43 {
44 byte sgn;
45 byte unused;
46 short exp;
47
48 struct
49 {
50 ubyte length;
51 ubyte[SIGDIGLEN] text;
52 ubyte unused_;
53 }
54 }
55
56 struct decform
57 {
58 byte style;
59 short unused;
60 short digits;
61 }
62
63 extern (C)
64 {
65 double compound (double rate, double periods);
66 double annuity (double rate, double periods);
67 double randomx (double* x);
68 short relation (double x, double y);
69 void num2dec (decform* f, double x, decimal* d);
70 double dec2num (decimal* d);
71 void dec2str (decform* f, decimal* d, char* s);
72 void str2dec (char* s, short* ix, decimal* d, short* vp);
73 float dec2f (decimal* d);
74 short dec2s (decimal* d);
75 int dec2l (decimal* d);
76 double x80tod (extended80* x80);
77 void dtox80 (double* x, extended80* x80);
78 void x80told (extended80* x80, double* x);
79 void ldtox80 (double* x, extended80* x80);
80 }