line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
#ifdef __MINGW32__ |
3
|
|
|
|
|
|
|
#ifndef __USE_MINGW_ANSI_STDIO |
4
|
|
|
|
|
|
|
#define __USE_MINGW_ANSI_STDIO 1 |
5
|
|
|
|
|
|
|
#endif |
6
|
|
|
|
|
|
|
#endif |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#define PERL_NO_GET_CONTEXT 1 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#include "EXTERN.h" |
11
|
|
|
|
|
|
|
#include "perl.h" |
12
|
|
|
|
|
|
|
#include "XSUB.h" |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#include "math_decimal128_include.h" |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#if (defined(DEBUGGING) && defined(NV_IS_DOUBLE)) || defined(__MINGW64__) |
17
|
|
|
|
|
|
|
typedef _Decimal128 D128 __attribute__ ((aligned(8))); |
18
|
|
|
|
|
|
|
#else |
19
|
|
|
|
|
|
|
typedef _Decimal128 D128; |
20
|
|
|
|
|
|
|
#endif |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
int nnum = 0; /* flag that is incremented whenever _atodecimal is handed something non-numeric */ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
D128 add_on[113] = { |
25
|
|
|
|
|
|
|
1e0DL, 2e0DL, 4e0DL, 8e0DL, 16e0DL, 32e0DL, 64e0DL, 128e0DL, 256e0DL, 512e0DL, 1024e0DL, |
26
|
|
|
|
|
|
|
2048e0DL, 4096e0DL, 8192e0DL, 16384e0DL, 32768e0DL, 65536e0DL, 131072e0DL, 262144e0DL, |
27
|
|
|
|
|
|
|
524288e0DL, 1048576e0DL, 2097152e0DL, 4194304e0DL, 8388608e0DL, 16777216e0DL, 33554432e0DL, |
28
|
|
|
|
|
|
|
67108864e0DL, 134217728e0DL, 268435456e0DL, 536870912e0DL, 1073741824e0DL, 2147483648e0DL, |
29
|
|
|
|
|
|
|
4294967296e0DL, 8589934592e0DL, 17179869184e0DL, 34359738368e0DL, 68719476736e0DL, |
30
|
|
|
|
|
|
|
137438953472e0DL, 274877906944e0DL, 549755813888e0DL, 1099511627776e0DL, 2199023255552e0DL, |
31
|
|
|
|
|
|
|
4398046511104e0DL, 8796093022208e0DL, 17592186044416e0DL, 35184372088832e0DL, |
32
|
|
|
|
|
|
|
70368744177664e0DL, 140737488355328e0DL, 281474976710656e0DL, 562949953421312e0DL, |
33
|
|
|
|
|
|
|
1125899906842624e0DL, 2251799813685248e0DL, 4503599627370496e0DL, 9007199254740992e0DL, |
34
|
|
|
|
|
|
|
18014398509481984e0DL, 36028797018963968e0DL, 72057594037927936e0DL, 144115188075855872e0DL, |
35
|
|
|
|
|
|
|
288230376151711744e0DL, 576460752303423488e0DL, 1152921504606846976e0DL, |
36
|
|
|
|
|
|
|
2305843009213693952e0DL, 4611686018427387904e0DL, 9223372036854775808e0DL, |
37
|
|
|
|
|
|
|
18446744073709551616e0DL, 36893488147419103232e0DL, 73786976294838206464e0DL, |
38
|
|
|
|
|
|
|
147573952589676412928e0DL, 295147905179352825856e0DL, 590295810358705651712e0DL, |
39
|
|
|
|
|
|
|
1180591620717411303424e0DL, 2361183241434822606848e0DL, 4722366482869645213696e0DL, |
40
|
|
|
|
|
|
|
9444732965739290427392e0DL, 18889465931478580854784e0DL, 37778931862957161709568e0DL, |
41
|
|
|
|
|
|
|
75557863725914323419136e0DL, 151115727451828646838272e0DL, 302231454903657293676544e0DL, |
42
|
|
|
|
|
|
|
604462909807314587353088e0DL, 1208925819614629174706176e0DL, 2417851639229258349412352e0DL, |
43
|
|
|
|
|
|
|
4835703278458516698824704e0DL, 9671406556917033397649408e0DL, 19342813113834066795298816e0DL, |
44
|
|
|
|
|
|
|
38685626227668133590597632e0DL, 77371252455336267181195264e0DL, |
45
|
|
|
|
|
|
|
154742504910672534362390528e0DL, 309485009821345068724781056e0DL, |
46
|
|
|
|
|
|
|
618970019642690137449562112e0DL, 1237940039285380274899124224e0DL, |
47
|
|
|
|
|
|
|
2475880078570760549798248448e0DL, 4951760157141521099596496896e0DL, |
48
|
|
|
|
|
|
|
9903520314283042199192993792e0DL, 19807040628566084398385987584e0DL, |
49
|
|
|
|
|
|
|
39614081257132168796771975168e0DL, 79228162514264337593543950336e0DL, |
50
|
|
|
|
|
|
|
158456325028528675187087900672e0DL, 316912650057057350374175801344e0DL, |
51
|
|
|
|
|
|
|
633825300114114700748351602688e0DL, 1267650600228229401496703205376e0DL, |
52
|
|
|
|
|
|
|
2535301200456458802993406410752e0DL, 5070602400912917605986812821504e0DL, |
53
|
|
|
|
|
|
|
10141204801825835211973625643008e0DL, 20282409603651670423947251286016e0DL, |
54
|
|
|
|
|
|
|
40564819207303340847894502572032e0DL, 81129638414606681695789005144064e0DL, |
55
|
|
|
|
|
|
|
162259276829213363391578010288128e0DL, 324518553658426726783156020576256e0DL, |
56
|
|
|
|
|
|
|
649037107316853453566312041152512e0DL, 1298074214633706907132624082305024e0DL, |
57
|
|
|
|
|
|
|
2596148429267413814265248164610048e0DL, 5192296858534827628530496329220096e0DL }; |
58
|
|
|
|
|
|
|
|
59
|
49565
|
|
|
|
|
|
int _is_nan(D128 x) { |
60
|
49565
|
100
|
|
|
|
|
if(x == x) return 0; |
61
|
38
|
|
|
|
|
|
return 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
49574
|
|
|
|
|
|
int _is_inf(D128 x) { |
65
|
49574
|
50
|
|
|
|
|
if(x != x) return 0; /* NaN */ |
66
|
49574
|
100
|
|
|
|
|
if(x == 0.DL) return 0; /* Zero */ |
67
|
49222
|
100
|
|
|
|
|
if(x/x != x/x) { |
68
|
76
|
100
|
|
|
|
|
if(x < 0.DL) return -1; |
69
|
42
|
|
|
|
|
|
else return 1; |
70
|
|
|
|
|
|
|
} |
71
|
49146
|
|
|
|
|
|
return 0; /* Finite Real */ |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
/* Replaced */ |
75
|
|
|
|
|
|
|
/* |
76
|
|
|
|
|
|
|
//int _is_neg_zero(D128 x) { |
77
|
|
|
|
|
|
|
// char * buffer; |
78
|
|
|
|
|
|
|
// |
79
|
|
|
|
|
|
|
// if(x != 0.DL) return 0; |
80
|
|
|
|
|
|
|
// |
81
|
|
|
|
|
|
|
// Newx(buffer, 2, char); |
82
|
|
|
|
|
|
|
// sprintf(buffer, "%.0f", (double)x); |
83
|
|
|
|
|
|
|
// |
84
|
|
|
|
|
|
|
// if(strcmp(buffer, "-0")) { |
85
|
|
|
|
|
|
|
// Safefree(buffer); |
86
|
|
|
|
|
|
|
// return 0; |
87
|
|
|
|
|
|
|
// } |
88
|
|
|
|
|
|
|
// |
89
|
|
|
|
|
|
|
// Safefree(buffer); |
90
|
|
|
|
|
|
|
// return 1; |
91
|
|
|
|
|
|
|
//} |
92
|
|
|
|
|
|
|
*/ |
93
|
|
|
|
|
|
|
|
94
|
227658
|
|
|
|
|
|
int _is_neg_zero(D128 d128) { |
95
|
|
|
|
|
|
|
|
96
|
227658
|
|
|
|
|
|
int n = sizeof(D128); |
97
|
227658
|
|
|
|
|
|
void * p = &d128; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
/***************************************************** |
100
|
|
|
|
|
|
|
We perform the following oddness because of gcc's |
101
|
|
|
|
|
|
|
buggy optimization of signed zero _Decimal128. |
102
|
|
|
|
|
|
|
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80692 |
103
|
|
|
|
|
|
|
******************************************************/ |
104
|
227658
|
100
|
|
|
|
|
if(d128 != 0.0DL) { |
105
|
226447
|
50
|
|
|
|
|
if(d128 * -1.0DL == 0.0DL) return 1; /* it's a -0 */ |
106
|
226447
|
|
|
|
|
|
return 0; /* it's not zero */ |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
#ifdef WE_HAVE_BENDIAN /* Big Endian architecture */ |
110
|
|
|
|
|
|
|
if(((unsigned char*)p)[0] >= 128) return 1; |
111
|
|
|
|
|
|
|
#else |
112
|
1211
|
100
|
|
|
|
|
if(((unsigned char*)p)[n - 1] >= 128) return 1; |
113
|
|
|
|
|
|
|
#endif |
114
|
520
|
|
|
|
|
|
return 0; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
SV * _is_nan_NV(pTHX_ SV * x) { |
118
|
0
|
0
|
|
|
|
|
if(SvNV(x) == SvNV(x)) return newSViv(0); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
return newSViv(1); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
|
SV * _is_inf_NV(pTHX_ SV * x) { |
123
|
0
|
0
|
|
|
|
|
if(SvNV(x) != SvNV(x)) return 0; /* NaN */ |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
124
|
0
|
0
|
|
|
|
|
if(SvNV(x) == 0.0) return newSViv(0); /* Zero */ |
|
|
0
|
|
|
|
|
|
125
|
0
|
0
|
|
|
|
|
if(SvNV(x)/SvNV(x) != SvNV(x)/SvNV(x)) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
126
|
0
|
0
|
|
|
|
|
if(SvNV(x) < 0.0) return newSViv(-1); |
|
|
0
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
else return newSViv(1); |
128
|
|
|
|
|
|
|
} |
129
|
0
|
|
|
|
|
|
return newSVnv(0); /* Finite Real */ |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
0
|
|
|
|
|
|
SV * _is_neg_zero_NV(pTHX_ SV * x) { |
133
|
|
|
|
|
|
|
char buffer[3]; |
134
|
|
|
|
|
|
|
|
135
|
0
|
0
|
|
|
|
|
if(SvNV(x) != 0.0) return newSViv(0); |
|
|
0
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
0
|
0
|
|
|
|
|
sprintf(buffer, "%.0f", (double)SvNV(x)); |
138
|
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
if(strcmp(buffer, "-0")) { |
140
|
0
|
|
|
|
|
|
return newSViv(0); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
return newSViv(1); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
47154
|
|
|
|
|
|
D128 _exp10 (int power) { |
147
|
|
|
|
|
|
|
|
148
|
47154
|
|
|
|
|
|
D128 ret = 1.DL; |
149
|
|
|
|
|
|
|
|
150
|
47154
|
100
|
|
|
|
|
if(power < 0) { |
151
|
22584
|
50
|
|
|
|
|
while(power < -1000) { |
152
|
0
|
|
|
|
|
|
ret *= 1e-1000DL; |
153
|
0
|
|
|
|
|
|
power += 1000; |
154
|
|
|
|
|
|
|
} |
155
|
84830
|
100
|
|
|
|
|
while(power < -100) { |
156
|
62246
|
|
|
|
|
|
ret *= 1e-100DL; |
157
|
62246
|
|
|
|
|
|
power += 100; |
158
|
|
|
|
|
|
|
} |
159
|
209330
|
100
|
|
|
|
|
while(power < -10) { |
160
|
186746
|
|
|
|
|
|
ret *= 1e-10DL; |
161
|
186746
|
|
|
|
|
|
power += 10; |
162
|
|
|
|
|
|
|
} |
163
|
198008
|
100
|
|
|
|
|
while(power) { |
164
|
175424
|
|
|
|
|
|
ret *= 1e-1DL; |
165
|
175424
|
|
|
|
|
|
power++; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
else { |
169
|
24570
|
50
|
|
|
|
|
while(power > 1000) { |
170
|
0
|
|
|
|
|
|
ret *= 1e1000DL; |
171
|
0
|
|
|
|
|
|
power -= 1000; |
172
|
|
|
|
|
|
|
} |
173
|
86799
|
100
|
|
|
|
|
while(power > 100) { |
174
|
62229
|
|
|
|
|
|
ret *= 1e100DL; |
175
|
62229
|
|
|
|
|
|
power -= 100; |
176
|
|
|
|
|
|
|
} |
177
|
191970
|
100
|
|
|
|
|
while(power > 10) { |
178
|
167400
|
|
|
|
|
|
ret *= 1e10DL; |
179
|
167400
|
|
|
|
|
|
power -= 10; |
180
|
|
|
|
|
|
|
} |
181
|
125939
|
100
|
|
|
|
|
while(power) { |
182
|
101369
|
|
|
|
|
|
ret *= 1e1DL; |
183
|
101369
|
|
|
|
|
|
power--; |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
} |
186
|
47154
|
|
|
|
|
|
return ret; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
89
|
|
|
|
|
|
D128 _get_inf(int sign) { |
190
|
89
|
100
|
|
|
|
|
if(sign < 0) return -1.DL/0.DL; |
191
|
72
|
|
|
|
|
|
return 1.DL/0.DL; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
46
|
|
|
|
|
|
D128 _get_nan(void) { |
195
|
46
|
|
|
|
|
|
D128 inf = _get_inf(1); |
196
|
46
|
|
|
|
|
|
return inf/inf; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
48986
|
|
|
|
|
|
D128 _atodecimal(pTHX_ char * s) { |
200
|
|
|
|
|
|
|
/* |
201
|
|
|
|
|
|
|
plagiarising code available at |
202
|
|
|
|
|
|
|
https://www.ibm.com/developerworks/community/wikis/home?lang=en_US#!/wiki/Power%20Systems/page/POWER6%20Decimal%20Floating%20Point%20(DFP) |
203
|
|
|
|
|
|
|
The aim is that nnum be incremented iff looks_like_number() would return false for the given string |
204
|
|
|
|
|
|
|
*/ |
205
|
|
|
|
|
|
|
|
206
|
48986
|
|
|
|
|
|
D128 top = 0.DL, bot = 0.DL, result = 0.DL, div = 10.DL; |
207
|
48986
|
|
|
|
|
|
int negative = 0, i = 0, exponent = 0, count = 0; |
208
|
|
|
|
|
|
|
|
209
|
48986
|
100
|
|
|
|
|
if(!strcmp(s, "0 but true")) return 0.DL; |
210
|
|
|
|
|
|
|
|
211
|
49030
|
100
|
|
|
|
|
while(s[0] == ' ' || s[0] == '\t' || s[0] == '\n' || s[0] == '\r' || s[0] == '\f') s++; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
48985
|
100
|
|
|
|
|
if(s[0] == '-') { |
214
|
24456
|
|
|
|
|
|
negative = -1; |
215
|
24456
|
|
|
|
|
|
s++; |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
else { |
218
|
24529
|
100
|
|
|
|
|
if(s[0] == '+') s++; |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
48985
|
100
|
|
|
|
|
if((s[0] == 'i' || s[0] == 'I') && (s[1] == 'n' || s[1] == 'N') && (s[2] == 'f' || s[2] == 'F')) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
222
|
21
|
100
|
|
|
|
|
if((s[3] == 'i' || s[3] == 'I') && (s[4] == 'n' || s[4] == 'N') && (s[5] == 'i' || s[5] == 'I') && |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
223
|
3
|
50
|
|
|
|
|
(s[6] == 't' || s[6] == 'T') && (s[7] == 'y' || s[7] == 'Y')) count = 5; |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
224
|
21
|
|
|
|
|
|
for(i = 3 + count;;i++) { |
225
|
25
|
100
|
|
|
|
|
if(s[i] == 0) return _get_inf(negative); |
226
|
8
|
100
|
|
|
|
|
if(s[i] != ' ' && s[i] != '\t' && s[i] != '\n' && s[i] != '\r' && s[i] != '\f') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
227
|
4
|
|
|
|
|
|
nnum++; |
228
|
4
|
50
|
|
|
|
|
if(SvIV(get_sv("Math::Decimal128::NNW", 0))) |
|
|
50
|
|
|
|
|
|
229
|
0
|
|
|
|
|
|
warn("string argument contains at least one non-numeric character"); |
230
|
4
|
|
|
|
|
|
return _get_inf(negative); |
231
|
|
|
|
|
|
|
} |
232
|
4
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
48964
|
100
|
|
|
|
|
if((s[0] == 'n' || s[0] == 'N') && (s[1] == 'a' || s[1] == 'A') && (s[2] == 'n' || s[2] == 'N')) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
236
|
14
|
|
|
|
|
|
for(i = 3;;i++) { |
237
|
14
|
50
|
|
|
|
|
if(s[i] == 0) return _get_nan(); |
238
|
0
|
0
|
|
|
|
|
if(s[i] != ' ' && s[i] != '\t' && s[i] != '\n' && s[i] != '\r' && s[i] != '\f') { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
nnum++; |
240
|
0
|
0
|
|
|
|
|
if(SvIV(get_sv("Math::Decimal128::NNW", 0))) |
|
|
0
|
|
|
|
|
|
241
|
0
|
|
|
|
|
|
warn("string argument contains at least one non-numeric character"); |
242
|
0
|
|
|
|
|
|
return _get_nan(); |
243
|
|
|
|
|
|
|
} |
244
|
0
|
|
|
|
|
|
} |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
/* Must be a digit or a decimal point */ |
248
|
48950
|
100
|
|
|
|
|
if(!isdigit(s[0]) && s[0] != '.') { |
|
|
100
|
|
|
|
|
|
249
|
7
|
|
|
|
|
|
nnum++; |
250
|
7
|
50
|
|
|
|
|
if(SvIV(get_sv("Math::Decimal128::NNW", 0))) |
|
|
50
|
|
|
|
|
|
251
|
0
|
|
|
|
|
|
warn("string argument contains at least one non-numeric character"); |
252
|
7
|
100
|
|
|
|
|
result = negative ? result * -1.DL : result; |
253
|
7
|
|
|
|
|
|
return result; |
254
|
|
|
|
|
|
|
} |
255
|
|
|
|
|
|
|
|
256
|
653836
|
100
|
|
|
|
|
for(; isdigit(*s); s++) { |
257
|
604893
|
|
|
|
|
|
top = top * 10.DL; |
258
|
604893
|
|
|
|
|
|
top = top + *s - '0'; |
259
|
|
|
|
|
|
|
} |
260
|
|
|
|
|
|
|
|
261
|
48943
|
100
|
|
|
|
|
if(s[0] == '.') { |
262
|
24723
|
|
|
|
|
|
s++; |
263
|
239496
|
100
|
|
|
|
|
for(i = 0; isdigit(s[i]) ;i++) { |
264
|
214773
|
|
|
|
|
|
bot += (D128)(s[i] - '0') / (D128)div; |
265
|
214773
|
|
|
|
|
|
div *= 10.DL; |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
} |
268
|
|
|
|
|
|
|
|
269
|
48943
|
|
|
|
|
|
result = top + bot; |
270
|
48943
|
100
|
|
|
|
|
if(negative) result *= -1.DL; |
271
|
|
|
|
|
|
|
|
272
|
48943
|
100
|
|
|
|
|
if(s[i] == 'e' || s[i] == 'E') { |
|
|
100
|
|
|
|
|
|
273
|
47154
|
|
|
|
|
|
s += i + 1; |
274
|
47154
|
100
|
|
|
|
|
if(*s == '-') { |
275
|
22584
|
|
|
|
|
|
s++; |
276
|
107544
|
100
|
|
|
|
|
for(i = 0; isdigit(s[i]);i++) exponent = (exponent * 10) + (s[i] - '0'); |
277
|
119850590
|
100
|
|
|
|
|
while(exponent > 398) { |
278
|
119828006
|
|
|
|
|
|
result /= 10.DL; |
279
|
119828006
|
|
|
|
|
|
exponent--; |
280
|
|
|
|
|
|
|
} |
281
|
22584
|
|
|
|
|
|
result *= _exp10(-exponent); |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
/* Check for non-numeric trailing characters, and increment nnum */ |
284
|
|
|
|
|
|
|
/* (and return immediately) if we hit one */ |
285
|
0
|
|
|
|
|
|
for(;;i++) { |
286
|
22584
|
100
|
|
|
|
|
if(s[i] == 0) return result; |
287
|
1
|
50
|
|
|
|
|
if(s[i] != ' ' && s[i] != '\t' && s[i] != '\n' && s[i] != '\r' && s[i] != '\f') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
288
|
1
|
|
|
|
|
|
nnum++; |
289
|
1
|
50
|
|
|
|
|
if(SvIV(get_sv("Math::Decimal128::NNW", 0))) |
|
|
50
|
|
|
|
|
|
290
|
0
|
|
|
|
|
|
warn("string argument contains at least one non-numeric character"); |
291
|
1
|
|
|
|
|
|
return result; |
292
|
|
|
|
|
|
|
} |
293
|
0
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
} |
295
|
|
|
|
|
|
|
|
296
|
24570
|
100
|
|
|
|
|
if(*s == '+') s++; |
297
|
112689
|
100
|
|
|
|
|
for(i = 0; isdigit(s[i]);i++) exponent = (exponent * 10) + (s[i] - '0'); |
298
|
120297629
|
100
|
|
|
|
|
while(exponent > 384) { |
299
|
120273059
|
|
|
|
|
|
result *= 10.DL; |
300
|
120273059
|
|
|
|
|
|
exponent--; |
301
|
|
|
|
|
|
|
} |
302
|
24570
|
|
|
|
|
|
result *= _exp10(exponent); |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
/* Check for non-numeric trailing characters, and increment nnum */ |
306
|
|
|
|
|
|
|
/* (and return immediately) if we hit one */ |
307
|
1
|
|
|
|
|
|
for(;;i++) { |
308
|
24571
|
100
|
|
|
|
|
if(s[i] == 0) return result; |
309
|
4
|
100
|
|
|
|
|
if(s[i] != ' ' && s[i] != '\t' && s[i] != '\n' && s[i] != '\r' && s[i] != '\f') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
310
|
3
|
|
|
|
|
|
nnum++; |
311
|
3
|
50
|
|
|
|
|
if(SvIV(get_sv("Math::Decimal128::NNW", 0))) |
|
|
50
|
|
|
|
|
|
312
|
0
|
|
|
|
|
|
warn("string argument contains at least one non-numeric character"); |
313
|
3
|
|
|
|
|
|
return result; |
314
|
|
|
|
|
|
|
} |
315
|
1
|
|
|
|
|
|
} |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
/* Check for non-numeric trailing characters, and increment nnum */ |
319
|
|
|
|
|
|
|
/* (and return immediately) if we hit one */ |
320
|
3
|
|
|
|
|
|
for(;;i++) { |
321
|
1792
|
100
|
|
|
|
|
if(s[i] == 0) return result; |
322
|
10
|
100
|
|
|
|
|
if(s[i] != ' ' && s[i] != '\t' && s[i] != '\n' && s[i] != '\r' && s[i] != '\f') { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
323
|
7
|
|
|
|
|
|
nnum++; |
324
|
7
|
50
|
|
|
|
|
if(SvIV(get_sv("Math::Decimal128::NNW", 0))) |
|
|
50
|
|
|
|
|
|
325
|
0
|
|
|
|
|
|
warn("string argument contains at least one non-numeric character"); |
326
|
7
|
|
|
|
|
|
return result; |
327
|
|
|
|
|
|
|
} |
328
|
3
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
|
331
|
8
|
|
|
|
|
|
SV * _DEC128_MAX(pTHX) { |
332
|
|
|
|
|
|
|
D128 * d128; |
333
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
334
|
|
|
|
|
|
|
|
335
|
8
|
|
|
|
|
|
Newx(d128, 1, D128); |
336
|
8
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in DEC128_MAX() function"); |
337
|
|
|
|
|
|
|
|
338
|
8
|
|
|
|
|
|
obj_ref = newSV(0); |
339
|
8
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
340
|
|
|
|
|
|
|
|
341
|
8
|
|
|
|
|
|
*d128 = 9999999999999999999999999999999999e6111DL; |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
|
344
|
8
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
345
|
8
|
|
|
|
|
|
SvREADONLY_on(obj); |
346
|
8
|
|
|
|
|
|
return obj_ref; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
9
|
|
|
|
|
|
SV * _DEC128_MIN(pTHX) { |
350
|
|
|
|
|
|
|
D128 * d128; |
351
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
352
|
|
|
|
|
|
|
|
353
|
9
|
|
|
|
|
|
Newx(d128, 1, D128); |
354
|
9
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in DEC128_MIN() function"); |
355
|
|
|
|
|
|
|
|
356
|
9
|
|
|
|
|
|
obj_ref = newSV(0); |
357
|
9
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
358
|
|
|
|
|
|
|
|
359
|
9
|
|
|
|
|
|
*d128 = 1e-6176DL; |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
|
362
|
9
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
363
|
9
|
|
|
|
|
|
SvREADONLY_on(obj); |
364
|
9
|
|
|
|
|
|
return obj_ref; |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
|
368
|
30
|
|
|
|
|
|
SV * NaND128(pTHX) { |
369
|
|
|
|
|
|
|
D128 * d128; |
370
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
371
|
|
|
|
|
|
|
|
372
|
30
|
|
|
|
|
|
Newx(d128, 1, D128); |
373
|
30
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in NaND128 function"); |
374
|
|
|
|
|
|
|
|
375
|
30
|
|
|
|
|
|
obj_ref = newSV(0); |
376
|
30
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
377
|
|
|
|
|
|
|
|
378
|
30
|
|
|
|
|
|
*d128 = _get_nan(); |
379
|
|
|
|
|
|
|
|
380
|
30
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
381
|
30
|
|
|
|
|
|
SvREADONLY_on(obj); |
382
|
30
|
|
|
|
|
|
return obj_ref; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
18
|
|
|
|
|
|
SV * InfD128(pTHX_ int sign) { |
386
|
|
|
|
|
|
|
D128 * d128; |
387
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
388
|
|
|
|
|
|
|
|
389
|
18
|
|
|
|
|
|
Newx(d128, 1, D128); |
390
|
18
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in InfD128 function"); |
391
|
|
|
|
|
|
|
|
392
|
18
|
|
|
|
|
|
obj_ref = newSV(0); |
393
|
18
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
394
|
|
|
|
|
|
|
|
395
|
18
|
|
|
|
|
|
*d128 = _get_inf(sign); |
396
|
|
|
|
|
|
|
|
397
|
18
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
398
|
18
|
|
|
|
|
|
SvREADONLY_on(obj); |
399
|
18
|
|
|
|
|
|
return obj_ref; |
400
|
|
|
|
|
|
|
} |
401
|
|
|
|
|
|
|
|
402
|
47728
|
|
|
|
|
|
SV * ZeroD128(pTHX_ int sign) { |
403
|
|
|
|
|
|
|
D128 * d128; |
404
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
405
|
|
|
|
|
|
|
|
406
|
47728
|
|
|
|
|
|
Newx(d128, 1, D128); |
407
|
47728
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in ZeroD128 function"); |
408
|
|
|
|
|
|
|
|
409
|
47728
|
|
|
|
|
|
obj_ref = newSV(0); |
410
|
47728
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
411
|
|
|
|
|
|
|
|
412
|
47728
|
|
|
|
|
|
*d128 = 0.DL; |
413
|
47728
|
100
|
|
|
|
|
if(sign < 0) *d128 *= -1; |
414
|
|
|
|
|
|
|
|
415
|
47728
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
416
|
47728
|
|
|
|
|
|
SvREADONLY_on(obj); |
417
|
47728
|
|
|
|
|
|
return obj_ref; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
|
420
|
2429
|
|
|
|
|
|
SV * UnityD128(pTHX_ int sign) { |
421
|
|
|
|
|
|
|
D128 * d128; |
422
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
423
|
|
|
|
|
|
|
|
424
|
2429
|
|
|
|
|
|
Newx(d128, 1, D128); |
425
|
2429
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in UnityD128 function"); |
426
|
|
|
|
|
|
|
|
427
|
2429
|
|
|
|
|
|
obj_ref = newSV(0); |
428
|
2429
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
429
|
|
|
|
|
|
|
|
430
|
2429
|
|
|
|
|
|
*d128 = 1.DL; |
431
|
|
|
|
|
|
|
/* *d128 = (D128)strtold("1e0", NULL); */ |
432
|
2429
|
100
|
|
|
|
|
if(sign < 0) *d128 *= -1; |
433
|
|
|
|
|
|
|
|
434
|
2429
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
435
|
2429
|
|
|
|
|
|
SvREADONLY_on(obj); |
436
|
2429
|
|
|
|
|
|
return obj_ref; |
437
|
|
|
|
|
|
|
} |
438
|
|
|
|
|
|
|
|
439
|
4868
|
|
|
|
|
|
SV * Exp10l(pTHX_ int power) { |
440
|
|
|
|
|
|
|
D128 * d128; |
441
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
/* Remove the following condition, and allow 0/(+-inf to be returned |
444
|
|
|
|
|
|
|
when the power goes outside the range. |
445
|
|
|
|
|
|
|
if(power < -6176 || power > 6144) |
446
|
|
|
|
|
|
|
croak("Argument supplied to Exp10 function (%d) is out of allowable range", power); |
447
|
|
|
|
|
|
|
*/ |
448
|
|
|
|
|
|
|
|
449
|
4868
|
|
|
|
|
|
Newx(d128, 1, D128); |
450
|
4868
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in Exp10() function"); |
451
|
|
|
|
|
|
|
|
452
|
4868
|
|
|
|
|
|
obj_ref = newSV(0); |
453
|
4868
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
454
|
|
|
|
|
|
|
|
455
|
4868
|
|
|
|
|
|
*d128 = 1.DL; |
456
|
4868
|
100
|
|
|
|
|
if(power < 0) { |
457
|
4252
|
100
|
|
|
|
|
while(power < -1000) { |
458
|
2448
|
|
|
|
|
|
*d128 *= 1e-1000DL; |
459
|
2448
|
|
|
|
|
|
power += 1000; |
460
|
|
|
|
|
|
|
} |
461
|
4315
|
100
|
|
|
|
|
while(power < -100) { |
462
|
2511
|
|
|
|
|
|
*d128 *= 1e-100DL; |
463
|
2511
|
|
|
|
|
|
power += 100; |
464
|
|
|
|
|
|
|
} |
465
|
13154
|
100
|
|
|
|
|
while(power < -10) { |
466
|
11350
|
|
|
|
|
|
*d128 *= 1e-10DL; |
467
|
11350
|
|
|
|
|
|
power += 10; |
468
|
|
|
|
|
|
|
} |
469
|
11617
|
100
|
|
|
|
|
while(power) { |
470
|
9813
|
|
|
|
|
|
*d128 *= 1e-1DL; |
471
|
9813
|
|
|
|
|
|
power++; |
472
|
|
|
|
|
|
|
} |
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
else { |
475
|
5320
|
100
|
|
|
|
|
while(power > 1000) { |
476
|
2256
|
|
|
|
|
|
*d128 *= 1e1000DL; |
477
|
2256
|
|
|
|
|
|
power -= 1000; |
478
|
|
|
|
|
|
|
} |
479
|
5586
|
100
|
|
|
|
|
while(power > 100) { |
480
|
2522
|
|
|
|
|
|
*d128 *= 1e100DL; |
481
|
2522
|
|
|
|
|
|
power -= 100; |
482
|
|
|
|
|
|
|
} |
483
|
17205
|
100
|
|
|
|
|
while(power > 10) { |
484
|
14141
|
|
|
|
|
|
*d128 *= 1e10DL; |
485
|
14141
|
|
|
|
|
|
power -= 10; |
486
|
|
|
|
|
|
|
} |
487
|
16988
|
100
|
|
|
|
|
while(power) { |
488
|
13924
|
|
|
|
|
|
*d128 *= 1e1DL; |
489
|
13924
|
|
|
|
|
|
power--; |
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
4868
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
494
|
4868
|
|
|
|
|
|
SvREADONLY_on(obj); |
495
|
4868
|
|
|
|
|
|
return obj_ref; |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
0
|
|
|
|
|
|
SV * _testvalD128_1(pTHX_ int sign) { |
499
|
|
|
|
|
|
|
D128 * d128; |
500
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
501
|
|
|
|
|
|
|
|
502
|
0
|
|
|
|
|
|
Newx(d128, 1, D128); |
503
|
0
|
0
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _testvalD128() function"); |
504
|
|
|
|
|
|
|
|
505
|
0
|
|
|
|
|
|
obj_ref = newSV(0); |
506
|
0
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
507
|
|
|
|
|
|
|
|
508
|
0
|
|
|
|
|
|
*d128 = 93071992547409938307199254740993e0DL; |
509
|
|
|
|
|
|
|
|
510
|
0
|
0
|
|
|
|
|
if(sign < 0) *d128 *= -1; |
511
|
|
|
|
|
|
|
|
512
|
0
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
513
|
0
|
|
|
|
|
|
SvREADONLY_on(obj); |
514
|
0
|
|
|
|
|
|
return obj_ref; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
|
518
|
2
|
|
|
|
|
|
SV * _testvalD128_2(pTHX_ int sign) { |
519
|
|
|
|
|
|
|
D128 * d128; |
520
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
521
|
|
|
|
|
|
|
|
522
|
2
|
|
|
|
|
|
Newx(d128, 1, D128); |
523
|
2
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _testvalD128() function"); |
524
|
|
|
|
|
|
|
|
525
|
2
|
|
|
|
|
|
obj_ref = newSV(0); |
526
|
2
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
527
|
|
|
|
|
|
|
|
528
|
2
|
|
|
|
|
|
*d128 = 2547409938307199254740993e0DL; |
529
|
|
|
|
|
|
|
|
530
|
2
|
100
|
|
|
|
|
if(sign < 0) *d128 *= -1; |
531
|
|
|
|
|
|
|
|
532
|
2
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
533
|
2
|
|
|
|
|
|
SvREADONLY_on(obj); |
534
|
2
|
|
|
|
|
|
return obj_ref; |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
|
537
|
0
|
|
|
|
|
|
SV * _testvalD128_3(pTHX_ int sign) { |
538
|
|
|
|
|
|
|
D128 * d128; |
539
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
540
|
|
|
|
|
|
|
|
541
|
0
|
|
|
|
|
|
Newx(d128, 1, D128); |
542
|
0
|
0
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _testvalD128() function"); |
543
|
|
|
|
|
|
|
|
544
|
0
|
|
|
|
|
|
obj_ref = newSV(0); |
545
|
0
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
546
|
|
|
|
|
|
|
|
547
|
0
|
|
|
|
|
|
*d128 = 9938307199254740993e0DL; |
548
|
|
|
|
|
|
|
|
549
|
0
|
0
|
|
|
|
|
if(sign < 0) *d128 *= -1; |
550
|
|
|
|
|
|
|
|
551
|
0
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
552
|
0
|
|
|
|
|
|
SvREADONLY_on(obj); |
553
|
0
|
|
|
|
|
|
return obj_ref; |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
|
556
|
0
|
|
|
|
|
|
SV * _testvalD128_4(pTHX_ int sign) { |
557
|
|
|
|
|
|
|
D128 * d128; |
558
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
559
|
|
|
|
|
|
|
|
560
|
0
|
|
|
|
|
|
Newx(d128, 1, D128); |
561
|
0
|
0
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _testvalD128() function"); |
562
|
|
|
|
|
|
|
|
563
|
0
|
|
|
|
|
|
obj_ref = newSV(0); |
564
|
0
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
565
|
|
|
|
|
|
|
|
566
|
0
|
|
|
|
|
|
*d128 = 4740993e0DL; |
567
|
|
|
|
|
|
|
|
568
|
0
|
0
|
|
|
|
|
if(sign < 0) *d128 *= -1; |
569
|
|
|
|
|
|
|
|
570
|
0
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
571
|
0
|
|
|
|
|
|
SvREADONLY_on(obj); |
572
|
0
|
|
|
|
|
|
return obj_ref; |
573
|
|
|
|
|
|
|
} |
574
|
|
|
|
|
|
|
|
575
|
373673
|
|
|
|
|
|
SV * _MEtoD128(pTHX_ char * msd, char * nsd, char * lsd, SV * exponent) { |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
D128 * d128; |
578
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
579
|
373673
|
50
|
|
|
|
|
int exp = (int)SvIV(exponent), i; |
580
|
|
|
|
|
|
|
long double m; |
581
|
|
|
|
|
|
|
|
582
|
373673
|
|
|
|
|
|
Newx(d128, 1, D128); |
583
|
373673
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in MEtoD128() function"); |
584
|
|
|
|
|
|
|
|
585
|
373673
|
|
|
|
|
|
obj_ref = newSV(0); |
586
|
373673
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
587
|
|
|
|
|
|
|
|
588
|
373673
|
|
|
|
|
|
m = strtold(msd, NULL); |
589
|
373673
|
|
|
|
|
|
*d128 = (D128)m * 1e24DL; |
590
|
|
|
|
|
|
|
|
591
|
373673
|
|
|
|
|
|
m = strtold(nsd, NULL); |
592
|
373673
|
|
|
|
|
|
*d128 += (D128)m * 1e12DL; |
593
|
|
|
|
|
|
|
|
594
|
373673
|
|
|
|
|
|
m = strtold(lsd, NULL); |
595
|
373673
|
|
|
|
|
|
*d128 += (D128)m; |
596
|
|
|
|
|
|
|
|
597
|
373673
|
100
|
|
|
|
|
if(exp < 0) { |
598
|
167948853
|
100
|
|
|
|
|
for(i = 0; i > exp; --i) *d128 *= 1e-1DL; |
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
else { |
601
|
164159093
|
100
|
|
|
|
|
for(i = 0; i < exp; ++i) *d128 *= 10.DL; |
602
|
|
|
|
|
|
|
} |
603
|
|
|
|
|
|
|
|
604
|
373673
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
605
|
373673
|
|
|
|
|
|
SvREADONLY_on(obj); |
606
|
373673
|
|
|
|
|
|
return obj_ref; |
607
|
|
|
|
|
|
|
} |
608
|
|
|
|
|
|
|
|
609
|
11
|
|
|
|
|
|
void _assignME(pTHX_ SV * a, char * msd, char * nsd, char * lsd, SV * c) { |
610
|
|
|
|
|
|
|
long double man; |
611
|
11
|
50
|
|
|
|
|
int exp = (int)SvIV(c), i; |
612
|
|
|
|
|
|
|
D128 all; |
613
|
|
|
|
|
|
|
|
614
|
11
|
|
|
|
|
|
man = strtold(msd, NULL); |
615
|
11
|
|
|
|
|
|
all = (D128)man * 1e24DL; |
616
|
|
|
|
|
|
|
|
617
|
11
|
|
|
|
|
|
man = strtold(nsd, NULL); |
618
|
11
|
|
|
|
|
|
all += (D128)man * 1e12DL; |
619
|
|
|
|
|
|
|
|
620
|
11
|
|
|
|
|
|
man = strtold(lsd, NULL); |
621
|
11
|
|
|
|
|
|
all += (D128)man; |
622
|
|
|
|
|
|
|
|
623
|
11
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = all; |
624
|
|
|
|
|
|
|
|
625
|
11
|
100
|
|
|
|
|
if(exp < 0) { |
626
|
15
|
100
|
|
|
|
|
for(i = 0; i > exp; --i) *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) *= 1e-1DL; |
627
|
|
|
|
|
|
|
} |
628
|
|
|
|
|
|
|
else { |
629
|
14807
|
100
|
|
|
|
|
for(i = 0; i < exp; ++i) *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) *= 10.DL; |
630
|
|
|
|
|
|
|
} |
631
|
11
|
|
|
|
|
|
} |
632
|
|
|
|
|
|
|
|
633
|
65
|
|
|
|
|
|
SV * NVtoD128(pTHX_ SV * x) { |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
D128 * d128; |
636
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
637
|
|
|
|
|
|
|
|
638
|
65
|
|
|
|
|
|
Newx(d128, 1, D128); |
639
|
65
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in NVtoD128 function"); |
640
|
|
|
|
|
|
|
|
641
|
65
|
|
|
|
|
|
obj_ref = newSV(0); |
642
|
65
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
643
|
|
|
|
|
|
|
|
644
|
65
|
100
|
|
|
|
|
*d128 = (D128)SvNV(x); |
645
|
|
|
|
|
|
|
|
646
|
65
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
647
|
65
|
|
|
|
|
|
SvREADONLY_on(obj); |
648
|
65
|
|
|
|
|
|
return obj_ref; |
649
|
|
|
|
|
|
|
} |
650
|
|
|
|
|
|
|
|
651
|
17
|
|
|
|
|
|
SV * UVtoD128(pTHX_ SV * x) { |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
D128 * d128; |
654
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
655
|
|
|
|
|
|
|
|
656
|
17
|
|
|
|
|
|
Newx(d128, 1, D128); |
657
|
17
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in UVtoD128 function"); |
658
|
|
|
|
|
|
|
|
659
|
17
|
|
|
|
|
|
obj_ref = newSV(0); |
660
|
17
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
661
|
|
|
|
|
|
|
|
662
|
17
|
100
|
|
|
|
|
*d128 = (D128)SvUV(x); |
663
|
|
|
|
|
|
|
|
664
|
17
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
665
|
17
|
|
|
|
|
|
SvREADONLY_on(obj); |
666
|
17
|
|
|
|
|
|
return obj_ref; |
667
|
|
|
|
|
|
|
} |
668
|
|
|
|
|
|
|
|
669
|
19
|
|
|
|
|
|
SV * IVtoD128(pTHX_ SV * x) { |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
D128 * d128; |
672
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
673
|
|
|
|
|
|
|
|
674
|
19
|
|
|
|
|
|
Newx(d128, 1, D128); |
675
|
19
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in IVtoD128 function"); |
676
|
|
|
|
|
|
|
|
677
|
19
|
|
|
|
|
|
obj_ref = newSV(0); |
678
|
19
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
679
|
|
|
|
|
|
|
|
680
|
19
|
50
|
|
|
|
|
*d128 = (D128)SvIV(x); |
681
|
|
|
|
|
|
|
|
682
|
19
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
683
|
19
|
|
|
|
|
|
SvREADONLY_on(obj); |
684
|
19
|
|
|
|
|
|
return obj_ref; |
685
|
|
|
|
|
|
|
} |
686
|
|
|
|
|
|
|
|
687
|
23800
|
|
|
|
|
|
SV * PVtoD128(pTHX_ char * x) { |
688
|
|
|
|
|
|
|
D128 * d128; |
689
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
690
|
|
|
|
|
|
|
|
691
|
23800
|
|
|
|
|
|
Newx(d128, 1, D128); |
692
|
23800
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in PVtoD128 function"); |
693
|
|
|
|
|
|
|
|
694
|
23800
|
|
|
|
|
|
obj_ref = newSV(0); |
695
|
23800
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
696
|
|
|
|
|
|
|
|
697
|
23800
|
|
|
|
|
|
*d128 = _atodecimal(aTHX_ x); |
698
|
|
|
|
|
|
|
|
699
|
23800
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
700
|
23800
|
|
|
|
|
|
SvREADONLY_on(obj); |
701
|
23800
|
|
|
|
|
|
return obj_ref; |
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
|
704
|
0
|
|
|
|
|
|
SV * STRtoD128(pTHX_ char * x) { |
705
|
|
|
|
|
|
|
#ifdef STRTOD128_AVAILABLE |
706
|
|
|
|
|
|
|
D128 * d128; |
707
|
|
|
|
|
|
|
char * ptr; |
708
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
Newx(d128, 1, D128); |
711
|
|
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in STRtoD128 function"); |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
*d128 = strtod128(x, &ptr); |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
obj_ref = newSV(0); |
716
|
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
719
|
|
|
|
|
|
|
SvREADONLY_on(obj); |
720
|
|
|
|
|
|
|
return obj_ref; |
721
|
|
|
|
|
|
|
#else |
722
|
0
|
|
|
|
|
|
croak("The strtod128() function has not been made available"); |
723
|
|
|
|
|
|
|
#endif |
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
|
726
|
74
|
|
|
|
|
|
int have_strtod128(void) { |
727
|
|
|
|
|
|
|
#ifdef STRTOD128_AVAILABLE |
728
|
|
|
|
|
|
|
return 1; |
729
|
|
|
|
|
|
|
#else |
730
|
74
|
|
|
|
|
|
return 0; |
731
|
|
|
|
|
|
|
#endif |
732
|
|
|
|
|
|
|
} |
733
|
|
|
|
|
|
|
|
734
|
3
|
|
|
|
|
|
SV * D128toNV(pTHX_ SV * d128) { |
735
|
3
|
|
|
|
|
|
return newSVnv((NV)(*(INT2PTR(D128*, M_D128_SvIV(SvRV(d128)))))); |
736
|
|
|
|
|
|
|
} |
737
|
|
|
|
|
|
|
|
738
|
828704
|
|
|
|
|
|
void DESTROY(pTHX_ SV * rop) { |
739
|
828704
|
|
|
|
|
|
Safefree(INT2PTR(D128 *, M_D128_SvIV(SvRV(rop)))); |
740
|
828704
|
|
|
|
|
|
} |
741
|
|
|
|
|
|
|
|
742
|
2
|
|
|
|
|
|
void assignIVl(pTHX_ SV * a, SV * val) { |
743
|
|
|
|
|
|
|
|
744
|
2
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
745
|
2
|
50
|
|
|
|
|
const char * h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
746
|
2
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
747
|
2
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = (D128)SvIV(val); |
748
|
|
|
|
|
|
|
} |
749
|
2
|
|
|
|
|
|
else croak("Invalid object supplied to Math::Decimal128::assignIVl function"); |
750
|
|
|
|
|
|
|
} |
751
|
0
|
|
|
|
|
|
else croak("Invalid argument supplied to Math::Decimal128::assignIVl function"); |
752
|
|
|
|
|
|
|
|
753
|
2
|
|
|
|
|
|
} |
754
|
|
|
|
|
|
|
|
755
|
1
|
|
|
|
|
|
void assignUVl(pTHX_ SV * a, SV * val) { |
756
|
|
|
|
|
|
|
|
757
|
1
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
758
|
1
|
50
|
|
|
|
|
const char * h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
759
|
1
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
760
|
1
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = (D128)SvUV(val); |
761
|
|
|
|
|
|
|
} |
762
|
1
|
|
|
|
|
|
else croak("Invalid object supplied to Math::Decimal128::assignUVl function"); |
763
|
|
|
|
|
|
|
} |
764
|
0
|
|
|
|
|
|
else croak("Invalid argument supplied to Math::Decimal128::assignUVl function"); |
765
|
|
|
|
|
|
|
|
766
|
1
|
|
|
|
|
|
} |
767
|
|
|
|
|
|
|
|
768
|
2
|
|
|
|
|
|
void assignNVl(pTHX_ SV * a, SV * val) { |
769
|
|
|
|
|
|
|
|
770
|
2
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
771
|
2
|
50
|
|
|
|
|
const char * h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
772
|
2
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
773
|
2
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = (D128)SvNV(val); |
774
|
|
|
|
|
|
|
} |
775
|
2
|
|
|
|
|
|
else croak("Invalid object supplied to Math::Decimal128::assignNVl function"); |
776
|
|
|
|
|
|
|
} |
777
|
0
|
|
|
|
|
|
else croak("Invalid argument supplied to Math::Decimal128::assignNVl function"); |
778
|
|
|
|
|
|
|
|
779
|
2
|
|
|
|
|
|
} |
780
|
|
|
|
|
|
|
|
781
|
25101
|
|
|
|
|
|
void assignPVl(pTHX_ SV * a, char * s) { |
782
|
25101
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = _atodecimal(aTHX_ s); |
783
|
25101
|
|
|
|
|
|
} |
784
|
|
|
|
|
|
|
|
785
|
1
|
|
|
|
|
|
void assignD128(pTHX_ SV * a, SV * val) { |
786
|
|
|
|
|
|
|
|
787
|
2
|
50
|
|
|
|
|
if(sv_isobject(a) && sv_isobject(val)) { |
|
|
50
|
|
|
|
|
|
788
|
1
|
50
|
|
|
|
|
const char * h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
789
|
1
|
50
|
|
|
|
|
const char * hh = HvNAME(SvSTASH(SvRV(val))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
790
|
1
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128") && strEQ(hh, "Math::Decimal128")) { |
|
|
50
|
|
|
|
|
|
791
|
1
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(val)))); |
792
|
|
|
|
|
|
|
} |
793
|
0
|
|
|
|
|
|
else croak("Invalid object supplied to Math::Decimal128::assignD128 function"); |
794
|
|
|
|
|
|
|
} |
795
|
0
|
|
|
|
|
|
else croak("Invalid argument supplied to Math::Decimal128::assignD128 function"); |
796
|
|
|
|
|
|
|
|
797
|
1
|
|
|
|
|
|
} |
798
|
|
|
|
|
|
|
|
799
|
2
|
|
|
|
|
|
void assignNaNl(pTHX_ SV * a) { |
800
|
|
|
|
|
|
|
|
801
|
2
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
802
|
2
|
50
|
|
|
|
|
const char * h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
803
|
2
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
804
|
2
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = _get_nan(); |
805
|
|
|
|
|
|
|
} |
806
|
2
|
|
|
|
|
|
else croak("Invalid object supplied to Math::Decimal128::assignNaN function"); |
807
|
|
|
|
|
|
|
} |
808
|
0
|
|
|
|
|
|
else croak("Invalid argument supplied to Math::Decimal128::assignNaN function"); |
809
|
2
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
|
811
|
4
|
|
|
|
|
|
void assignInfl(pTHX_ SV * a, int sign) { |
812
|
|
|
|
|
|
|
|
813
|
4
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
814
|
4
|
50
|
|
|
|
|
const char * h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
815
|
4
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
816
|
4
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) = _get_inf(sign); |
817
|
|
|
|
|
|
|
} |
818
|
4
|
|
|
|
|
|
else croak("Invalid object supplied to Math::Decimal128::assignInf function"); |
819
|
|
|
|
|
|
|
} |
820
|
0
|
|
|
|
|
|
else croak("Invalid argument supplied to Math::Decimal128::assignInf function"); |
821
|
4
|
|
|
|
|
|
} |
822
|
|
|
|
|
|
|
|
823
|
41
|
|
|
|
|
|
SV * _overload_add(pTHX_ SV * a, SV * b, SV * third) { |
824
|
|
|
|
|
|
|
|
825
|
|
|
|
|
|
|
D128 * d128; |
826
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
827
|
|
|
|
|
|
|
|
828
|
41
|
|
|
|
|
|
Newx(d128, 1, D128); |
829
|
41
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_add function"); |
830
|
|
|
|
|
|
|
|
831
|
41
|
|
|
|
|
|
obj_ref = newSV(0); |
832
|
41
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
833
|
|
|
|
|
|
|
|
834
|
41
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
835
|
41
|
|
|
|
|
|
SvREADONLY_on(obj); |
836
|
|
|
|
|
|
|
|
837
|
41
|
50
|
|
|
|
|
if(SvUOK(b)) { |
838
|
0
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) + (D128)M_D128_SvUV(b); |
839
|
0
|
|
|
|
|
|
return obj_ref; |
840
|
|
|
|
|
|
|
} |
841
|
|
|
|
|
|
|
|
842
|
41
|
100
|
|
|
|
|
if(SvIOK(b)) { |
843
|
3
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) + (D128)M_D128_SvIV(b); |
844
|
3
|
|
|
|
|
|
return obj_ref; |
845
|
|
|
|
|
|
|
} |
846
|
|
|
|
|
|
|
|
847
|
38
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
848
|
17
|
50
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) + _atodecimal(aTHX_ SvPV_nolen(b)); |
849
|
17
|
|
|
|
|
|
return obj_ref; |
850
|
|
|
|
|
|
|
} |
851
|
|
|
|
|
|
|
|
852
|
21
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
853
|
21
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
854
|
21
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
855
|
21
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) + *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
856
|
21
|
|
|
|
|
|
return obj_ref; |
857
|
|
|
|
|
|
|
} |
858
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_add function"); |
859
|
|
|
|
|
|
|
} |
860
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_add function"); |
861
|
|
|
|
|
|
|
} |
862
|
|
|
|
|
|
|
|
863
|
2502
|
|
|
|
|
|
SV * _overload_mul(pTHX_ SV * a, SV * b, SV * third) { |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
D128 * d128; |
866
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
867
|
|
|
|
|
|
|
|
868
|
2502
|
|
|
|
|
|
Newx(d128, 1, D128); |
869
|
2502
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_mul function"); |
870
|
|
|
|
|
|
|
|
871
|
2502
|
|
|
|
|
|
obj_ref = newSV(0); |
872
|
2502
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
873
|
|
|
|
|
|
|
|
874
|
2502
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
875
|
2502
|
|
|
|
|
|
SvREADONLY_on(obj); |
876
|
|
|
|
|
|
|
|
877
|
2502
|
100
|
|
|
|
|
if(SvUOK(b)) { |
878
|
3
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) * (D128)M_D128_SvUV(b); |
879
|
3
|
|
|
|
|
|
return obj_ref; |
880
|
|
|
|
|
|
|
} |
881
|
|
|
|
|
|
|
|
882
|
2499
|
100
|
|
|
|
|
if(SvIOK(b)) { |
883
|
65
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) * (D128)M_D128_SvIV(b); |
884
|
65
|
|
|
|
|
|
return obj_ref; |
885
|
|
|
|
|
|
|
} |
886
|
|
|
|
|
|
|
|
887
|
2434
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
888
|
1
|
50
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) * _atodecimal(aTHX_ SvPV_nolen(b)); |
889
|
1
|
|
|
|
|
|
return obj_ref; |
890
|
|
|
|
|
|
|
} |
891
|
|
|
|
|
|
|
|
892
|
2433
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
893
|
2433
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
894
|
2433
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
895
|
2433
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) * *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
896
|
2433
|
|
|
|
|
|
return obj_ref; |
897
|
|
|
|
|
|
|
} |
898
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_mul function"); |
899
|
|
|
|
|
|
|
} |
900
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_mul function"); |
901
|
|
|
|
|
|
|
} |
902
|
|
|
|
|
|
|
|
903
|
36
|
|
|
|
|
|
SV * _overload_sub(pTHX_ SV * a, SV * b, SV * third) { |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
D128 * d128; |
906
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
907
|
|
|
|
|
|
|
|
908
|
36
|
|
|
|
|
|
Newx(d128, 1, D128); |
909
|
36
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_sub function"); |
910
|
|
|
|
|
|
|
|
911
|
36
|
|
|
|
|
|
obj_ref = newSV(0); |
912
|
36
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
913
|
|
|
|
|
|
|
|
914
|
36
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
915
|
36
|
|
|
|
|
|
SvREADONLY_on(obj); |
916
|
|
|
|
|
|
|
|
917
|
36
|
50
|
|
|
|
|
if(SvUOK(b)) { |
918
|
0
|
0
|
|
|
|
|
if(SWITCH_ARGS) *d128 = (D128)M_D128_SvUV(b) - *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
919
|
0
|
|
|
|
|
|
else *d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) - (D128)M_D128_SvUV(b); |
920
|
0
|
|
|
|
|
|
return obj_ref; |
921
|
|
|
|
|
|
|
} |
922
|
|
|
|
|
|
|
|
923
|
36
|
100
|
|
|
|
|
if(SvIOK(b)) { |
924
|
6
|
50
|
|
|
|
|
if(SWITCH_ARGS) *d128 = (D128)M_D128_SvIV(b) - *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
925
|
4
|
|
|
|
|
|
else *d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) - (D128)M_D128_SvIV(b); |
926
|
6
|
|
|
|
|
|
return obj_ref; |
927
|
|
|
|
|
|
|
} |
928
|
|
|
|
|
|
|
|
929
|
30
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
930
|
14
|
50
|
|
|
|
|
if(SWITCH_ARGS) *d128 = _atodecimal(aTHX_ SvPV_nolen(b)) - *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
931
|
14
|
50
|
|
|
|
|
else *d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) - _atodecimal(aTHX_ SvPV_nolen(b)); |
932
|
14
|
|
|
|
|
|
return obj_ref; |
933
|
|
|
|
|
|
|
} |
934
|
|
|
|
|
|
|
|
935
|
16
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
936
|
16
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
937
|
16
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
938
|
16
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) - *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
939
|
16
|
|
|
|
|
|
return obj_ref; |
940
|
|
|
|
|
|
|
} |
941
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_sub function"); |
942
|
|
|
|
|
|
|
} |
943
|
|
|
|
|
|
|
/* replaced by _overload_neg |
944
|
|
|
|
|
|
|
if(SWITCH_ARGS) { |
945
|
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) * -1.DL; |
946
|
|
|
|
|
|
|
return obj_ref; |
947
|
|
|
|
|
|
|
} |
948
|
|
|
|
|
|
|
*/ |
949
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_sub function"); |
950
|
|
|
|
|
|
|
} |
951
|
|
|
|
|
|
|
|
952
|
4
|
|
|
|
|
|
SV * _overload_neg(pTHX_ SV * a, SV * b, SV * third) { |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
D128 * d128; |
955
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
956
|
|
|
|
|
|
|
|
957
|
4
|
|
|
|
|
|
Newx(d128, 1, D128); |
958
|
4
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_sub function"); |
959
|
|
|
|
|
|
|
|
960
|
4
|
|
|
|
|
|
obj_ref = newSV(0); |
961
|
4
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
962
|
|
|
|
|
|
|
|
963
|
4
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
964
|
4
|
|
|
|
|
|
SvREADONLY_on(obj); |
965
|
|
|
|
|
|
|
|
966
|
4
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) * -1.DL; |
967
|
4
|
|
|
|
|
|
return obj_ref; |
968
|
|
|
|
|
|
|
} |
969
|
|
|
|
|
|
|
|
970
|
30
|
|
|
|
|
|
SV * _overload_div(pTHX_ SV * a, SV * b, SV * third) { |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
D128 * d128; |
973
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
974
|
|
|
|
|
|
|
|
975
|
30
|
|
|
|
|
|
Newx(d128, 1, D128); |
976
|
30
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_div function"); |
977
|
|
|
|
|
|
|
|
978
|
30
|
|
|
|
|
|
obj_ref = newSV(0); |
979
|
30
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
980
|
|
|
|
|
|
|
|
981
|
30
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
982
|
30
|
|
|
|
|
|
SvREADONLY_on(obj); |
983
|
|
|
|
|
|
|
|
984
|
30
|
50
|
|
|
|
|
if(SvUOK(b)) { |
985
|
0
|
0
|
|
|
|
|
if(SWITCH_ARGS) *d128 = (D128)M_D128_SvUV(b) / *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
986
|
0
|
|
|
|
|
|
else *d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) / (D128)M_D128_SvUV(b); |
987
|
0
|
|
|
|
|
|
return obj_ref; |
988
|
|
|
|
|
|
|
} |
989
|
|
|
|
|
|
|
|
990
|
30
|
100
|
|
|
|
|
if(SvIOK(b)) { |
991
|
3
|
50
|
|
|
|
|
if(SWITCH_ARGS) *d128 = (D128)M_D128_SvIV(b) / *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
992
|
1
|
|
|
|
|
|
else *d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) / (D128)M_D128_SvIV(b); |
993
|
3
|
|
|
|
|
|
return obj_ref; |
994
|
|
|
|
|
|
|
} |
995
|
|
|
|
|
|
|
|
996
|
27
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
997
|
1
|
50
|
|
|
|
|
if(SWITCH_ARGS) *d128 = _atodecimal(aTHX_ SvPV_nolen(b)) / *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
998
|
1
|
50
|
|
|
|
|
else *d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) / _atodecimal(aTHX_ SvPV_nolen(b)); |
999
|
1
|
|
|
|
|
|
return obj_ref; |
1000
|
|
|
|
|
|
|
} |
1001
|
|
|
|
|
|
|
|
1002
|
26
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1003
|
26
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1004
|
26
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1005
|
26
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) / *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
1006
|
26
|
|
|
|
|
|
return obj_ref; |
1007
|
|
|
|
|
|
|
} |
1008
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_div function"); |
1009
|
|
|
|
|
|
|
} |
1010
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_div function"); |
1011
|
|
|
|
|
|
|
} |
1012
|
|
|
|
|
|
|
|
1013
|
103
|
|
|
|
|
|
SV * _overload_add_eq(pTHX_ SV * a, SV * b, SV * third) { |
1014
|
|
|
|
|
|
|
|
1015
|
103
|
|
|
|
|
|
SvREFCNT_inc(a); |
1016
|
|
|
|
|
|
|
|
1017
|
103
|
50
|
|
|
|
|
if(SvUOK(b)) { |
1018
|
0
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) += (D128)M_D128_SvUV(b); |
1019
|
0
|
|
|
|
|
|
return a; |
1020
|
|
|
|
|
|
|
} |
1021
|
103
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1022
|
1
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) += (D128)M_D128_SvIV(b); |
1023
|
1
|
|
|
|
|
|
return a; |
1024
|
|
|
|
|
|
|
} |
1025
|
|
|
|
|
|
|
|
1026
|
102
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1027
|
1
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) += _atodecimal(aTHX_ SvPV_nolen(b)); |
1028
|
1
|
|
|
|
|
|
return a; |
1029
|
|
|
|
|
|
|
} |
1030
|
|
|
|
|
|
|
|
1031
|
101
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1032
|
101
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1033
|
101
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1034
|
101
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) += *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
1035
|
101
|
|
|
|
|
|
return a; |
1036
|
|
|
|
|
|
|
} |
1037
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1038
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_add_eq function"); |
1039
|
|
|
|
|
|
|
} |
1040
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1041
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_add_eq function"); |
1042
|
|
|
|
|
|
|
} |
1043
|
|
|
|
|
|
|
|
1044
|
4878
|
|
|
|
|
|
SV * _overload_mul_eq(pTHX_ SV * a, SV * b, SV * third) { |
1045
|
|
|
|
|
|
|
|
1046
|
4878
|
|
|
|
|
|
SvREFCNT_inc(a); |
1047
|
|
|
|
|
|
|
|
1048
|
4878
|
50
|
|
|
|
|
if(SvUOK(b)) { |
1049
|
0
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) *= (D128)M_D128_SvUV(b); |
1050
|
0
|
|
|
|
|
|
return a; |
1051
|
|
|
|
|
|
|
} |
1052
|
4878
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1053
|
7
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) *= (D128)M_D128_SvIV(b); |
1054
|
7
|
|
|
|
|
|
return a; |
1055
|
|
|
|
|
|
|
} |
1056
|
|
|
|
|
|
|
|
1057
|
4871
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1058
|
1
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) *= _atodecimal(aTHX_ SvPV_nolen(b)); |
1059
|
1
|
|
|
|
|
|
return a; |
1060
|
|
|
|
|
|
|
} |
1061
|
|
|
|
|
|
|
|
1062
|
4870
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1063
|
4870
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1064
|
4870
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1065
|
4870
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) *= *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
1066
|
4870
|
|
|
|
|
|
return a; |
1067
|
|
|
|
|
|
|
} |
1068
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1069
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_mul_eq function"); |
1070
|
|
|
|
|
|
|
} |
1071
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1072
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_mul_eq function"); |
1073
|
|
|
|
|
|
|
} |
1074
|
|
|
|
|
|
|
|
1075
|
7368981
|
|
|
|
|
|
SV * _overload_sub_eq(pTHX_ SV * a, SV * b, SV * third) { |
1076
|
|
|
|
|
|
|
|
1077
|
7368981
|
|
|
|
|
|
SvREFCNT_inc(a); |
1078
|
|
|
|
|
|
|
|
1079
|
7368981
|
50
|
|
|
|
|
if(SvUOK(b)) { |
1080
|
0
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) -= (D128)M_D128_SvUV(b); |
1081
|
0
|
|
|
|
|
|
return a; |
1082
|
|
|
|
|
|
|
} |
1083
|
7368981
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1084
|
2
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) -= (D128)M_D128_SvIV(b); |
1085
|
2
|
|
|
|
|
|
return a; |
1086
|
|
|
|
|
|
|
} |
1087
|
|
|
|
|
|
|
|
1088
|
7368979
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1089
|
1
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) -= _atodecimal(aTHX_ SvPV_nolen(b)); |
1090
|
1
|
|
|
|
|
|
return a; |
1091
|
|
|
|
|
|
|
} |
1092
|
|
|
|
|
|
|
|
1093
|
7368978
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1094
|
7368978
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1095
|
7368978
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1096
|
7368978
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) -= *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
1097
|
7368978
|
|
|
|
|
|
return a; |
1098
|
|
|
|
|
|
|
} |
1099
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1100
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_sub_eq function"); |
1101
|
|
|
|
|
|
|
} |
1102
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1103
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_sub_eq function"); |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
|
1106
|
22
|
|
|
|
|
|
SV * _overload_div_eq(pTHX_ SV * a, SV * b, SV * third) { |
1107
|
|
|
|
|
|
|
|
1108
|
22
|
|
|
|
|
|
SvREFCNT_inc(a); |
1109
|
|
|
|
|
|
|
|
1110
|
22
|
50
|
|
|
|
|
if(SvUOK(b)) { |
1111
|
0
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) /= (D128)M_D128_SvUV(b); |
1112
|
0
|
|
|
|
|
|
return a; |
1113
|
|
|
|
|
|
|
} |
1114
|
22
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1115
|
4
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) /= (D128)M_D128_SvIV(b); |
1116
|
4
|
|
|
|
|
|
return a; |
1117
|
|
|
|
|
|
|
} |
1118
|
|
|
|
|
|
|
|
1119
|
18
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1120
|
1
|
50
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) /= _atodecimal(aTHX_ SvPV_nolen(b)); |
1121
|
1
|
|
|
|
|
|
return a; |
1122
|
|
|
|
|
|
|
} |
1123
|
|
|
|
|
|
|
|
1124
|
17
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1125
|
17
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1126
|
17
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1127
|
17
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) /= *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))); |
1128
|
17
|
|
|
|
|
|
return a; |
1129
|
|
|
|
|
|
|
} |
1130
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1131
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_div_eq function"); |
1132
|
|
|
|
|
|
|
} |
1133
|
0
|
|
|
|
|
|
SvREFCNT_dec(a); |
1134
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_div_eq function"); |
1135
|
|
|
|
|
|
|
} |
1136
|
|
|
|
|
|
|
|
1137
|
127
|
|
|
|
|
|
SV * _overload_equiv(pTHX_ SV * a, SV * b, SV * third) { |
1138
|
|
|
|
|
|
|
|
1139
|
127
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1140
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == (D128)M_D128_SvUV(b)) return newSViv(1); |
1141
|
0
|
|
|
|
|
|
return newSViv(0); |
1142
|
|
|
|
|
|
|
} |
1143
|
|
|
|
|
|
|
|
1144
|
126
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1145
|
8
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == (D128)M_D128_SvIV(b)) return newSViv(1); |
1146
|
0
|
|
|
|
|
|
return newSViv(0); |
1147
|
|
|
|
|
|
|
} |
1148
|
|
|
|
|
|
|
|
1149
|
118
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1150
|
9
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1151
|
0
|
|
|
|
|
|
return newSViv(0); |
1152
|
|
|
|
|
|
|
} |
1153
|
|
|
|
|
|
|
|
1154
|
109
|
100
|
|
|
|
|
if(sv_isobject(b)) { |
1155
|
108
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1156
|
108
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1157
|
108
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(1); |
1158
|
5
|
|
|
|
|
|
return newSViv(0); |
1159
|
|
|
|
|
|
|
} |
1160
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_equiv function"); |
1161
|
|
|
|
|
|
|
} |
1162
|
1
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_equiv function"); |
1163
|
|
|
|
|
|
|
} |
1164
|
|
|
|
|
|
|
|
1165
|
232103
|
|
|
|
|
|
SV * _overload_not_equiv(pTHX_ SV * a, SV * b, SV * third) { |
1166
|
|
|
|
|
|
|
|
1167
|
232103
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1168
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) != (D128)M_D128_SvUV(b)) return newSViv(1); |
1169
|
0
|
|
|
|
|
|
return newSViv(0); |
1170
|
|
|
|
|
|
|
} |
1171
|
|
|
|
|
|
|
|
1172
|
232102
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1173
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) != (D128)M_D128_SvIV(b)) return newSViv(1); |
1174
|
0
|
|
|
|
|
|
return newSViv(0); |
1175
|
|
|
|
|
|
|
} |
1176
|
|
|
|
|
|
|
|
1177
|
232101
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1178
|
3
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) != _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1179
|
0
|
|
|
|
|
|
return newSViv(0); |
1180
|
|
|
|
|
|
|
} |
1181
|
|
|
|
|
|
|
|
1182
|
232098
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1183
|
232098
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1184
|
232098
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1185
|
232098
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(0); |
1186
|
19
|
|
|
|
|
|
return newSViv(1); |
1187
|
|
|
|
|
|
|
} |
1188
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_not_equiv function"); |
1189
|
|
|
|
|
|
|
} |
1190
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_not_equiv function"); |
1191
|
|
|
|
|
|
|
} |
1192
|
|
|
|
|
|
|
|
1193
|
23880
|
|
|
|
|
|
SV * _overload_lt(pTHX_ SV * a, SV * b, SV * third) { |
1194
|
|
|
|
|
|
|
|
1195
|
23880
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1196
|
2
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1197
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > (D128)M_D128_SvUV(b)) return newSViv(1); |
1198
|
0
|
|
|
|
|
|
return newSViv(0); |
1199
|
|
|
|
|
|
|
} |
1200
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < (D128)M_D128_SvUV(b)) return newSViv(1); |
1201
|
0
|
|
|
|
|
|
return newSViv(0); |
1202
|
|
|
|
|
|
|
} |
1203
|
|
|
|
|
|
|
|
1204
|
23878
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1205
|
4
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1206
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > (D128)M_D128_SvIV(b)) return newSViv(1); |
1207
|
0
|
|
|
|
|
|
return newSViv(0); |
1208
|
|
|
|
|
|
|
} |
1209
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < (D128)M_D128_SvIV(b)) return newSViv(1); |
1210
|
0
|
|
|
|
|
|
return newSViv(0); |
1211
|
|
|
|
|
|
|
} |
1212
|
|
|
|
|
|
|
|
1213
|
23874
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1214
|
3
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1215
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1216
|
0
|
|
|
|
|
|
return newSViv(0); |
1217
|
|
|
|
|
|
|
} |
1218
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1219
|
0
|
|
|
|
|
|
return newSViv(0); |
1220
|
|
|
|
|
|
|
} |
1221
|
|
|
|
|
|
|
|
1222
|
23871
|
100
|
|
|
|
|
if(sv_isobject(b)) { |
1223
|
23870
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1224
|
23870
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1225
|
23870
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(1); |
1226
|
2
|
|
|
|
|
|
return newSViv(0); |
1227
|
|
|
|
|
|
|
} |
1228
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_lt function"); |
1229
|
|
|
|
|
|
|
} |
1230
|
1
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_lt function"); |
1231
|
|
|
|
|
|
|
} |
1232
|
|
|
|
|
|
|
|
1233
|
6445570
|
|
|
|
|
|
SV * _overload_gt(pTHX_ SV * a, SV * b, SV * third) { |
1234
|
|
|
|
|
|
|
|
1235
|
6445570
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1236
|
2
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1237
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < (D128)M_D128_SvUV(b)) return newSViv(1); |
1238
|
0
|
|
|
|
|
|
return newSViv(0); |
1239
|
|
|
|
|
|
|
} |
1240
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > (D128)M_D128_SvUV(b)) return newSViv(1); |
1241
|
0
|
|
|
|
|
|
return newSViv(0); |
1242
|
|
|
|
|
|
|
} |
1243
|
|
|
|
|
|
|
|
1244
|
6445568
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1245
|
6445554
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1246
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < (D128)M_D128_SvIV(b)) return newSViv(1); |
1247
|
0
|
|
|
|
|
|
return newSViv(0); |
1248
|
|
|
|
|
|
|
} |
1249
|
6445552
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > (D128)M_D128_SvIV(b)) return newSViv(1); |
1250
|
2265430
|
|
|
|
|
|
return newSViv(0); |
1251
|
|
|
|
|
|
|
} |
1252
|
|
|
|
|
|
|
|
1253
|
14
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1254
|
4
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1255
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1256
|
0
|
|
|
|
|
|
return newSViv(0); |
1257
|
|
|
|
|
|
|
} |
1258
|
3
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1259
|
0
|
|
|
|
|
|
return newSViv(0); |
1260
|
|
|
|
|
|
|
} |
1261
|
|
|
|
|
|
|
|
1262
|
10
|
100
|
|
|
|
|
if(sv_isobject(b)) { |
1263
|
9
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1264
|
9
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1265
|
9
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(1); |
1266
|
1
|
|
|
|
|
|
return newSViv(0); |
1267
|
|
|
|
|
|
|
} |
1268
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_gt function"); |
1269
|
|
|
|
|
|
|
} |
1270
|
1
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_gt function"); |
1271
|
|
|
|
|
|
|
} |
1272
|
|
|
|
|
|
|
|
1273
|
26
|
|
|
|
|
|
SV * _overload_lte(pTHX_ SV * a, SV * b, SV * third) { |
1274
|
|
|
|
|
|
|
|
1275
|
26
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1276
|
3
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1277
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= (D128)M_D128_SvUV(b)) return newSViv(1); |
1278
|
0
|
|
|
|
|
|
return newSViv(0); |
1279
|
|
|
|
|
|
|
} |
1280
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= (D128)M_D128_SvUV(b)) return newSViv(1); |
1281
|
0
|
|
|
|
|
|
return newSViv(0); |
1282
|
|
|
|
|
|
|
} |
1283
|
|
|
|
|
|
|
|
1284
|
23
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1285
|
5
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1286
|
3
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= (D128)M_D128_SvIV(b)) return newSViv(1); |
1287
|
0
|
|
|
|
|
|
return newSViv(0); |
1288
|
|
|
|
|
|
|
} |
1289
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= (D128)M_D128_SvIV(b)) return newSViv(1); |
1290
|
0
|
|
|
|
|
|
return newSViv(0); |
1291
|
|
|
|
|
|
|
} |
1292
|
|
|
|
|
|
|
|
1293
|
18
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1294
|
4
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1295
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1296
|
0
|
|
|
|
|
|
return newSViv(0); |
1297
|
|
|
|
|
|
|
} |
1298
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1299
|
0
|
|
|
|
|
|
return newSViv(0); |
1300
|
|
|
|
|
|
|
} |
1301
|
|
|
|
|
|
|
|
1302
|
14
|
100
|
|
|
|
|
if(sv_isobject(b)) { |
1303
|
13
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1304
|
13
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1305
|
13
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(1); |
1306
|
1
|
|
|
|
|
|
return newSViv(0); |
1307
|
|
|
|
|
|
|
} |
1308
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_lte function"); |
1309
|
|
|
|
|
|
|
} |
1310
|
1
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_lte function"); |
1311
|
|
|
|
|
|
|
} |
1312
|
|
|
|
|
|
|
|
1313
|
11549122
|
|
|
|
|
|
SV * _overload_gte(pTHX_ SV * a, SV * b, SV * third) { |
1314
|
|
|
|
|
|
|
|
1315
|
11549122
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1316
|
3
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1317
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= (D128)M_D128_SvUV(b)) return newSViv(1); |
1318
|
0
|
|
|
|
|
|
return newSViv(0); |
1319
|
|
|
|
|
|
|
} |
1320
|
1
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= (D128)M_D128_SvUV(b)) return newSViv(1); |
1321
|
0
|
|
|
|
|
|
return newSViv(0); |
1322
|
|
|
|
|
|
|
} |
1323
|
|
|
|
|
|
|
|
1324
|
11549119
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1325
|
5
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1326
|
3
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= (D128)M_D128_SvIV(b)) return newSViv(1); |
1327
|
0
|
|
|
|
|
|
return newSViv(0); |
1328
|
|
|
|
|
|
|
} |
1329
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= (D128)M_D128_SvIV(b)) return newSViv(1); |
1330
|
0
|
|
|
|
|
|
return newSViv(0); |
1331
|
|
|
|
|
|
|
} |
1332
|
|
|
|
|
|
|
|
1333
|
11549114
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1334
|
4
|
50
|
|
|
|
|
if(SWITCH_ARGS) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1335
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) <= _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1336
|
0
|
|
|
|
|
|
return newSViv(0); |
1337
|
|
|
|
|
|
|
} |
1338
|
2
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(1); |
|
|
50
|
|
|
|
|
|
1339
|
0
|
|
|
|
|
|
return newSViv(0); |
1340
|
|
|
|
|
|
|
} |
1341
|
|
|
|
|
|
|
|
1342
|
11549110
|
100
|
|
|
|
|
if(sv_isobject(b)) { |
1343
|
11549109
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1344
|
11549109
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1345
|
11549109
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) >= *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(1); |
1346
|
4180121
|
|
|
|
|
|
return newSViv(0); |
1347
|
|
|
|
|
|
|
} |
1348
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_gte function"); |
1349
|
|
|
|
|
|
|
} |
1350
|
1
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_gte function"); |
1351
|
|
|
|
|
|
|
} |
1352
|
|
|
|
|
|
|
|
1353
|
49
|
|
|
|
|
|
SV * _overload_spaceship(pTHX_ SV * a, SV * b, SV * third) { |
1354
|
49
|
|
|
|
|
|
int reversal = 1; |
1355
|
49
|
50
|
|
|
|
|
if(SWITCH_ARGS) reversal = -1; |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
|
1357
|
49
|
100
|
|
|
|
|
if(SvUOK(b)) { |
1358
|
9
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > (D128)M_D128_SvUV(b)) return newSViv( 1 * reversal); |
1359
|
7
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < (D128)M_D128_SvUV(b)) return newSViv(-1 * reversal); |
1360
|
5
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == (D128)M_D128_SvUV(b)) return newSViv(0); |
1361
|
2
|
|
|
|
|
|
return &PL_sv_undef; /* Math::Decimal128 object (1st arg) is a nan */ |
1362
|
|
|
|
|
|
|
} |
1363
|
|
|
|
|
|
|
|
1364
|
40
|
100
|
|
|
|
|
if(SvIOK(b)) { |
1365
|
11
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > (D128)M_D128_SvIV(b)) return newSViv( 1 * reversal); |
1366
|
9
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < (D128)M_D128_SvIV(b)) return newSViv(-1 * reversal); |
1367
|
5
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == (D128)M_D128_SvIV(b)) return newSViv(0); |
1368
|
2
|
|
|
|
|
|
return &PL_sv_undef; /* Math::Decimal128 object (1st arg) is a nan */ |
1369
|
|
|
|
|
|
|
} |
1370
|
|
|
|
|
|
|
|
1371
|
29
|
100
|
|
|
|
|
if(SvPOK(b) && !SvNOK(b)) { |
|
|
50
|
|
|
|
|
|
1372
|
9
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv( 1 * reversal); |
|
|
100
|
|
|
|
|
|
1373
|
7
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(-1 * reversal); |
|
|
100
|
|
|
|
|
|
1374
|
5
|
50
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == _atodecimal(aTHX_ SvPV_nolen(b))) return newSViv(0); |
|
|
100
|
|
|
|
|
|
1375
|
2
|
|
|
|
|
|
return &PL_sv_undef; /* Math::Decimal128 object (1st arg) is a nan */ |
1376
|
|
|
|
|
|
|
} |
1377
|
|
|
|
|
|
|
|
1378
|
20
|
100
|
|
|
|
|
if(sv_isobject(b)) { |
1379
|
19
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1380
|
19
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1381
|
19
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) < *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(-1 * reversal); |
1382
|
15
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) > *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv( 1 * reversal); |
1383
|
11
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) == *(INT2PTR(D128 *, M_D128_SvIV(SvRV(b))))) return newSViv(0); |
1384
|
5
|
|
|
|
|
|
return &PL_sv_undef; /* it's a nan */ |
1385
|
|
|
|
|
|
|
} |
1386
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::_overload_spaceship function"); |
1387
|
|
|
|
|
|
|
} |
1388
|
1
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::_overload_spaceship function"); |
1389
|
|
|
|
|
|
|
} |
1390
|
|
|
|
|
|
|
|
1391
|
188679
|
|
|
|
|
|
SV * _overload_copy(pTHX_ SV * a, SV * b, SV * third) { |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
D128 * d128; |
1394
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
1395
|
|
|
|
|
|
|
|
1396
|
188679
|
|
|
|
|
|
Newx(d128, 1, D128); |
1397
|
188679
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_copy function"); |
1398
|
|
|
|
|
|
|
|
1399
|
188679
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
1400
|
|
|
|
|
|
|
|
1401
|
188679
|
|
|
|
|
|
obj_ref = newSV(0); |
1402
|
188679
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
1403
|
188679
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
1404
|
188679
|
|
|
|
|
|
SvREADONLY_on(obj); |
1405
|
188679
|
|
|
|
|
|
return obj_ref; |
1406
|
|
|
|
|
|
|
} |
1407
|
|
|
|
|
|
|
|
1408
|
25
|
|
|
|
|
|
SV * D128toD128(pTHX_ SV * a) { |
1409
|
|
|
|
|
|
|
D128 * d128; |
1410
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
1411
|
|
|
|
|
|
|
|
1412
|
25
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
1413
|
25
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1414
|
25
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) { |
1415
|
|
|
|
|
|
|
|
1416
|
25
|
|
|
|
|
|
Newx(d128, 1, D128); |
1417
|
25
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in D128toD128 function"); |
1418
|
|
|
|
|
|
|
|
1419
|
25
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
1420
|
|
|
|
|
|
|
|
1421
|
25
|
|
|
|
|
|
obj_ref = newSV(0); |
1422
|
25
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
1423
|
25
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
1424
|
25
|
|
|
|
|
|
SvREADONLY_on(obj); |
1425
|
25
|
|
|
|
|
|
return obj_ref; |
1426
|
|
|
|
|
|
|
} |
1427
|
0
|
|
|
|
|
|
croak("Invalid object supplied to Math::Decimal128::D128toD128 function"); |
1428
|
|
|
|
|
|
|
} |
1429
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::D128toD128 function"); |
1430
|
|
|
|
|
|
|
} |
1431
|
|
|
|
|
|
|
|
1432
|
6
|
|
|
|
|
|
SV * _overload_true(pTHX_ SV * a, SV * b, SV * third) { |
1433
|
|
|
|
|
|
|
|
1434
|
6
|
100
|
|
|
|
|
if(_is_nan(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))))) return newSViv(0); |
1435
|
4
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) != 0.DL) return newSViv(1); |
1436
|
1
|
|
|
|
|
|
return newSViv(0); |
1437
|
|
|
|
|
|
|
} |
1438
|
|
|
|
|
|
|
|
1439
|
64
|
|
|
|
|
|
SV * _overload_not(pTHX_ SV * a, SV * b, SV * third) { |
1440
|
64
|
100
|
|
|
|
|
if(_is_nan(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))))) return newSViv(1); |
1441
|
63
|
100
|
|
|
|
|
if(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))) != 0.DL) return newSViv(0); |
1442
|
14
|
|
|
|
|
|
return newSViv(1); |
1443
|
|
|
|
|
|
|
} |
1444
|
|
|
|
|
|
|
|
1445
|
2
|
|
|
|
|
|
SV * _overload_abs(pTHX_ SV * a, SV * b, SV * third) { |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
D128 * d128; |
1448
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
1449
|
|
|
|
|
|
|
|
1450
|
2
|
|
|
|
|
|
Newx(d128, 1, D128); |
1451
|
2
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _overload_abs function"); |
1452
|
|
|
|
|
|
|
|
1453
|
2
|
|
|
|
|
|
obj_ref = newSV(0); |
1454
|
2
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
1455
|
|
|
|
|
|
|
|
1456
|
2
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
1457
|
2
|
|
|
|
|
|
SvREADONLY_on(obj); |
1458
|
|
|
|
|
|
|
|
1459
|
2
|
|
|
|
|
|
*d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(a)))); |
1460
|
2
|
100
|
|
|
|
|
if(_is_neg_zero(*d128) || *d128 < 0 ) *d128 *= -1.DL; |
|
|
50
|
|
|
|
|
|
1461
|
2
|
|
|
|
|
|
return obj_ref; |
1462
|
|
|
|
|
|
|
} |
1463
|
|
|
|
|
|
|
|
1464
|
1
|
|
|
|
|
|
SV * _overload_inc(pTHX_ SV * p, SV * second, SV * third) { |
1465
|
1
|
|
|
|
|
|
SvREFCNT_inc(p); |
1466
|
1
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(p)))) += 1.DL; |
1467
|
1
|
|
|
|
|
|
return p; |
1468
|
|
|
|
|
|
|
} |
1469
|
|
|
|
|
|
|
|
1470
|
1
|
|
|
|
|
|
SV * _overload_dec(pTHX_ SV * p, SV * second, SV * third) { |
1471
|
1
|
|
|
|
|
|
SvREFCNT_inc(p); |
1472
|
1
|
|
|
|
|
|
*(INT2PTR(D128 *, M_D128_SvIV(SvRV(p)))) -= 1.DL; |
1473
|
1
|
|
|
|
|
|
return p; |
1474
|
|
|
|
|
|
|
} |
1475
|
|
|
|
|
|
|
|
1476
|
150
|
|
|
|
|
|
SV * _itsa(pTHX_ SV * a) { |
1477
|
150
|
100
|
|
|
|
|
if(SvUOK(a)) return newSVuv(1); |
1478
|
136
|
100
|
|
|
|
|
if(SvIOK(a)) return newSVuv(2); |
1479
|
119
|
100
|
|
|
|
|
if(SvNOK(a)) return newSVuv(3); |
1480
|
115
|
100
|
|
|
|
|
if(SvPOK(a)) return newSVuv(4); |
1481
|
41
|
50
|
|
|
|
|
if(sv_isobject(a)) { |
1482
|
41
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(a))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1483
|
41
|
100
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) return newSVuv(34); |
1484
|
|
|
|
|
|
|
} |
1485
|
4
|
|
|
|
|
|
return newSVuv(0); |
1486
|
|
|
|
|
|
|
} |
1487
|
|
|
|
|
|
|
|
1488
|
49495
|
|
|
|
|
|
SV * is_NaND128(pTHX_ SV * b) { |
1489
|
49495
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1490
|
49495
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1491
|
49495
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) |
1492
|
49495
|
|
|
|
|
|
return newSViv(_is_nan(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))))); |
1493
|
|
|
|
|
|
|
} |
1494
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::is_NaND128 function"); |
1495
|
|
|
|
|
|
|
} |
1496
|
|
|
|
|
|
|
|
1497
|
49574
|
|
|
|
|
|
SV * is_InfD128(pTHX_ SV * b) { |
1498
|
49574
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1499
|
49574
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1500
|
49574
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) |
1501
|
49574
|
|
|
|
|
|
return newSViv(_is_inf(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))))); |
1502
|
|
|
|
|
|
|
} |
1503
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::is_InfD128 function"); |
1504
|
|
|
|
|
|
|
} |
1505
|
|
|
|
|
|
|
|
1506
|
227656
|
|
|
|
|
|
SV * is_ZeroD128(pTHX_ SV * b) { |
1507
|
227656
|
50
|
|
|
|
|
if(sv_isobject(b)) { |
1508
|
227656
|
50
|
|
|
|
|
const char *h = HvNAME(SvSTASH(SvRV(b))); |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1509
|
227656
|
50
|
|
|
|
|
if(strEQ(h, "Math::Decimal128")) |
1510
|
227656
|
100
|
|
|
|
|
if (_is_neg_zero(*(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))))) return newSViv(-1); |
1511
|
226966
|
100
|
|
|
|
|
if (*(INT2PTR(D128 *, M_D128_SvIV(SvRV(b)))) == 0.DL) return newSViv(1); |
1512
|
226446
|
|
|
|
|
|
return newSViv(0); |
1513
|
|
|
|
|
|
|
} |
1514
|
0
|
|
|
|
|
|
croak("Invalid argument supplied to Math::Decimal128::is_ZeroD128 function"); |
1515
|
|
|
|
|
|
|
} |
1516
|
|
|
|
|
|
|
|
1517
|
0
|
|
|
|
|
|
SV * _wrap_count(pTHX) { |
1518
|
0
|
|
|
|
|
|
return newSVuv(PL_sv_count); |
1519
|
|
|
|
|
|
|
} |
1520
|
|
|
|
|
|
|
|
1521
|
1
|
|
|
|
|
|
SV * _get_xs_version(pTHX) { |
1522
|
1
|
|
|
|
|
|
return newSVpv(XS_VERSION, 0); |
1523
|
|
|
|
|
|
|
} |
1524
|
|
|
|
|
|
|
|
1525
|
199413
|
|
|
|
|
|
void _d128_bytes(pTHX_ SV * sv) { |
1526
|
199413
|
|
|
|
|
|
dXSARGS; |
1527
|
199413
|
|
|
|
|
|
D128 d128 = *(INT2PTR(D128 *, M_D128_SvIV(SvRV(sv)))); |
1528
|
199413
|
|
|
|
|
|
int i, n = sizeof(D128); |
1529
|
|
|
|
|
|
|
char buff[4]; |
1530
|
199413
|
|
|
|
|
|
void * p = &d128; |
1531
|
|
|
|
|
|
|
|
1532
|
199413
|
|
|
|
|
|
sp = mark; |
1533
|
|
|
|
|
|
|
|
1534
|
|
|
|
|
|
|
#ifdef WE_HAVE_BENDIAN /* Big Endian architecture */ |
1535
|
|
|
|
|
|
|
for (i = 0; i < n; i++) { |
1536
|
|
|
|
|
|
|
#else |
1537
|
3390021
|
100
|
|
|
|
|
for (i = n - 1; i >= 0; i--) { |
1538
|
|
|
|
|
|
|
#endif |
1539
|
|
|
|
|
|
|
|
1540
|
3190608
|
|
|
|
|
|
sprintf(buff, "%02X", ((unsigned char*)p)[i]); |
1541
|
3190608
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(buff, 0))); |
1542
|
|
|
|
|
|
|
} |
1543
|
199413
|
|
|
|
|
|
PUTBACK; |
1544
|
199413
|
|
|
|
|
|
XSRETURN(n); |
1545
|
|
|
|
|
|
|
} |
1546
|
|
|
|
|
|
|
|
1547
|
184713
|
|
|
|
|
|
SV * _bid_mant(pTHX_ SV * bin) { |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
D128 * d128; |
1550
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
1551
|
184713
|
|
|
|
|
|
int i, imax = av_len((AV*)SvRV(bin)); |
1552
|
184713
|
|
|
|
|
|
D128 val = 0.DL; |
1553
|
|
|
|
|
|
|
extern D128 add_on[]; |
1554
|
|
|
|
|
|
|
|
1555
|
184713
|
|
|
|
|
|
Newx(d128, 1, D128); |
1556
|
184713
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in _bid_mant function"); |
1557
|
|
|
|
|
|
|
|
1558
|
21241995
|
100
|
|
|
|
|
for(i = 0; i <= imax; i++) |
1559
|
21057282
|
50
|
|
|
|
|
if(SvIV(*(av_fetch((AV*)SvRV(bin), i, 0)))) val += add_on[i]; |
|
|
100
|
|
|
|
|
|
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
/* If val is inf or nan this function would not have been called. |
1562
|
|
|
|
|
|
|
Therefore, if val > DEC128_MAX it must be one of those illegal |
1563
|
|
|
|
|
|
|
values that should be set to zero */ |
1564
|
|
|
|
|
|
|
|
1565
|
184713
|
50
|
|
|
|
|
if(val > 9999999999999999999999999999999999e0DL) val = 0.DL; |
1566
|
|
|
|
|
|
|
|
1567
|
184713
|
|
|
|
|
|
obj_ref = newSV(0); |
1568
|
184713
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
1569
|
|
|
|
|
|
|
|
1570
|
184713
|
|
|
|
|
|
*d128 = val; |
1571
|
184713
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
1572
|
184713
|
|
|
|
|
|
SvREADONLY_on(obj); |
1573
|
184713
|
|
|
|
|
|
return obj_ref; |
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
} |
1576
|
|
|
|
|
|
|
|
1577
|
1
|
|
|
|
|
|
SV * _endianness(pTHX) { |
1578
|
|
|
|
|
|
|
#if defined(WE_HAVE_BENDIAN) |
1579
|
|
|
|
|
|
|
return newSVpv("Big Endian", 0); |
1580
|
|
|
|
|
|
|
#elif defined(WE_HAVE_LENDIAN) |
1581
|
1
|
|
|
|
|
|
return newSVpv("Little Endian", 0); |
1582
|
|
|
|
|
|
|
#else |
1583
|
|
|
|
|
|
|
return &PL_sv_undef; |
1584
|
|
|
|
|
|
|
#endif |
1585
|
|
|
|
|
|
|
} |
1586
|
|
|
|
|
|
|
|
1587
|
6
|
|
|
|
|
|
SV * _DPDtoD128(pTHX_ char * in) { |
1588
|
|
|
|
|
|
|
D128 * d128; |
1589
|
|
|
|
|
|
|
SV * obj_ref, * obj; |
1590
|
6
|
|
|
|
|
|
int i, n = sizeof(D128); |
1591
|
6
|
|
|
|
|
|
D128 out = 0.; |
1592
|
6
|
|
|
|
|
|
void *p = &out; |
1593
|
|
|
|
|
|
|
|
1594
|
6
|
|
|
|
|
|
Newx(d128, 1, D128); |
1595
|
6
|
50
|
|
|
|
|
if(d128 == NULL) croak("Failed to allocate memory in DPDtoD128 function"); |
1596
|
|
|
|
|
|
|
|
1597
|
6
|
|
|
|
|
|
obj_ref = newSV(0); |
1598
|
6
|
|
|
|
|
|
obj = newSVrv(obj_ref, "Math::Decimal128"); |
1599
|
|
|
|
|
|
|
|
1600
|
102
|
100
|
|
|
|
|
for (i = n - 1; i >= 0; i--) |
1601
|
|
|
|
|
|
|
#ifdef WE_HAVE_BENDIAN |
1602
|
|
|
|
|
|
|
((unsigned char*)p)[i] = in[i]; |
1603
|
|
|
|
|
|
|
#else |
1604
|
96
|
|
|
|
|
|
((unsigned char*)p)[i] = in[n - 1 - i]; |
1605
|
|
|
|
|
|
|
#endif |
1606
|
|
|
|
|
|
|
|
1607
|
6
|
|
|
|
|
|
*d128 = out; |
1608
|
|
|
|
|
|
|
|
1609
|
6
|
|
|
|
|
|
sv_setiv(obj, INT2PTR(IV,d128)); |
1610
|
6
|
|
|
|
|
|
SvREADONLY_on(obj); |
1611
|
6
|
|
|
|
|
|
return obj_ref; |
1612
|
|
|
|
|
|
|
} |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
/* |
1615
|
|
|
|
|
|
|
_assignDPD takes 2 args: a Math::Decimal128 object, and a |
1616
|
|
|
|
|
|
|
string that encodes the value to be assigned to that object |
1617
|
|
|
|
|
|
|
*/ |
1618
|
6
|
|
|
|
|
|
void _assignDPD(pTHX_ SV * a, char * in) { |
1619
|
6
|
|
|
|
|
|
int i, n = sizeof(D128); |
1620
|
6
|
|
|
|
|
|
D128 out = 0.; |
1621
|
6
|
|
|
|
|
|
void *p = &out; |
1622
|
|
|
|
|
|
|
|
1623
|
102
|
100
|
|
|
|
|
for (i = n - 1; i >= 0; i--) |
1624
|
|
|
|
|
|
|
#ifdef WE_HAVE_BENDIAN |
1625
|
|
|
|
|
|
|
((unsigned char*)p)[i] = in[i]; |
1626
|
|
|
|
|
|
|
#else |
1627
|
96
|
|
|
|
|
|
((unsigned char*)p)[i] = in[n - 1 - i]; |
1628
|
|
|
|
|
|
|
#endif |
1629
|
|
|
|
|
|
|
|
1630
|
6
|
50
|
|
|
|
|
*(INT2PTR(D128 *, SvIV(SvRV(a)))) = out; |
1631
|
6
|
|
|
|
|
|
} |
1632
|
|
|
|
|
|
|
|
1633
|
18
|
|
|
|
|
|
int nnumflag(void) { |
1634
|
18
|
|
|
|
|
|
return nnum; |
1635
|
|
|
|
|
|
|
} |
1636
|
|
|
|
|
|
|
|
1637
|
1
|
|
|
|
|
|
void clear_nnum(void) { |
1638
|
1
|
|
|
|
|
|
nnum = 0; |
1639
|
1
|
|
|
|
|
|
} |
1640
|
|
|
|
|
|
|
|
1641
|
1
|
|
|
|
|
|
void set_nnum(int x) { |
1642
|
1
|
|
|
|
|
|
nnum = x; |
1643
|
1
|
|
|
|
|
|
} |
1644
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
|
1646
|
0
|
|
|
|
|
|
int _lln(pTHX_ SV * x) { |
1647
|
0
|
0
|
|
|
|
|
if(looks_like_number(x)) return 1; |
1648
|
0
|
|
|
|
|
|
return 0; |
1649
|
|
|
|
|
|
|
} |
1650
|
|
|
|
|
|
|
MODULE = Math::Decimal128 PACKAGE = Math::Decimal128 |
1651
|
|
|
|
|
|
|
|
1652
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
1653
|
|
|
|
|
|
|
|
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
SV * |
1656
|
|
|
|
|
|
|
_is_nan_NV (x) |
1657
|
|
|
|
|
|
|
SV * x |
1658
|
|
|
|
|
|
|
CODE: |
1659
|
0
|
|
|
|
|
|
RETVAL = _is_nan_NV (aTHX_ x); |
1660
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1661
|
|
|
|
|
|
|
|
1662
|
|
|
|
|
|
|
SV * |
1663
|
|
|
|
|
|
|
_is_inf_NV (x) |
1664
|
|
|
|
|
|
|
SV * x |
1665
|
|
|
|
|
|
|
CODE: |
1666
|
0
|
|
|
|
|
|
RETVAL = _is_inf_NV (aTHX_ x); |
1667
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
SV * |
1670
|
|
|
|
|
|
|
_is_neg_zero_NV (x) |
1671
|
|
|
|
|
|
|
SV * x |
1672
|
|
|
|
|
|
|
CODE: |
1673
|
0
|
|
|
|
|
|
RETVAL = _is_neg_zero_NV (aTHX_ x); |
1674
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
SV * |
1677
|
|
|
|
|
|
|
_DEC128_MAX () |
1678
|
|
|
|
|
|
|
CODE: |
1679
|
8
|
|
|
|
|
|
RETVAL = _DEC128_MAX (aTHX); |
1680
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1681
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
SV * |
1684
|
|
|
|
|
|
|
_DEC128_MIN () |
1685
|
|
|
|
|
|
|
CODE: |
1686
|
9
|
|
|
|
|
|
RETVAL = _DEC128_MIN (aTHX); |
1687
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1688
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
SV * |
1691
|
|
|
|
|
|
|
NaND128 () |
1692
|
|
|
|
|
|
|
CODE: |
1693
|
30
|
|
|
|
|
|
RETVAL = NaND128 (aTHX); |
1694
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1695
|
|
|
|
|
|
|
|
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
SV * |
1698
|
|
|
|
|
|
|
InfD128 (sign) |
1699
|
|
|
|
|
|
|
int sign |
1700
|
|
|
|
|
|
|
CODE: |
1701
|
18
|
|
|
|
|
|
RETVAL = InfD128 (aTHX_ sign); |
1702
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1703
|
|
|
|
|
|
|
|
1704
|
|
|
|
|
|
|
SV * |
1705
|
|
|
|
|
|
|
ZeroD128 (sign) |
1706
|
|
|
|
|
|
|
int sign |
1707
|
|
|
|
|
|
|
CODE: |
1708
|
47728
|
|
|
|
|
|
RETVAL = ZeroD128 (aTHX_ sign); |
1709
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
SV * |
1712
|
|
|
|
|
|
|
UnityD128 (sign) |
1713
|
|
|
|
|
|
|
int sign |
1714
|
|
|
|
|
|
|
CODE: |
1715
|
2429
|
|
|
|
|
|
RETVAL = UnityD128 (aTHX_ sign); |
1716
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1717
|
|
|
|
|
|
|
|
1718
|
|
|
|
|
|
|
SV * |
1719
|
|
|
|
|
|
|
Exp10l (power) |
1720
|
|
|
|
|
|
|
int power |
1721
|
|
|
|
|
|
|
CODE: |
1722
|
4868
|
|
|
|
|
|
RETVAL = Exp10l (aTHX_ power); |
1723
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
SV * |
1726
|
|
|
|
|
|
|
_testvalD128_1 (sign) |
1727
|
|
|
|
|
|
|
int sign |
1728
|
|
|
|
|
|
|
CODE: |
1729
|
0
|
|
|
|
|
|
RETVAL = _testvalD128_1 (aTHX_ sign); |
1730
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1731
|
|
|
|
|
|
|
|
1732
|
|
|
|
|
|
|
SV * |
1733
|
|
|
|
|
|
|
_testvalD128_2 (sign) |
1734
|
|
|
|
|
|
|
int sign |
1735
|
|
|
|
|
|
|
CODE: |
1736
|
2
|
|
|
|
|
|
RETVAL = _testvalD128_2 (aTHX_ sign); |
1737
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1738
|
|
|
|
|
|
|
|
1739
|
|
|
|
|
|
|
SV * |
1740
|
|
|
|
|
|
|
_testvalD128_3 (sign) |
1741
|
|
|
|
|
|
|
int sign |
1742
|
|
|
|
|
|
|
CODE: |
1743
|
0
|
|
|
|
|
|
RETVAL = _testvalD128_3 (aTHX_ sign); |
1744
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
SV * |
1747
|
|
|
|
|
|
|
_testvalD128_4 (sign) |
1748
|
|
|
|
|
|
|
int sign |
1749
|
|
|
|
|
|
|
CODE: |
1750
|
0
|
|
|
|
|
|
RETVAL = _testvalD128_4 (aTHX_ sign); |
1751
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
SV * |
1754
|
|
|
|
|
|
|
_MEtoD128 (msd, nsd, lsd, exponent) |
1755
|
|
|
|
|
|
|
char * msd |
1756
|
|
|
|
|
|
|
char * nsd |
1757
|
|
|
|
|
|
|
char * lsd |
1758
|
|
|
|
|
|
|
SV * exponent |
1759
|
|
|
|
|
|
|
CODE: |
1760
|
373673
|
|
|
|
|
|
RETVAL = _MEtoD128 (aTHX_ msd, nsd, lsd, exponent); |
1761
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1762
|
|
|
|
|
|
|
|
1763
|
|
|
|
|
|
|
void |
1764
|
|
|
|
|
|
|
_assignME (a, msd, nsd, lsd, c) |
1765
|
|
|
|
|
|
|
SV * a |
1766
|
|
|
|
|
|
|
char * msd |
1767
|
|
|
|
|
|
|
char * nsd |
1768
|
|
|
|
|
|
|
char * lsd |
1769
|
|
|
|
|
|
|
SV * c |
1770
|
|
|
|
|
|
|
PREINIT: |
1771
|
|
|
|
|
|
|
I32* temp; |
1772
|
|
|
|
|
|
|
PPCODE: |
1773
|
11
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1774
|
11
|
|
|
|
|
|
_assignME(aTHX_ a, msd, nsd, lsd, c); |
1775
|
11
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1776
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1777
|
11
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1778
|
11
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1779
|
|
|
|
|
|
|
} |
1780
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1781
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1782
|
|
|
|
|
|
|
|
1783
|
|
|
|
|
|
|
SV * |
1784
|
|
|
|
|
|
|
NVtoD128 (x) |
1785
|
|
|
|
|
|
|
SV * x |
1786
|
|
|
|
|
|
|
CODE: |
1787
|
65
|
|
|
|
|
|
RETVAL = NVtoD128 (aTHX_ x); |
1788
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1789
|
|
|
|
|
|
|
|
1790
|
|
|
|
|
|
|
SV * |
1791
|
|
|
|
|
|
|
UVtoD128 (x) |
1792
|
|
|
|
|
|
|
SV * x |
1793
|
|
|
|
|
|
|
CODE: |
1794
|
17
|
|
|
|
|
|
RETVAL = UVtoD128 (aTHX_ x); |
1795
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1796
|
|
|
|
|
|
|
|
1797
|
|
|
|
|
|
|
SV * |
1798
|
|
|
|
|
|
|
IVtoD128 (x) |
1799
|
|
|
|
|
|
|
SV * x |
1800
|
|
|
|
|
|
|
CODE: |
1801
|
19
|
|
|
|
|
|
RETVAL = IVtoD128 (aTHX_ x); |
1802
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1803
|
|
|
|
|
|
|
|
1804
|
|
|
|
|
|
|
SV * |
1805
|
|
|
|
|
|
|
PVtoD128 (x) |
1806
|
|
|
|
|
|
|
char * x |
1807
|
|
|
|
|
|
|
CODE: |
1808
|
23800
|
|
|
|
|
|
RETVAL = PVtoD128 (aTHX_ x); |
1809
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1810
|
|
|
|
|
|
|
|
1811
|
|
|
|
|
|
|
SV * |
1812
|
|
|
|
|
|
|
STRtoD128 (x) |
1813
|
|
|
|
|
|
|
char * x |
1814
|
|
|
|
|
|
|
CODE: |
1815
|
0
|
|
|
|
|
|
RETVAL = STRtoD128 (aTHX_ x); |
1816
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1817
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
int |
1819
|
|
|
|
|
|
|
have_strtod128 () |
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
SV * |
1823
|
|
|
|
|
|
|
D128toNV (d128) |
1824
|
|
|
|
|
|
|
SV * d128 |
1825
|
|
|
|
|
|
|
CODE: |
1826
|
3
|
|
|
|
|
|
RETVAL = D128toNV (aTHX_ d128); |
1827
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1828
|
|
|
|
|
|
|
|
1829
|
|
|
|
|
|
|
void |
1830
|
|
|
|
|
|
|
DESTROY (rop) |
1831
|
|
|
|
|
|
|
SV * rop |
1832
|
|
|
|
|
|
|
PREINIT: |
1833
|
|
|
|
|
|
|
I32* temp; |
1834
|
|
|
|
|
|
|
PPCODE: |
1835
|
828704
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1836
|
828704
|
|
|
|
|
|
DESTROY(aTHX_ rop); |
1837
|
828704
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1838
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1839
|
828704
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1840
|
828704
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1841
|
|
|
|
|
|
|
} |
1842
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1843
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1844
|
|
|
|
|
|
|
|
1845
|
|
|
|
|
|
|
void |
1846
|
|
|
|
|
|
|
assignIVl (a, val) |
1847
|
|
|
|
|
|
|
SV * a |
1848
|
|
|
|
|
|
|
SV * val |
1849
|
|
|
|
|
|
|
PREINIT: |
1850
|
|
|
|
|
|
|
I32* temp; |
1851
|
|
|
|
|
|
|
PPCODE: |
1852
|
2
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1853
|
2
|
|
|
|
|
|
assignIVl(aTHX_ a, val); |
1854
|
2
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1855
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1856
|
2
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1857
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1858
|
|
|
|
|
|
|
} |
1859
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1860
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
void |
1863
|
|
|
|
|
|
|
assignUVl (a, val) |
1864
|
|
|
|
|
|
|
SV * a |
1865
|
|
|
|
|
|
|
SV * val |
1866
|
|
|
|
|
|
|
PREINIT: |
1867
|
|
|
|
|
|
|
I32* temp; |
1868
|
|
|
|
|
|
|
PPCODE: |
1869
|
1
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1870
|
1
|
|
|
|
|
|
assignUVl(aTHX_ a, val); |
1871
|
1
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1872
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1873
|
1
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1874
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1875
|
|
|
|
|
|
|
} |
1876
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1877
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1878
|
|
|
|
|
|
|
|
1879
|
|
|
|
|
|
|
void |
1880
|
|
|
|
|
|
|
assignNVl (a, val) |
1881
|
|
|
|
|
|
|
SV * a |
1882
|
|
|
|
|
|
|
SV * val |
1883
|
|
|
|
|
|
|
PREINIT: |
1884
|
|
|
|
|
|
|
I32* temp; |
1885
|
|
|
|
|
|
|
PPCODE: |
1886
|
2
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1887
|
2
|
|
|
|
|
|
assignNVl(aTHX_ a, val); |
1888
|
2
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1889
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1890
|
2
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1891
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1892
|
|
|
|
|
|
|
} |
1893
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1894
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
void |
1897
|
|
|
|
|
|
|
assignPVl (a, s) |
1898
|
|
|
|
|
|
|
SV * a |
1899
|
|
|
|
|
|
|
char * s |
1900
|
|
|
|
|
|
|
PREINIT: |
1901
|
|
|
|
|
|
|
I32* temp; |
1902
|
|
|
|
|
|
|
PPCODE: |
1903
|
25101
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1904
|
25101
|
|
|
|
|
|
assignPVl(aTHX_ a, s); |
1905
|
25101
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1906
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1907
|
25101
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1908
|
25101
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1909
|
|
|
|
|
|
|
} |
1910
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1911
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1912
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
void |
1914
|
|
|
|
|
|
|
assignD128 (a, val) |
1915
|
|
|
|
|
|
|
SV * a |
1916
|
|
|
|
|
|
|
SV * val |
1917
|
|
|
|
|
|
|
PREINIT: |
1918
|
|
|
|
|
|
|
I32* temp; |
1919
|
|
|
|
|
|
|
PPCODE: |
1920
|
1
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1921
|
1
|
|
|
|
|
|
assignD128(aTHX_ a, val); |
1922
|
1
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1923
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1924
|
1
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1925
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1926
|
|
|
|
|
|
|
} |
1927
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1928
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1929
|
|
|
|
|
|
|
|
1930
|
|
|
|
|
|
|
void |
1931
|
|
|
|
|
|
|
assignNaNl (a) |
1932
|
|
|
|
|
|
|
SV * a |
1933
|
|
|
|
|
|
|
PREINIT: |
1934
|
|
|
|
|
|
|
I32* temp; |
1935
|
|
|
|
|
|
|
PPCODE: |
1936
|
2
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1937
|
2
|
|
|
|
|
|
assignNaNl(aTHX_ a); |
1938
|
2
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1939
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1940
|
2
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1941
|
2
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1942
|
|
|
|
|
|
|
} |
1943
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1944
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1945
|
|
|
|
|
|
|
|
1946
|
|
|
|
|
|
|
void |
1947
|
|
|
|
|
|
|
assignInfl (a, sign) |
1948
|
|
|
|
|
|
|
SV * a |
1949
|
|
|
|
|
|
|
int sign |
1950
|
|
|
|
|
|
|
PREINIT: |
1951
|
|
|
|
|
|
|
I32* temp; |
1952
|
|
|
|
|
|
|
PPCODE: |
1953
|
4
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
1954
|
4
|
|
|
|
|
|
assignInfl(aTHX_ a, sign); |
1955
|
4
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
1956
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
1957
|
4
|
|
|
|
|
|
PL_markstack_ptr = temp; |
1958
|
4
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
1959
|
|
|
|
|
|
|
} |
1960
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
1961
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
SV * |
1964
|
|
|
|
|
|
|
_overload_add (a, b, third) |
1965
|
|
|
|
|
|
|
SV * a |
1966
|
|
|
|
|
|
|
SV * b |
1967
|
|
|
|
|
|
|
SV * third |
1968
|
|
|
|
|
|
|
CODE: |
1969
|
41
|
|
|
|
|
|
RETVAL = _overload_add (aTHX_ a, b, third); |
1970
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1971
|
|
|
|
|
|
|
|
1972
|
|
|
|
|
|
|
SV * |
1973
|
|
|
|
|
|
|
_overload_mul (a, b, third) |
1974
|
|
|
|
|
|
|
SV * a |
1975
|
|
|
|
|
|
|
SV * b |
1976
|
|
|
|
|
|
|
SV * third |
1977
|
|
|
|
|
|
|
CODE: |
1978
|
2502
|
|
|
|
|
|
RETVAL = _overload_mul (aTHX_ a, b, third); |
1979
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1980
|
|
|
|
|
|
|
|
1981
|
|
|
|
|
|
|
SV * |
1982
|
|
|
|
|
|
|
_overload_sub (a, b, third) |
1983
|
|
|
|
|
|
|
SV * a |
1984
|
|
|
|
|
|
|
SV * b |
1985
|
|
|
|
|
|
|
SV * third |
1986
|
|
|
|
|
|
|
CODE: |
1987
|
36
|
|
|
|
|
|
RETVAL = _overload_sub (aTHX_ a, b, third); |
1988
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1989
|
|
|
|
|
|
|
|
1990
|
|
|
|
|
|
|
SV * |
1991
|
|
|
|
|
|
|
_overload_neg (a, b, third) |
1992
|
|
|
|
|
|
|
SV * a |
1993
|
|
|
|
|
|
|
SV * b |
1994
|
|
|
|
|
|
|
SV * third |
1995
|
|
|
|
|
|
|
CODE: |
1996
|
4
|
|
|
|
|
|
RETVAL = _overload_neg (aTHX_ a, b, third); |
1997
|
|
|
|
|
|
|
OUTPUT: RETVAL |
1998
|
|
|
|
|
|
|
|
1999
|
|
|
|
|
|
|
SV * |
2000
|
|
|
|
|
|
|
_overload_div (a, b, third) |
2001
|
|
|
|
|
|
|
SV * a |
2002
|
|
|
|
|
|
|
SV * b |
2003
|
|
|
|
|
|
|
SV * third |
2004
|
|
|
|
|
|
|
CODE: |
2005
|
30
|
|
|
|
|
|
RETVAL = _overload_div (aTHX_ a, b, third); |
2006
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
SV * |
2009
|
|
|
|
|
|
|
_overload_add_eq (a, b, third) |
2010
|
|
|
|
|
|
|
SV * a |
2011
|
|
|
|
|
|
|
SV * b |
2012
|
|
|
|
|
|
|
SV * third |
2013
|
|
|
|
|
|
|
CODE: |
2014
|
103
|
|
|
|
|
|
RETVAL = _overload_add_eq (aTHX_ a, b, third); |
2015
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2016
|
|
|
|
|
|
|
|
2017
|
|
|
|
|
|
|
SV * |
2018
|
|
|
|
|
|
|
_overload_mul_eq (a, b, third) |
2019
|
|
|
|
|
|
|
SV * a |
2020
|
|
|
|
|
|
|
SV * b |
2021
|
|
|
|
|
|
|
SV * third |
2022
|
|
|
|
|
|
|
CODE: |
2023
|
4878
|
|
|
|
|
|
RETVAL = _overload_mul_eq (aTHX_ a, b, third); |
2024
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2025
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
SV * |
2027
|
|
|
|
|
|
|
_overload_sub_eq (a, b, third) |
2028
|
|
|
|
|
|
|
SV * a |
2029
|
|
|
|
|
|
|
SV * b |
2030
|
|
|
|
|
|
|
SV * third |
2031
|
|
|
|
|
|
|
CODE: |
2032
|
7368981
|
|
|
|
|
|
RETVAL = _overload_sub_eq (aTHX_ a, b, third); |
2033
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
SV * |
2036
|
|
|
|
|
|
|
_overload_div_eq (a, b, third) |
2037
|
|
|
|
|
|
|
SV * a |
2038
|
|
|
|
|
|
|
SV * b |
2039
|
|
|
|
|
|
|
SV * third |
2040
|
|
|
|
|
|
|
CODE: |
2041
|
22
|
|
|
|
|
|
RETVAL = _overload_div_eq (aTHX_ a, b, third); |
2042
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2043
|
|
|
|
|
|
|
|
2044
|
|
|
|
|
|
|
SV * |
2045
|
|
|
|
|
|
|
_overload_equiv (a, b, third) |
2046
|
|
|
|
|
|
|
SV * a |
2047
|
|
|
|
|
|
|
SV * b |
2048
|
|
|
|
|
|
|
SV * third |
2049
|
|
|
|
|
|
|
CODE: |
2050
|
127
|
|
|
|
|
|
RETVAL = _overload_equiv (aTHX_ a, b, third); |
2051
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
SV * |
2054
|
|
|
|
|
|
|
_overload_not_equiv (a, b, third) |
2055
|
|
|
|
|
|
|
SV * a |
2056
|
|
|
|
|
|
|
SV * b |
2057
|
|
|
|
|
|
|
SV * third |
2058
|
|
|
|
|
|
|
CODE: |
2059
|
232103
|
|
|
|
|
|
RETVAL = _overload_not_equiv (aTHX_ a, b, third); |
2060
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2061
|
|
|
|
|
|
|
|
2062
|
|
|
|
|
|
|
SV * |
2063
|
|
|
|
|
|
|
_overload_lt (a, b, third) |
2064
|
|
|
|
|
|
|
SV * a |
2065
|
|
|
|
|
|
|
SV * b |
2066
|
|
|
|
|
|
|
SV * third |
2067
|
|
|
|
|
|
|
CODE: |
2068
|
23880
|
|
|
|
|
|
RETVAL = _overload_lt (aTHX_ a, b, third); |
2069
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2070
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
SV * |
2072
|
|
|
|
|
|
|
_overload_gt (a, b, third) |
2073
|
|
|
|
|
|
|
SV * a |
2074
|
|
|
|
|
|
|
SV * b |
2075
|
|
|
|
|
|
|
SV * third |
2076
|
|
|
|
|
|
|
CODE: |
2077
|
6445570
|
|
|
|
|
|
RETVAL = _overload_gt (aTHX_ a, b, third); |
2078
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2079
|
|
|
|
|
|
|
|
2080
|
|
|
|
|
|
|
SV * |
2081
|
|
|
|
|
|
|
_overload_lte (a, b, third) |
2082
|
|
|
|
|
|
|
SV * a |
2083
|
|
|
|
|
|
|
SV * b |
2084
|
|
|
|
|
|
|
SV * third |
2085
|
|
|
|
|
|
|
CODE: |
2086
|
26
|
|
|
|
|
|
RETVAL = _overload_lte (aTHX_ a, b, third); |
2087
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2088
|
|
|
|
|
|
|
|
2089
|
|
|
|
|
|
|
SV * |
2090
|
|
|
|
|
|
|
_overload_gte (a, b, third) |
2091
|
|
|
|
|
|
|
SV * a |
2092
|
|
|
|
|
|
|
SV * b |
2093
|
|
|
|
|
|
|
SV * third |
2094
|
|
|
|
|
|
|
CODE: |
2095
|
11549122
|
|
|
|
|
|
RETVAL = _overload_gte (aTHX_ a, b, third); |
2096
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2097
|
|
|
|
|
|
|
|
2098
|
|
|
|
|
|
|
SV * |
2099
|
|
|
|
|
|
|
_overload_spaceship (a, b, third) |
2100
|
|
|
|
|
|
|
SV * a |
2101
|
|
|
|
|
|
|
SV * b |
2102
|
|
|
|
|
|
|
SV * third |
2103
|
|
|
|
|
|
|
CODE: |
2104
|
49
|
|
|
|
|
|
RETVAL = _overload_spaceship (aTHX_ a, b, third); |
2105
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2106
|
|
|
|
|
|
|
|
2107
|
|
|
|
|
|
|
SV * |
2108
|
|
|
|
|
|
|
_overload_copy (a, b, third) |
2109
|
|
|
|
|
|
|
SV * a |
2110
|
|
|
|
|
|
|
SV * b |
2111
|
|
|
|
|
|
|
SV * third |
2112
|
|
|
|
|
|
|
CODE: |
2113
|
188679
|
|
|
|
|
|
RETVAL = _overload_copy (aTHX_ a, b, third); |
2114
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
SV * |
2117
|
|
|
|
|
|
|
D128toD128 (a) |
2118
|
|
|
|
|
|
|
SV * a |
2119
|
|
|
|
|
|
|
CODE: |
2120
|
25
|
|
|
|
|
|
RETVAL = D128toD128 (aTHX_ a); |
2121
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2122
|
|
|
|
|
|
|
|
2123
|
|
|
|
|
|
|
SV * |
2124
|
|
|
|
|
|
|
_overload_true (a, b, third) |
2125
|
|
|
|
|
|
|
SV * a |
2126
|
|
|
|
|
|
|
SV * b |
2127
|
|
|
|
|
|
|
SV * third |
2128
|
|
|
|
|
|
|
CODE: |
2129
|
6
|
|
|
|
|
|
RETVAL = _overload_true (aTHX_ a, b, third); |
2130
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
SV * |
2133
|
|
|
|
|
|
|
_overload_not (a, b, third) |
2134
|
|
|
|
|
|
|
SV * a |
2135
|
|
|
|
|
|
|
SV * b |
2136
|
|
|
|
|
|
|
SV * third |
2137
|
|
|
|
|
|
|
CODE: |
2138
|
64
|
|
|
|
|
|
RETVAL = _overload_not (aTHX_ a, b, third); |
2139
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2140
|
|
|
|
|
|
|
|
2141
|
|
|
|
|
|
|
SV * |
2142
|
|
|
|
|
|
|
_overload_abs (a, b, third) |
2143
|
|
|
|
|
|
|
SV * a |
2144
|
|
|
|
|
|
|
SV * b |
2145
|
|
|
|
|
|
|
SV * third |
2146
|
|
|
|
|
|
|
CODE: |
2147
|
2
|
|
|
|
|
|
RETVAL = _overload_abs (aTHX_ a, b, third); |
2148
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
SV * |
2151
|
|
|
|
|
|
|
_overload_inc (p, second, third) |
2152
|
|
|
|
|
|
|
SV * p |
2153
|
|
|
|
|
|
|
SV * second |
2154
|
|
|
|
|
|
|
SV * third |
2155
|
|
|
|
|
|
|
CODE: |
2156
|
1
|
|
|
|
|
|
RETVAL = _overload_inc (aTHX_ p, second, third); |
2157
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2158
|
|
|
|
|
|
|
|
2159
|
|
|
|
|
|
|
SV * |
2160
|
|
|
|
|
|
|
_overload_dec (p, second, third) |
2161
|
|
|
|
|
|
|
SV * p |
2162
|
|
|
|
|
|
|
SV * second |
2163
|
|
|
|
|
|
|
SV * third |
2164
|
|
|
|
|
|
|
CODE: |
2165
|
1
|
|
|
|
|
|
RETVAL = _overload_dec (aTHX_ p, second, third); |
2166
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2167
|
|
|
|
|
|
|
|
2168
|
|
|
|
|
|
|
SV * |
2169
|
|
|
|
|
|
|
_itsa (a) |
2170
|
|
|
|
|
|
|
SV * a |
2171
|
|
|
|
|
|
|
CODE: |
2172
|
150
|
|
|
|
|
|
RETVAL = _itsa (aTHX_ a); |
2173
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2174
|
|
|
|
|
|
|
|
2175
|
|
|
|
|
|
|
SV * |
2176
|
|
|
|
|
|
|
is_NaND128 (b) |
2177
|
|
|
|
|
|
|
SV * b |
2178
|
|
|
|
|
|
|
CODE: |
2179
|
49495
|
|
|
|
|
|
RETVAL = is_NaND128 (aTHX_ b); |
2180
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
SV * |
2183
|
|
|
|
|
|
|
is_InfD128 (b) |
2184
|
|
|
|
|
|
|
SV * b |
2185
|
|
|
|
|
|
|
CODE: |
2186
|
49574
|
|
|
|
|
|
RETVAL = is_InfD128 (aTHX_ b); |
2187
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2188
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
SV * |
2190
|
|
|
|
|
|
|
is_ZeroD128 (b) |
2191
|
|
|
|
|
|
|
SV * b |
2192
|
|
|
|
|
|
|
CODE: |
2193
|
227656
|
|
|
|
|
|
RETVAL = is_ZeroD128 (aTHX_ b); |
2194
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
SV * |
2197
|
|
|
|
|
|
|
_wrap_count () |
2198
|
|
|
|
|
|
|
CODE: |
2199
|
0
|
|
|
|
|
|
RETVAL = _wrap_count (aTHX); |
2200
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2201
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
SV * |
2204
|
|
|
|
|
|
|
_get_xs_version () |
2205
|
|
|
|
|
|
|
CODE: |
2206
|
1
|
|
|
|
|
|
RETVAL = _get_xs_version (aTHX); |
2207
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2208
|
|
|
|
|
|
|
|
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
void |
2211
|
|
|
|
|
|
|
_d128_bytes (sv) |
2212
|
|
|
|
|
|
|
SV * sv |
2213
|
|
|
|
|
|
|
PREINIT: |
2214
|
|
|
|
|
|
|
I32* temp; |
2215
|
|
|
|
|
|
|
PPCODE: |
2216
|
199413
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
2217
|
199413
|
|
|
|
|
|
_d128_bytes(aTHX_ sv); |
2218
|
199413
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
2219
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
2220
|
0
|
|
|
|
|
|
PL_markstack_ptr = temp; |
2221
|
0
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
2222
|
|
|
|
|
|
|
} |
2223
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
2224
|
199413
|
|
|
|
|
|
return; /* assume stack size is correct */ |
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
SV * |
2227
|
|
|
|
|
|
|
_bid_mant (bin) |
2228
|
|
|
|
|
|
|
SV * bin |
2229
|
|
|
|
|
|
|
CODE: |
2230
|
184713
|
|
|
|
|
|
RETVAL = _bid_mant (aTHX_ bin); |
2231
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2232
|
|
|
|
|
|
|
|
2233
|
|
|
|
|
|
|
SV * |
2234
|
|
|
|
|
|
|
_endianness () |
2235
|
|
|
|
|
|
|
CODE: |
2236
|
1
|
|
|
|
|
|
RETVAL = _endianness (aTHX); |
2237
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2238
|
|
|
|
|
|
|
|
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
SV * |
2241
|
|
|
|
|
|
|
_DPDtoD128 (in) |
2242
|
|
|
|
|
|
|
char * in |
2243
|
|
|
|
|
|
|
CODE: |
2244
|
6
|
|
|
|
|
|
RETVAL = _DPDtoD128 (aTHX_ in); |
2245
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2246
|
|
|
|
|
|
|
|
2247
|
|
|
|
|
|
|
void |
2248
|
|
|
|
|
|
|
_assignDPD (a, in) |
2249
|
|
|
|
|
|
|
SV * a |
2250
|
|
|
|
|
|
|
char * in |
2251
|
|
|
|
|
|
|
PREINIT: |
2252
|
|
|
|
|
|
|
I32* temp; |
2253
|
|
|
|
|
|
|
PPCODE: |
2254
|
6
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
2255
|
6
|
|
|
|
|
|
_assignDPD(aTHX_ a, in); |
2256
|
6
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
2257
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
2258
|
6
|
|
|
|
|
|
PL_markstack_ptr = temp; |
2259
|
6
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
2260
|
|
|
|
|
|
|
} |
2261
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
2262
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
int |
2265
|
|
|
|
|
|
|
nnumflag () |
2266
|
|
|
|
|
|
|
|
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
void |
2269
|
|
|
|
|
|
|
clear_nnum () |
2270
|
|
|
|
|
|
|
|
2271
|
|
|
|
|
|
|
PREINIT: |
2272
|
|
|
|
|
|
|
I32* temp; |
2273
|
|
|
|
|
|
|
PPCODE: |
2274
|
1
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
2275
|
1
|
|
|
|
|
|
clear_nnum(); |
2276
|
1
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
2277
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
2278
|
1
|
|
|
|
|
|
PL_markstack_ptr = temp; |
2279
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
2280
|
|
|
|
|
|
|
} |
2281
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
2282
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
2283
|
|
|
|
|
|
|
|
2284
|
|
|
|
|
|
|
void |
2285
|
|
|
|
|
|
|
set_nnum (x) |
2286
|
|
|
|
|
|
|
int x |
2287
|
|
|
|
|
|
|
PREINIT: |
2288
|
|
|
|
|
|
|
I32* temp; |
2289
|
|
|
|
|
|
|
PPCODE: |
2290
|
1
|
|
|
|
|
|
temp = PL_markstack_ptr++; |
2291
|
1
|
|
|
|
|
|
set_nnum(x); |
2292
|
1
|
50
|
|
|
|
|
if (PL_markstack_ptr != temp) { |
2293
|
|
|
|
|
|
|
/* truly void, because dXSARGS not invoked */ |
2294
|
1
|
|
|
|
|
|
PL_markstack_ptr = temp; |
2295
|
1
|
|
|
|
|
|
XSRETURN_EMPTY; /* return empty stack */ |
2296
|
|
|
|
|
|
|
} |
2297
|
|
|
|
|
|
|
/* must have used dXSARGS; list context implied */ |
2298
|
0
|
|
|
|
|
|
return; /* assume stack size is correct */ |
2299
|
|
|
|
|
|
|
|
2300
|
|
|
|
|
|
|
int |
2301
|
|
|
|
|
|
|
_lln (x) |
2302
|
|
|
|
|
|
|
SV * x |
2303
|
|
|
|
|
|
|
CODE: |
2304
|
0
|
|
|
|
|
|
RETVAL = _lln (aTHX_ x); |
2305
|
|
|
|
|
|
|
OUTPUT: RETVAL |
2306
|
|
|
|
|
|
|
|