DecimalException

Base exeption for this module

class DecimalException : Exception {}

Members

Mixins

__anonymous
mixin RealizeException
Undocumented in source.

Mixed In Members

From mixin RealizeException

this
this(string msg, string file, size_t line)
Undocumented in source.

Examples

********************************* UNITTESTS ***********************************

1 auto x = Decimal("36");
2 assert(x.value == BigInt("36000000000000000000"));
3 assert(x.toFullString == "36.000000000000000000");
4 
5 x = Decimal("36.6");
6 assert(x.value == BigInt("36600000000000000000"));
7 assert(x.toFullString == "36.600000000000000000");
8 
9 x = Decimal("36,6");
10 assert(x.value == BigInt("36600000000000000000"));
11 assert(x.toFullString == "36.600000000000000000");
12 
13 x = Decimal("-36,6");
14 assert(x.value == BigInt("-36600000000000000000"));
15 assert(x.toFullString == "-36.600000000000000000");
16 
17 x = Decimal(36);
18 assert(x.value == BigInt("36000000000000000000"));
19 assert(x.toFullString == "36.000000000000000000");
20 
21 x = Decimal(-36);
22 assert(x.value == BigInt("-36000000000000000000"));
23 assert(x.toFullString == "-36.000000000000000000");
24 
25 x = Decimal(-36.6, 4);
26 assert(x.value == BigInt("-366000"));
27 assert(x.toFullString == "-36.6000");
28 
29 x = Decimal("0");
30 assert(x.value == BigInt("0"));
31 assert(x.toFullString == "0.000000000000000000");
32 
33 x = Decimal(0);
34 assert(x.value == BigInt("0"));
35 assert(x.toFullString == "0.000000000000000000");
36 
37 x = Decimal(0.0);
38 assert(x.value == BigInt("0"));
39 assert(x.toFullString == "0.000000000000000000");
40 
41 x = Decimal(-0.0);
42 assert(x.value == BigInt("0"));
43 assert(x.toFullString == "0.000000000000000000");
44 
45 x = Decimal("0.12");
46 assert(x.value == BigInt("120000000000000000"));
47 assert(x.toFullString == "0.120000000000000000");
48 
49 x = Decimal(0.12);
50 assert(x.value == BigInt("120000000000000000"));
51 assert(x.toFullString == "0.120000000000000000");
52 
53 x = Decimal("-0.12");
54 assert(x.value == BigInt("-120000000000000000"));
55 assert(x.toFullString == "-0.120000000000000000");
56 
57 x = Decimal(-0.12);
58 assert(x.value == BigInt("-120000000000000000"));
59 assert(x.toFullString == "-0.120000000000000000");
60 
61 x = Decimal("-0.02");
62 assert(x.value == BigInt("-20000000000000000"));
63 assert(x.toFullString == "-0.020000000000000000");
64 
65 x = Decimal(-0.02);
66 assert(x.value == BigInt("-20000000000000000"));
67 assert(x.toFullString == "-0.020000000000000000");
68 
69 x = Decimal("0.1");
70 assert(x.value == BigInt("100000000000000000"));
71 assert(x.toFullString == "0.100000000000000000");
72 
73 x = Decimal(0.1);
74 assert(x.value == BigInt("100000000000000000"));
75 assert(x.toFullString == "0.100000000000000000");
76 
77 x = Decimal("-0.00123");
78 assert(x.value == BigInt("-1230000000000000"));
79 assert(x.toFullString == "-0.001230000000000000");
80 
81 x = Decimal(-0.00123);
82 assert(x.value == BigInt("-1230000000000000"));
83 assert(x.toFullString == "-0.001230000000000000");
84 
85 x = Decimal(BigInt(36));
86 assert(x.value == BigInt("36000000000000000000"));
87 assert(x.toFullString == "36.000000000000000000");

Meta