@@ -346,7 +346,7 @@ class cpp_bin_float
346
346
m_sign = false ;
347
347
m_exponent = 0 ;
348
348
349
- constexpr std::ptrdiff_t bits = sizeof (int ) * CHAR_BIT - 1 < MaxExponent - 1 ? sizeof (int ) * CHAR_BIT - 1 : 3 ;
349
+ constexpr std::ptrdiff_t bits = static_cast <Exponent>( sizeof (int ) * CHAR_BIT - 1 ) < MaxExponent - 1 ? sizeof (int ) * CHAR_BIT - 1 : 3 ;
350
350
int e;
351
351
f = frexpq (f, &e);
352
352
while (f)
@@ -416,6 +416,8 @@ class cpp_bin_float
416
416
m_sign = (f < 0 );
417
417
m_exponent = exponent_infinity;
418
418
return *this ;
419
+ default :
420
+ break ;
419
421
}
420
422
if (f < 0 )
421
423
{
@@ -494,6 +496,8 @@ class cpp_bin_float
494
496
m_sign = eval_get_sign (f) < 0 ;
495
497
m_exponent = exponent_infinity;
496
498
return *this ;
499
+ default :
500
+ break ;
497
501
}
498
502
if (eval_get_sign (f) < 0 )
499
503
{
@@ -805,6 +809,8 @@ inline void do_eval_add(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Mi
805
809
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_nan:
806
810
res = a;
807
811
return ; // result is still a NaN.
812
+ default :
813
+ break ;
808
814
}
809
815
switch (b.exponent ())
810
816
{
@@ -819,6 +825,8 @@ inline void do_eval_add(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Mi
819
825
case BinFloat3::exponent_nan:
820
826
res = b;
821
827
return ; // result is a NaN.
828
+ default :
829
+ break ;
822
830
}
823
831
824
832
static_assert ((std::numeric_limits<exponent_type>::max)() - cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count > cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::max_exponent, " Exponent range check failed" );
@@ -878,6 +886,8 @@ inline void do_eval_subtract(BinFloat1& res, const BinFloat2& a, const BinFloat3
878
886
case BinFloat2::exponent_nan:
879
887
res = a;
880
888
return ; // result is still a NaN.
889
+ default :
890
+ break ;
881
891
}
882
892
switch (b.exponent ())
883
893
{
@@ -892,6 +902,8 @@ inline void do_eval_subtract(BinFloat1& res, const BinFloat2& a, const BinFloat3
892
902
case BinFloat3::exponent_nan:
893
903
res = b;
894
904
return ; // result is still a NaN.
905
+ default :
906
+ break ;
895
907
}
896
908
897
909
bool s = a.sign ();
@@ -1043,6 +1055,8 @@ inline void eval_multiply(cpp_bin_float<Digits, DigitBase, Allocator, Exponent,
1043
1055
case cpp_bin_float<Digits, DigitBase, Allocator2, Exponent2, MinE2, MaxE2>::exponent_nan:
1044
1056
res = a;
1045
1057
return ;
1058
+ default :
1059
+ break ;
1046
1060
}
1047
1061
if (b.exponent () > cpp_bin_float<Digits, DigitBase, Allocator3, Exponent3, MinE3, MaxE3>::max_exponent)
1048
1062
{
@@ -1119,6 +1133,8 @@ inline typename std::enable_if<boost::multiprecision::detail::is_unsigned<U>::va
1119
1133
case cpp_bin_float<Digits, DigitBase, Allocator2, Exponent2, MinE2, MaxE2>::exponent_nan:
1120
1134
res = a;
1121
1135
return ;
1136
+ default :
1137
+ break ;
1122
1138
}
1123
1139
1124
1140
typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::double_rep_type dt;
@@ -1183,6 +1199,8 @@ inline void eval_divide(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Mi
1183
1199
case cpp_bin_float<Digits, DigitBase, Allocator3, Exponent3, MinE3, MaxE3>::exponent_nan:
1184
1200
res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > >::quiet_NaN ().backend ();
1185
1201
return ;
1202
+ default :
1203
+ break ;
1186
1204
}
1187
1205
bool s = u.sign () != v.sign ();
1188
1206
res = u;
@@ -1197,6 +1215,8 @@ inline void eval_divide(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Mi
1197
1215
case cpp_bin_float<Digits, DigitBase, Allocator3, Exponent3, MinE3, MaxE3>::exponent_nan:
1198
1216
res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > >::quiet_NaN ().backend ();
1199
1217
return ;
1218
+ default :
1219
+ break ;
1200
1220
}
1201
1221
bool s = u.sign () != v.sign ();
1202
1222
res = u;
@@ -1206,6 +1226,8 @@ inline void eval_divide(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Mi
1206
1226
case cpp_bin_float<Digits, DigitBase, Allocator2, Exponent2, MinE2, MaxE2>::exponent_nan:
1207
1227
res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > >::quiet_NaN ().backend ();
1208
1228
return ;
1229
+ default :
1230
+ break ;
1209
1231
}
1210
1232
switch (v.exponent ())
1211
1233
{
@@ -1224,6 +1246,8 @@ inline void eval_divide(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Mi
1224
1246
case cpp_bin_float<Digits, DigitBase, Allocator3, Exponent3, MinE3, MaxE3>::exponent_nan:
1225
1247
res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > >::quiet_NaN ().backend ();
1226
1248
return ;
1249
+ default :
1250
+ break ;
1227
1251
}
1228
1252
1229
1253
// We can scale u and v so that both are integers, then perform integer
@@ -1368,6 +1392,8 @@ inline typename std::enable_if<boost::multiprecision::detail::is_unsigned<U>::va
1368
1392
case cpp_bin_float<Digits, DigitBase, Allocator2, Exponent2, MinE2, MaxE2>::exponent_nan:
1369
1393
res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > >::quiet_NaN ().backend ();
1370
1394
return ;
1395
+ default :
1396
+ break ;
1371
1397
}
1372
1398
if (v == 0 )
1373
1399
{
@@ -1514,6 +1540,8 @@ inline void convert_to_signed_int(I* res, const cpp_bin_float<Digits, DigitBase,
1514
1540
if (arg.sign ())
1515
1541
*res = -*res;
1516
1542
return ;
1543
+ default :
1544
+ break ;
1517
1545
}
1518
1546
using shift_type = typename std::conditional<sizeof (typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type) < sizeof (int ), int , typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type>::type;
1519
1547
typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::rep_type man (arg.bits ());
@@ -1589,6 +1617,8 @@ inline void convert_to_unsigned_int(I* res, const cpp_bin_float<Digits, DigitBas
1589
1617
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_infinity:
1590
1618
*res = max_val;
1591
1619
return ;
1620
+ default :
1621
+ break ;
1592
1622
}
1593
1623
typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::rep_type man (arg.bits ());
1594
1624
using shift_type = typename std::conditional<sizeof (typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type) < sizeof (int ), int , typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type>::type;
@@ -1669,6 +1699,8 @@ inline typename std::enable_if<std::is_floating_point<Float>::value>::type eval_
1669
1699
if (original_arg.sign ())
1670
1700
*res = -*res;
1671
1701
return ;
1702
+ default :
1703
+ break ;
1672
1704
}
1673
1705
//
1674
1706
// Check for super large exponent that must be converted to infinity:
@@ -1740,6 +1772,8 @@ inline void eval_frexp(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Min
1740
1772
*e = 0 ;
1741
1773
res = arg;
1742
1774
return ;
1775
+ default :
1776
+ break ;
1743
1777
}
1744
1778
res = arg;
1745
1779
*e = arg.exponent () + 1 ;
@@ -1768,6 +1802,8 @@ inline void eval_ldexp(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Min
1768
1802
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_infinity:
1769
1803
res = arg;
1770
1804
return ;
1805
+ default :
1806
+ break ;
1771
1807
}
1772
1808
if ((e > 0 ) && (cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::max_exponent - e < arg.exponent ()))
1773
1809
{
@@ -1853,6 +1889,8 @@ inline int eval_fpclassify(const cpp_bin_float<Digits, DigitBase, Allocator, Exp
1853
1889
return FP_INFINITE;
1854
1890
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_nan:
1855
1891
return FP_NAN;
1892
+ default :
1893
+ break ;
1856
1894
}
1857
1895
return FP_NORMAL;
1858
1896
}
@@ -1880,6 +1918,8 @@ inline void eval_sqrt(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE
1880
1918
else
1881
1919
res = arg;
1882
1920
return ;
1921
+ default :
1922
+ break ;
1883
1923
}
1884
1924
if (arg.sign ())
1885
1925
{
@@ -1921,6 +1961,8 @@ inline void eval_floor(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, Min
1921
1961
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_infinity:
1922
1962
res = arg;
1923
1963
return ;
1964
+ default :
1965
+ break ;
1924
1966
}
1925
1967
using shift_type = typename std::conditional<sizeof (typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type) < sizeof (int ), int , typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type>::type;
1926
1968
shift_type shift =
@@ -1969,6 +2011,8 @@ inline void eval_ceil(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE
1969
2011
case cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_nan:
1970
2012
res = arg;
1971
2013
return ;
2014
+ default :
2015
+ break ;
1972
2016
}
1973
2017
using shift_type = typename std::conditional<sizeof (typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type) < sizeof (int ), int , typename cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::exponent_type>::type;
1974
2018
shift_type shift = (shift_type)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - arg.exponent () - 1 ;
0 commit comments