forked from ckormanyos/real-time-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecwide_t.h
4131 lines (3330 loc) · 234 KB
/
decwide_t.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 1999 - 2021. //
// Distributed under the Boost Software License, //
// Version 1.0. (See accompanying file LICENSE_1_0.txt //
// or copy at http://www.boost.org/LICENSE_1_0.txt) //
///////////////////////////////////////////////////////////////////
// This work is also based on an earlier work:
// "Algorithm 910: A Portable C++ Multiple-Precision System for Special-Function Calculations",
// in ACM TOMS, {VOL 37, ISSUE 4, (February 2011)} (C) ACM, 2011. http://doi.acm.org/10.1145/1916461.1916469
// This file implements the class decwide_t and most of its
// basic functions including constructors, binary arithmetic
// operations, comparison operators and more.
#ifndef DECWIDE_T_2004_06_01_H_
#define DECWIDE_T_2004_06_01_H_
//#define WIDE_DECIMAL_DISABLE_IOSTREAM
//#define WIDE_DECIMAL_DISABLE_DYNAMIC_MEMORY_ALLOCATION
//#define WIDE_DECIMAL_DISABLE_CONSTRUCT_FROM_STRING
//#define WIDE_DECIMAL_DISABLE_CACHED_CONSTANTS
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <limits>
#if !defined(WIDE_DECIMAL_DISABLE_IOSTREAM)
#include <iomanip>
#include <iostream>
#include <sstream>
#endif
#if !defined(WIDE_DECIMAL_DISABLE_CONSTRUCT_FROM_STRING)
#include <cstdlib>
#include <string>
#endif
#include <type_traits>
#include <math/wide_decimal/decwide_t_detail_ops.h>
#include <util/utility/util_baselexical_cast.h>
#if defined(__GNUC__) && defined(__RL78__)
namespace std { using ::ilogb; }
#endif
namespace math { namespace wide_decimal {
// Forward declaration of the decwide_t template class.
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
class decwide_t;
// Forward declarations of various decwide_t namespace functions.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType>
constexpr decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> zero();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType>
constexpr decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> one();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType>
constexpr decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> two();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType>
constexpr decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> half();
#if !defined(WIDE_DECIMAL_DISABLE_CACHED_CONSTANTS)
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& pi(void(*pfn_callback_to_report_digits10)(const std::uint32_t) = nullptr);
#else
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> pi(void(*pfn_callback_to_report_digits10)(const std::uint32_t) = nullptr);
#endif
#if !defined(WIDE_DECIMAL_DISABLE_CACHED_CONSTANTS)
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& ln_two();
#else
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> ln_two();
#endif
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> calc_pi(void(*pfn_callback_to_report_digits10)(const std::uint32_t) = nullptr);
template<const std::int32_t MyDigits10,
typename LimbType = std::uint32_t,
typename AllocatorType = std::allocator<void>,
typename InternalFloatType = double,
typename ExponentType = std::int64_t,
typename FftFloatType = double>
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> calc_ln_two();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> constexpr unsigned_long_long_max();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> constexpr signed_long_long_min ();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> constexpr signed_long_long_max ();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> constexpr long_double_min ();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> constexpr long_double_max ();
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool (isnan) (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool (isfinite)(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool (isinf) (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> int sign (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> fabs (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> abs (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> floor (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> ceil (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> std::int32_t sgn (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> ldexp (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> v, int e);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> frexp (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> v, int* expon);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> fmod (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> v1, decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> v2);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> typename decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>::exponent_type ilogb (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> sqrt (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> cbrt (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> rootn (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x, std::int32_t p);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> rootn_inverse(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x, std::int32_t p);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> log (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> exp (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> pow (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x, const std::int64_t n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> pow (decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> x,
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> a);
#if !defined(WIDE_DECIMAL_DISABLE_IOSTREAM)
template<typename char_type, typename traits_type, const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> std::basic_ostream<char_type, traits_type>& operator<<(std::basic_ostream<char_type, traits_type>& os, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& f);
template<typename char_type, typename traits_type, const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> std::basic_istream<char_type, traits_type>& operator>>(std::basic_istream<char_type, traits_type>& is, decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& f);
#endif // !WIDE_DECIMAL_DISABLE_IOSTREAM
// Global unary operators of decwide_t reference.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> operator+(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& self);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> operator-(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& self);
// Global add/sub/mul/div of const decwide_t& with const decwide_t&.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> operator+(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> operator-(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> operator*(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType> operator/(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
// Global add/sub/mul/div of const decwide_t& with all built-in types.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
// Global add/sub/mul/div of all built-in types with const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>&.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+(const SignedIntegralType& n, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+(const UnsignedIntegralType& n, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+(const FloatingPointType& f, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType>
typename std::enable_if<(std::is_arithmetic<ArithmeticType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-(const ArithmeticType& n, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*(const SignedIntegralType& n, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*(const UnsignedIntegralType& n, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*(const FloatingPointType& f, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType>
typename std::enable_if<(std::is_arithmetic<ArithmeticType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/(const ArithmeticType& n, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u);
// Global self add/sub/mul/div of decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& with all built-in types.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator+=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator-=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator*=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename SignedIntegralType>
typename std::enable_if< (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_unsigned<SignedIntegralType>::value == false), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const SignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename UnsignedIntegralType>
typename std::enable_if< (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const UnsignedIntegralType& n);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename FloatingPointType>
typename std::enable_if<(std::is_floating_point<FloatingPointType>::value == true), decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>>::type operator/=(decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const FloatingPointType& f);
// Global comparison operators of const decwide_t& with const decwide_t&.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool operator< (const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool operator<=(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool operator==(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool operator!=(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool operator>=(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType> bool operator> (const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
// Global comparison operators of const decwide_t& with all built-in types.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator< (const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const ArithmeticType& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator<=(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const ArithmeticType& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator==(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const ArithmeticType& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator!=(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const ArithmeticType& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator>=(const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const ArithmeticType& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator> (const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& u, const ArithmeticType& v);
// Global comparison operators of all built-in types with const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>&.
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator< (ArithmeticType u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator<=(ArithmeticType u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator==(ArithmeticType u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator!=(ArithmeticType u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator>=(ArithmeticType u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10, typename LimbType, typename AllocatorType, typename InternalFloatType, typename ExponentType, typename FftFloatType, typename ArithmeticType> typename std::enable_if<std::is_arithmetic<ArithmeticType>::value == true, bool>::type operator> (ArithmeticType u, const decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>& v);
template<const std::int32_t MyDigits10,
typename LimbType,
typename AllocatorType,
typename InternalFloatType,
typename ExponentType,
typename FftFloatType>
class decwide_t
{
public:
// Define the decwide_t digits characteristics.
using exponent_type = ExponentType;
using fft_float_type = FftFloatType;
static_assert(( (std::is_same<std::int8_t, exponent_type>::value == true)
|| (std::is_same<std::int16_t, exponent_type>::value == true)
|| (std::is_same<std::int32_t, exponent_type>::value == true)
|| (std::is_same<std::int64_t, exponent_type>::value == true)),
"Error: exponent_type (template parameter ExponentType) "
"must be one of int8_t, int16_t, int32_t or int64_t.");
static constexpr std::int32_t decwide_t_digits10 = detail::decwide_t_helper<MyDigits10, LimbType>::digits10;
static constexpr std::int32_t decwide_t_digits = detail::decwide_t_helper<MyDigits10, LimbType>::digits;
static constexpr std::int32_t decwide_t_max_digits10 = detail::decwide_t_helper<MyDigits10, LimbType>::max_digits10;
static constexpr std::int32_t decwide_t_radix = detail::decwide_t_helper<MyDigits10, LimbType>::radix;
static constexpr std::int32_t decwide_t_elem_digits10 = detail::decwide_t_helper<MyDigits10, LimbType>::elem_digits10;
static constexpr std::int32_t decwide_t_elem_number = detail::decwide_t_helper<MyDigits10, LimbType>::elem_number;
static constexpr std::int32_t decwide_t_elem_mask = detail::decwide_t_helper<MyDigits10, LimbType>::elem_mask;
static constexpr std::int32_t decwide_t_elem_mask_half = detail::decwide_t_helper<MyDigits10, LimbType>::elem_mask_half;
static constexpr exponent_type decwide_t_max_exp10 = static_cast<exponent_type>(1) << (std::numeric_limits<exponent_type>::digits - ((std::is_same<exponent_type, std::int64_t>::value == true) ? 4 : ((std::is_same<exponent_type, std::int32_t>::value == true) ? 3 : ((std::is_same<exponent_type, std::int16_t>::value == true) ? 2 : 1))));
static constexpr exponent_type decwide_t_min_exp10 = -static_cast<exponent_type>(decwide_t_max_exp10);
static constexpr exponent_type decwide_t_max_exp = decwide_t_max_exp10;
static constexpr exponent_type decwide_t_min_exp = decwide_t_min_exp10;
static constexpr std::int32_t decwide_t_elems_for_kara = static_cast<std::int32_t>( 112 + 1);
static constexpr std::int32_t decwide_t_elems_for_fft = static_cast<std::int32_t>(1280 + 1);
// Obtain the limb_type from template parameter.
using limb_type = LimbType;
// Rebind the decwide_t allocator to the granularity of the LimbType.
using allocator_type =
typename std::allocator_traits<typename std::conditional<(std::is_same<AllocatorType, void>::value == true),
std::allocator<void>,
AllocatorType>::type>::template rebind_alloc<limb_type>;
// Define the array type, which is the internal
// representation of the data field of a decwide_t.
using representation_type =
typename std::conditional<(std::is_same<AllocatorType, void>::value == true),
detail::fixed_static_array <limb_type, static_cast<std::uint_fast32_t>(decwide_t_elem_number)>,
detail::fixed_dynamic_array<limb_type, static_cast<std::uint_fast32_t>(decwide_t_elem_number), allocator_type>>::type;
// Check thw width of the limb type.
static_assert(( (std::is_same<std::uint8_t, limb_type>::value == true)
|| (std::is_same<std::uint16_t, limb_type>::value == true)
|| (std::is_same<std::uint32_t, limb_type>::value == true)),
"Error: limb_type (template parameter LimbType) "
"must be one of uint8_t, uint16_t or uint32_t.");
using double_limb_type =
typename std::conditional<(std::is_same<limb_type, std::uint32_t>::value == true),
std::uint64_t,
typename std::conditional<(std::is_same<limb_type, std::uint16_t>::value == true),
std::uint32_t,
std::uint16_t>::type>::type;
using signed_limb_type =
typename std::conditional<(std::is_same<limb_type, std::uint32_t>::value == true),
std::int32_t,
typename std::conditional<(std::is_same<limb_type, std::uint16_t>::value == true),
std::int16_t,
std::int8_t>::type>::type;
using unsigned_exponent_type =
typename std::conditional<(std::is_same<exponent_type, std::int64_t>::value == true),
std::uint64_t,
typename std::conditional<(std::is_same<exponent_type, std::int32_t>::value == true),
std::uint32_t,
typename std::conditional<(std::is_same<exponent_type, std::int16_t>::value == true),
std::uint16_t,
std::uint8_t>::type>::type>::type;
typedef enum fpclass_type
{
decwide_t_finite
}
fpclass_type;
private:
template<typename native_float_type>
class native_float_parts final
{
public:
// Emphasize: This template class can be used with native floating-point
// types like float, double and long double. Note: For long double,
// you need to verify that the mantissa fits in unsigned long long.
native_float_parts(const native_float_type f)
: my_mantissa_part(0ULL),
my_exponent_part(0)
{
const native_float_type ff = ((f < static_cast<native_float_type>(0)) ? -f : f);
if(ff < (std::numeric_limits<native_float_type>::min)())
{
return;
}
using std::frexp;
// Get the fraction and base-2 exponent.
native_float_type man = (native_float_type) frexp(f, &my_exponent_part);
limb_type n2 = 0U;
for(std::uint_fast16_t i = static_cast<std::uint_fast16_t>(0U); i < static_cast<std::uint_fast16_t>(std::numeric_limits<native_float_type>::digits); ++i)
{
// Extract the mantissa of the floating-point type in base-2
// (one bit at a time) and store it in an unsigned long long.
man *= 2;
n2 = static_cast<limb_type>(man);
man -= static_cast<native_float_type>(n2);
if(n2 != static_cast<limb_type>(0U))
{
my_mantissa_part |= 1U;
}
if(i < static_cast<limb_type>(std::numeric_limits<native_float_type>::digits - 1))
{
my_mantissa_part <<= 1U;
}
}
// Ensure that the value is normalized and adjust the exponent.
my_mantissa_part |= static_cast<unsigned long long>(1ULL << (std::numeric_limits<native_float_type>::digits - 1));
my_exponent_part -= 1;
}
const unsigned long long& get_mantissa() const { return my_mantissa_part; }
const int& get_exponent() const { return my_exponent_part; }
private:
native_float_parts() = delete;
native_float_parts(const native_float_parts&) = delete;
const native_float_parts& operator=(const native_float_parts&) = delete;
unsigned long long my_mantissa_part;
int my_exponent_part;
};
#if !defined(WIDE_DECIMAL_DISABLE_CACHED_CONSTANTS)
// Static data initializer
struct initializer
{
initializer()
{
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>::my_value_pi ();
decwide_t<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>::my_value_ln_two();
}
void do_nothing() { }
};
static initializer init;
#endif
public:
// Default constructor.
constexpr decwide_t() : my_data (),
my_exp (static_cast<exponent_type>(0)),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number) { }
// Constructors from built-in unsigned integral types.
template<typename UnsignedIntegralType,
typename std::enable_if<( (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true)
&& (std::numeric_limits<UnsignedIntegralType>::digits <= std::numeric_limits<limb_type>::digits))>::type const* = nullptr>
constexpr decwide_t(const UnsignedIntegralType u)
: my_data
(
{
(u < decwide_t_elem_mask) ? u : u / (limb_type) decwide_t_elem_mask,
(u < decwide_t_elem_mask) ? limb_type(0U) : u % (limb_type) decwide_t_elem_mask
}
),
my_exp ((u < decwide_t_elem_mask) ? exponent_type(0) : exponent_type(decwide_t_elem_digits10)),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number) { }
// Constructors from built-in unsigned integral types.
template<typename UnsignedIntegralType,
typename std::enable_if<( (std::is_integral<UnsignedIntegralType>::value == true)
&& (std::is_unsigned<UnsignedIntegralType>::value == true)
&& (std::numeric_limits<limb_type>::digits) < std::numeric_limits<UnsignedIntegralType>::digits)>::type const* = nullptr>
decwide_t(const UnsignedIntegralType u) : my_data (),
my_exp (static_cast<exponent_type>(0)),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number)
{
from_unsigned_long_long(u);
}
// Constructors from built-in signed integral types.
template<typename SignedIntegralType,
typename std::enable_if<( (std::is_integral<SignedIntegralType>::value == true)
&& (std::is_signed <SignedIntegralType>::value == true))>::type const* = nullptr>
decwide_t(const SignedIntegralType n) : my_data (),
my_exp (static_cast<exponent_type>(0)),
my_neg (n < static_cast<signed long long>(0)),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number)
{
const unsigned long long u =
((my_neg == false) ? static_cast<unsigned long long>(n)
: detail::negate(static_cast<unsigned long long>(n)));
from_unsigned_long_long(u);
}
// Constructors from built-in floating-point types.
template<typename FloatingPointType,
typename std::enable_if<std::is_floating_point<FloatingPointType>::value == true>::type const* = nullptr>
decwide_t(const FloatingPointType f) : my_data (),
my_exp (static_cast<exponent_type>(0)),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number)
{
from_builtin_float_type(f);
}
#if !defined(WIDE_DECIMAL_DISABLE_CONSTRUCT_FROM_STRING)
// Constructors from character representations.
decwide_t(const char* s) : my_data (),
my_exp (static_cast<exponent_type>(0)),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number)
{
if(rd_string(s) == false)
{
std::fill(my_data.begin(), my_data.end(), static_cast<limb_type>(0U));
}
}
#endif // !WIDE_DECIMAL_DISABLE_CONSTRUCT_FROM_STRING
// Copy constructor.
constexpr decwide_t(const decwide_t& other) : my_data (other.my_data),
my_exp (other.my_exp),
my_neg (other.my_neg),
my_fpclass (other.my_fpclass),
my_prec_elem(other.my_prec_elem) { }
// Move constructor.
constexpr decwide_t(decwide_t&& other) : my_data ((representation_type&&) other.my_data),
my_exp (other.my_exp),
my_neg (other.my_neg),
my_fpclass (other.my_fpclass),
my_prec_elem(other.my_prec_elem) { }
// Constructor from floating-point class type, even though
// (at the moment) decwide_t instances can only be finite.
explicit constexpr decwide_t(const fpclass_type)
: my_data (),
my_exp (0),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number) { }
private:
// Constructor from mantissa and exponent.
explicit decwide_t(const InternalFloatType mantissa,
const exponent_type exponent)
: my_data (),
my_exp (static_cast<exponent_type>(0)),
my_neg (false),
my_fpclass (decwide_t_finite),
my_prec_elem(decwide_t_elem_number)
{
// Create a decwide_t from mantissa and exponent.
// This constructor is intended to maintain the
// full precision of the InternalFloatType.
using std::fabs;
const InternalFloatType close_to_zero =
( (std::numeric_limits<InternalFloatType>::min)()
* (InternalFloatType(1) + std::numeric_limits<InternalFloatType>::epsilon()));
const bool mantissa_is_iszero = (fabs(mantissa) < close_to_zero);
if(mantissa_is_iszero)
{
my_data.fill(static_cast<limb_type>(0));
if(exponent == static_cast<exponent_type>(0))
{
my_data[0U] = limb_type(1U);
}
}
else
{
const bool b_neg = (mantissa < InternalFloatType(0));
InternalFloatType d = ((!b_neg) ? mantissa : -mantissa);
exponent_type e = exponent;
constexpr InternalFloatType f10(10U);
while(d > f10) { d /= f10; ++e; }
while(d < InternalFloatType(1.0F)) { d *= f10; --e; }
{
std::int32_t shift = static_cast<std::int32_t>(e % static_cast<std::int32_t>(decwide_t_elem_digits10));
while(static_cast<std::int32_t>(shift % decwide_t_elem_digits10) != static_cast<std::int32_t>(0))
{
d *= f10;
--e;
--shift;
}
}
my_exp = e;
my_neg = b_neg;
constexpr std::int32_t digit_loops = static_cast<std::int32_t>( static_cast<std::int32_t>(std::numeric_limits<InternalFloatType>::max_digits10)
/ static_cast<std::int32_t>(decwide_t_elem_digits10))
+ static_cast<std::int32_t>(static_cast<std::int32_t>( static_cast<std::int32_t>(std::numeric_limits<InternalFloatType>::max_digits10)
% static_cast<std::int32_t>(decwide_t_elem_digits10)) != 0 ? 1 : 0);
typename representation_type::size_type limb_index;
for( limb_index = static_cast<typename representation_type::size_type>(0);
limb_index < static_cast<typename representation_type::size_type>(digit_loops);
++limb_index)
{
const limb_type n = static_cast<limb_type>(d);
my_data[limb_index] = static_cast<limb_type>(n);
d -= static_cast<InternalFloatType>(n);
d *= static_cast<InternalFloatType>(decwide_t_elem_mask);
}
std::fill(my_data.begin() + limb_index, my_data.end(), static_cast<limb_type>(0));
}
}
public:
~decwide_t() = default;
// Assignment operator.
decwide_t& operator=(const decwide_t& other)
{
if(this != &other)
{
my_data = other.my_data;
my_exp = other.my_exp;
my_neg = other.my_neg;
my_fpclass = other.my_fpclass;
my_prec_elem = other.my_prec_elem;
}
return *this;
}
// Move assignment operator.
decwide_t& operator=(decwide_t&& other)
{
my_data = (representation_type&&) other.my_data;
my_exp = other.my_exp;
my_neg = other.my_neg;
my_fpclass = other.my_fpclass;
my_prec_elem = other.my_prec_elem;
return *this;
}
representation_type& representation() { return my_data; }
const representation_type& representation() const { return my_data; }
const representation_type& crepresentation() const { return my_data; }
// Binary arithmetic operators.
decwide_t& operator+=(const decwide_t& v)
{
// TBD: Eliminate the temporary storage array my_n_data_for_add_sub.
// TBD: Limit the length of add/sub to only those ranges needed,
// whereby propagate borrow/carry may be necessary as well.
if(iszero())
{
return operator=(v);
}
const std::int32_t prec_elems_for_add_sub = (std::min)(my_prec_elem, v.my_prec_elem);
// Get the offset for the add/sub operation.
const exponent_type max_delta_exp =
static_cast<exponent_type>(prec_elems_for_add_sub * decwide_t_elem_digits10);
using local_unsigned_exponent_wrap_type = detail::unsigned_wrap<unsigned_exponent_type, exponent_type>;
local_unsigned_exponent_wrap_type u_exp( my_exp);
local_unsigned_exponent_wrap_type v_exp(v.my_exp);
const local_unsigned_exponent_wrap_type ofs_exp = (u_exp - v_exp);
// Check if the operation is out of range, requiring special handling.
if( v.iszero()
|| ((ofs_exp.get_is_neg() == false) && (ofs_exp.get_value_unsigned() >= (unsigned_exponent_type) max_delta_exp)))
{
// Result is *this unchanged since v is negligible compared to *this.
return *this;
}
else if((ofs_exp.get_is_neg() == true) && (ofs_exp.get_value_unsigned() >= (unsigned_exponent_type) max_delta_exp))
{
// Result is *this = v since *this is negligible compared to v.
return operator=(v);
}
// Do the add/sub operation.
typename representation_type::pointer p_u = my_data.data();
typename representation_type::const_pointer p_v = v.my_data.data();
bool b_copy = false;
const std::int32_t ofs = ((ofs_exp.get_is_neg() == false) ? +static_cast<std::int32_t>(ofs_exp.get_value_unsigned() / (unsigned_exponent_type) decwide_t_elem_digits10)
: -static_cast<std::int32_t>(ofs_exp.get_value_unsigned() / (unsigned_exponent_type) decwide_t_elem_digits10));
#if !defined(WIDE_DECIMAL_DISABLE_DYNAMIC_MEMORY_ALLOCATION)
representation_type my_n_data_for_add_sub;
#endif
if(my_neg == v.my_neg)
{
// Add v to *this, where the data array of either *this or v
// might have to be treated with a positive, negative or zero offset.
// The result is stored in *this. The data are added one element
// at a time, each element with carry.
if(ofs >= static_cast<std::int32_t>(0))
{
std::copy(v.my_data.cbegin(),
v.my_data.cend() - static_cast<std::ptrdiff_t>(ofs),
my_n_data_for_add_sub.begin() + static_cast<std::ptrdiff_t>(ofs));
std::fill(my_n_data_for_add_sub.begin(),
my_n_data_for_add_sub.begin() + static_cast<std::ptrdiff_t>(ofs),
static_cast<limb_type>(0));
p_v = my_n_data_for_add_sub.data();
}
else
{
std::copy(my_data.cbegin(),
my_data.cend() - static_cast<std::ptrdiff_t>(-ofs),
my_n_data_for_add_sub.begin() + static_cast<std::ptrdiff_t>(-ofs));
std::fill(my_n_data_for_add_sub.begin(),
my_n_data_for_add_sub.begin() + static_cast<std::ptrdiff_t>(-ofs),
static_cast<limb_type>(0));
p_u = my_n_data_for_add_sub.data();
b_copy = true;
}
// Addition.
const limb_type carry =
detail::eval_add_n(p_u,
typename std::add_const<limb_type*>::type(p_u),
typename std::add_const<limb_type*>::type(p_v),
prec_elems_for_add_sub);
if(b_copy)
{
std::copy(my_n_data_for_add_sub.cbegin(),
my_n_data_for_add_sub.cbegin() + prec_elems_for_add_sub,
my_data.begin());
my_exp = v.my_exp;
}
// There needs to be a carry into the element -1 of the array data
if(carry != static_cast<limb_type>(0U))
{
std::copy_backward(my_data.cbegin(),
my_data.cend() - static_cast<std::uint_fast32_t>((std::int32_t(my_data.size()) - prec_elems_for_add_sub) + 1),
my_data.end());
my_data[0U] = carry;
my_exp = static_cast<exponent_type>(my_exp + static_cast<exponent_type>(decwide_t_elem_digits10));
}
}
else
{
// Subtract v from *this, where the data array of either *this or v
// might have to be treated with a positive, negative or zero offset.
if( (ofs > static_cast<std::int32_t>(0))
|| ( (ofs == static_cast<std::int32_t>(0))
&& (detail::compare_ranges(my_data.data(), v.my_data.data(), static_cast<std::uint_fast32_t>(prec_elems_for_add_sub)) > 0)))
{
// In this case, |u| > |v| and ofs is positive.
// Copy the data of v, shifted down to a lower value
// into the data array m_n. Set the operand pointer p_v
// to point to the copied, shifted data m_n.
std::copy(v.my_data.cbegin(),
v.my_data.cend() - static_cast<std::ptrdiff_t>(ofs),
my_n_data_for_add_sub.begin() + static_cast<std::ptrdiff_t>(ofs));
std::fill(my_n_data_for_add_sub.begin(),
my_n_data_for_add_sub.begin() + static_cast<std::ptrdiff_t>(ofs),
static_cast<limb_type>(0));
p_v = my_n_data_for_add_sub.data();
}
else
{
if(ofs != static_cast<std::int32_t>(0))
{
// In this case, |u| < |v| and ofs is negative.
// Shift the data of u down to a lower value.
std::copy_backward(my_data.cbegin(),
my_data.cend() - static_cast<std::ptrdiff_t>(-ofs),
my_data.end());
std::fill(my_data.begin(),
my_data.begin() + static_cast<std::ptrdiff_t>(-ofs),
static_cast<limb_type>(0));
}
// Copy the data of v into the data array my_n_data_for_add_sub.
// Set the u-pointer p_u to point to m_n and the
// operand pointer p_v to point to the shifted
// data m_data.
std::copy(v.my_data.cbegin(),
v.my_data.cbegin() + prec_elems_for_add_sub,
my_n_data_for_add_sub.begin());
p_u = my_n_data_for_add_sub.data();
p_v = my_data.data();
b_copy = true;
}
// Subtraction.
const bool has_borrow =
detail::eval_subtract_n(p_u,
typename std::add_const<limb_type*>::type(p_u),
typename std::add_const<limb_type*>::type(p_v),
prec_elems_for_add_sub);
static_cast<void>(has_borrow);
if(b_copy)
{
std::copy(my_n_data_for_add_sub.cbegin(),
my_n_data_for_add_sub.cbegin() + prec_elems_for_add_sub,
my_data.begin());
my_exp = v.my_exp;
my_neg = v.my_neg;
}
// Is it necessary to justify the data?
const typename representation_type::const_iterator first_nonzero_elem =
std::find_if(my_data.cbegin(),
my_data.cbegin() + prec_elems_for_add_sub,
[](const limb_type& d) -> bool
{
return (d != static_cast<limb_type>(0U));
});
if(first_nonzero_elem != my_data.cbegin())
{
if(first_nonzero_elem == my_data.cbegin() + prec_elems_for_add_sub)
{
// This result of the subtraction is exactly zero (within precision).
// Reset the sign and the exponent.
my_neg = false;
my_exp = static_cast<exponent_type>(0);
}
else
{
// Justify the data
const std::ptrdiff_t sj =
static_cast<std::ptrdiff_t>(first_nonzero_elem - my_data.cbegin());
std::copy(my_data.cbegin() + static_cast<std::ptrdiff_t>(sj),
my_data.cend(),
my_data.begin());
std::fill(my_data.end() - static_cast<std::ptrdiff_t>(sj),
my_data.end(),
static_cast<limb_type>(0));
my_exp = static_cast<exponent_type>(my_exp - static_cast<exponent_type>(sj * static_cast<std::ptrdiff_t>(decwide_t_elem_digits10)));
}
}
// Check for underflow.
if(iszero())
{
*this = zero<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>();
}
}
return *this;
}
decwide_t& operator-=(const decwide_t& v)
{
// Use *this - v = -(-*this + v).
return (negate().operator+=(v)).negate();
}
decwide_t& operator*=(const decwide_t& v)
{
// Evaluate the sign of the result.
const bool b_result_is_neg = (my_neg != v.my_neg);
// Artificially set the sign of the result to be positive.
my_neg = false;
// Handle multiplication by zero.
if(iszero() || v.iszero())
{
*this = zero<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>();
}
else
{
// Set the exponent of the result.
using local_unsigned_wrap_type = detail::unsigned_wrap<unsigned_exponent_type, exponent_type>;
local_unsigned_wrap_type u_exp( my_exp);
local_unsigned_wrap_type v_exp(v.my_exp);
const local_unsigned_wrap_type result_exp = (u_exp + v_exp);
if((result_exp.get_is_neg() == false) && (result_exp.get_value_unsigned() >= decwide_t_max_exp10))
{
operator=(my_value_max());
}
else if((result_exp.get_is_neg() == true) && (result_exp.get_value_unsigned() >= decwide_t_max_exp10))
{
operator=(my_value_min());
}
else
{
my_exp =
static_cast<exponent_type>((result_exp.get_is_neg() == false)
? static_cast<exponent_type>(result_exp.get_value_unsigned())
: detail::negate(static_cast<exponent_type>(result_exp.get_value_unsigned())));
const std::int32_t prec_elems_for_multiply = (std::min)(my_prec_elem, v.my_prec_elem);
eval_mul_dispatch_multiplication_method(v, prec_elems_for_multiply);
}
}
// Set the sign of the result.
my_neg = b_result_is_neg;
return *this;
}
decwide_t& operator/=(const decwide_t& v)
{
const bool u_and_v_are_identical =
( (my_fpclass == v.my_fpclass)
&& (my_exp == v.my_exp)
&& (detail::compare_ranges(my_data.data(), v.my_data.data(), static_cast<std::uint_fast32_t>(decwide_t_elem_number)) == 0));
if(u_and_v_are_identical)
{
*this = one<MyDigits10, LimbType, AllocatorType, InternalFloatType, ExponentType, FftFloatType>();
if(my_neg != v.my_neg)
{
negate();
}
}
else
{
operator*=(decwide_t(v).calculate_inv());