@@ -599,39 +599,39 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
599
599
_Tp __bc = __b * __c;
600
600
_Tp __x = __ac - __bd;
601
601
_Tp __y = __ad + __bc;
602
- if (isnan (__x) && isnan (__y))
602
+ if (__libcpp_isnan (__x) && __libcpp_isnan (__y))
603
603
{
604
604
bool __recalc = false ;
605
- if (isinf (__a) || isinf (__b))
605
+ if (__libcpp_isinf (__a) || __libcpp_isinf (__b))
606
606
{
607
- __a = copysign (isinf (__a) ? _Tp (1 ) : _Tp (0 ), __a);
608
- __b = copysign (isinf (__b) ? _Tp (1 ) : _Tp (0 ), __b);
609
- if (isnan (__c))
607
+ __a = copysign (__libcpp_isinf (__a) ? _Tp (1 ) : _Tp (0 ), __a);
608
+ __b = copysign (__libcpp_isinf (__b) ? _Tp (1 ) : _Tp (0 ), __b);
609
+ if (__libcpp_isnan (__c))
610
610
__c = copysign (_Tp (0 ), __c);
611
- if (isnan (__d))
611
+ if (__libcpp_isnan (__d))
612
612
__d = copysign (_Tp (0 ), __d);
613
613
__recalc = true ;
614
614
}
615
- if (isinf (__c) || isinf (__d))
615
+ if (__libcpp_isinf (__c) || __libcpp_isinf (__d))
616
616
{
617
- __c = copysign (isinf (__c) ? _Tp (1 ) : _Tp (0 ), __c);
618
- __d = copysign (isinf (__d) ? _Tp (1 ) : _Tp (0 ), __d);
619
- if (isnan (__a))
617
+ __c = copysign (__libcpp_isinf (__c) ? _Tp (1 ) : _Tp (0 ), __c);
618
+ __d = copysign (__libcpp_isinf (__d) ? _Tp (1 ) : _Tp (0 ), __d);
619
+ if (__libcpp_isnan (__a))
620
620
__a = copysign (_Tp (0 ), __a);
621
- if (isnan (__b))
621
+ if (__libcpp_isnan (__b))
622
622
__b = copysign (_Tp (0 ), __b);
623
623
__recalc = true ;
624
624
}
625
- if (!__recalc && (isinf (__ac) || isinf (__bd) ||
626
- isinf (__ad) || isinf (__bc)))
625
+ if (!__recalc && (__libcpp_isinf (__ac) || __libcpp_isinf (__bd) ||
626
+ __libcpp_isinf (__ad) || __libcpp_isinf (__bc)))
627
627
{
628
- if (isnan (__a))
628
+ if (__libcpp_isnan (__a))
629
629
__a = copysign (_Tp (0 ), __a);
630
- if (isnan (__b))
630
+ if (__libcpp_isnan (__b))
631
631
__b = copysign (_Tp (0 ), __b);
632
- if (isnan (__c))
632
+ if (__libcpp_isnan (__c))
633
633
__c = copysign (_Tp (0 ), __c);
634
- if (isnan (__d))
634
+ if (__libcpp_isnan (__d))
635
635
__d = copysign (_Tp (0 ), __d);
636
636
__recalc = true ;
637
637
}
@@ -674,7 +674,7 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
674
674
_Tp __c = __w.real ();
675
675
_Tp __d = __w.imag ();
676
676
_Tp __logbw = logb (fmax (fabs (__c), fabs (__d)));
677
- if (isfinite (__logbw))
677
+ if (__libcpp_isfinite (__logbw))
678
678
{
679
679
__ilogbw = static_cast <int >(__logbw);
680
680
__c = scalbn (__c, -__ilogbw);
@@ -683,24 +683,24 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
683
683
_Tp __denom = __c * __c + __d * __d;
684
684
_Tp __x = scalbn ((__a * __c + __b * __d) / __denom, -__ilogbw);
685
685
_Tp __y = scalbn ((__b * __c - __a * __d) / __denom, -__ilogbw);
686
- if (isnan (__x) && isnan (__y))
686
+ if (__libcpp_isnan (__x) && __libcpp_isnan (__y))
687
687
{
688
- if ((__denom == _Tp (0 )) && (!isnan (__a) || !isnan (__b)))
688
+ if ((__denom == _Tp (0 )) && (!__libcpp_isnan (__a) || !__libcpp_isnan (__b)))
689
689
{
690
690
__x = copysign (_Tp (INFINITY), __c) * __a;
691
691
__y = copysign (_Tp (INFINITY), __c) * __b;
692
692
}
693
- else if ((isinf (__a) || isinf (__b)) && isfinite (__c) && isfinite (__d))
693
+ else if ((__libcpp_isinf (__a) || __libcpp_isinf (__b)) && __libcpp_isfinite (__c) && __libcpp_isfinite (__d))
694
694
{
695
- __a = copysign (isinf (__a) ? _Tp (1 ) : _Tp (0 ), __a);
696
- __b = copysign (isinf (__b) ? _Tp (1 ) : _Tp (0 ), __b);
695
+ __a = copysign (__libcpp_isinf (__a) ? _Tp (1 ) : _Tp (0 ), __a);
696
+ __b = copysign (__libcpp_isinf (__b) ? _Tp (1 ) : _Tp (0 ), __b);
697
697
__x = _Tp (INFINITY) * (__a * __c + __b * __d);
698
698
__y = _Tp (INFINITY) * (__b * __c - __a * __d);
699
699
}
700
- else if (isinf (__logbw) && __logbw > _Tp (0 ) && isfinite (__a) && isfinite (__b))
700
+ else if (__libcpp_isinf (__logbw) && __logbw > _Tp (0 ) && __libcpp_isfinite (__a) && __libcpp_isfinite (__b))
701
701
{
702
- __c = copysign (isinf (__c) ? _Tp (1 ) : _Tp (0 ), __c);
703
- __d = copysign (isinf (__d) ? _Tp (1 ) : _Tp (0 ), __d);
702
+ __c = copysign (__libcpp_isinf (__c) ? _Tp (1 ) : _Tp (0 ), __c);
703
+ __d = copysign (__libcpp_isinf (__d) ? _Tp (1 ) : _Tp (0 ), __d);
704
704
__x = _Tp (0 ) * (__a * __c + __b * __d);
705
705
__y = _Tp (0 ) * (__b * __c - __a * __d);
706
706
}
@@ -910,9 +910,9 @@ inline _LIBCPP_INLINE_VISIBILITY
910
910
_Tp
911
911
norm (const complex<_Tp>& __c)
912
912
{
913
- if (isinf (__c.real ()))
913
+ if (__libcpp_isinf (__c.real ()))
914
914
return abs (__c.real ());
915
- if (isinf (__c.imag ()))
915
+ if (__libcpp_isinf (__c.imag ()))
916
916
return abs (__c.imag ());
917
917
return __c.real () * __c.real () + __c.imag () * __c.imag ();
918
918
}
@@ -955,7 +955,7 @@ complex<_Tp>
955
955
proj (const complex<_Tp>& __c)
956
956
{
957
957
std::complex<_Tp> __r = __c;
958
- if (isinf (__c.real ()) || isinf (__c.imag ()))
958
+ if (__libcpp_isinf (__c.real ()) || __libcpp_isinf (__c.imag ()))
959
959
__r = complex<_Tp>(INFINITY, copysign (_Tp (0 ), __c.imag ()));
960
960
return __r;
961
961
}
@@ -969,7 +969,7 @@ typename enable_if
969
969
>::type
970
970
proj (_Tp __re)
971
971
{
972
- if (isinf (__re))
972
+ if (__libcpp_isinf (__re))
973
973
__re = abs (__re);
974
974
return complex<_Tp>(__re);
975
975
}
@@ -987,32 +987,31 @@ proj(_Tp __re)
987
987
return _ComplexType (__re);
988
988
}
989
989
990
-
991
990
// polar
992
991
993
992
template <class _Tp >
994
993
complex<_Tp>
995
994
polar (const _Tp& __rho, const _Tp& __theta = _Tp(0 ))
996
995
{
997
- if (isnan (__rho) || signbit (__rho))
996
+ if (__libcpp_isnan (__rho) || signbit (__rho))
998
997
return complex<_Tp>(_Tp (NAN), _Tp (NAN));
999
- if (isnan (__theta))
998
+ if (__libcpp_isnan (__theta))
1000
999
{
1001
- if (isinf (__rho))
1000
+ if (__libcpp_isinf (__rho))
1002
1001
return complex<_Tp>(__rho, __theta);
1003
1002
return complex<_Tp>(__theta, __theta);
1004
1003
}
1005
- if (isinf (__theta))
1004
+ if (__libcpp_isinf (__theta))
1006
1005
{
1007
- if (isinf (__rho))
1006
+ if (__libcpp_isinf (__rho))
1008
1007
return complex<_Tp>(__rho, _Tp (NAN));
1009
1008
return complex<_Tp>(_Tp (NAN), _Tp (NAN));
1010
1009
}
1011
1010
_Tp __x = __rho * cos (__theta);
1012
- if (isnan (__x))
1011
+ if (__libcpp_isnan (__x))
1013
1012
__x = 0 ;
1014
1013
_Tp __y = __rho * sin (__theta);
1015
- if (isnan (__y))
1014
+ if (__libcpp_isnan (__y))
1016
1015
__y = 0 ;
1017
1016
return complex<_Tp>(__x, __y);
1018
1017
}
@@ -1043,13 +1042,13 @@ template<class _Tp>
1043
1042
complex<_Tp>
1044
1043
sqrt (const complex<_Tp>& __x)
1045
1044
{
1046
- if (isinf (__x.imag ()))
1045
+ if (__libcpp_isinf (__x.imag ()))
1047
1046
return complex<_Tp>(_Tp (INFINITY), __x.imag ());
1048
- if (isinf (__x.real ()))
1047
+ if (__libcpp_isinf (__x.real ()))
1049
1048
{
1050
1049
if (__x.real () > _Tp (0 ))
1051
- return complex<_Tp>(__x.real (), isnan (__x.imag ()) ? __x.imag () : copysign (_Tp (0 ), __x.imag ()));
1052
- return complex<_Tp>(isnan (__x.imag ()) ? __x.imag () : _Tp (0 ), copysign (__x.real (), __x.imag ()));
1050
+ return complex<_Tp>(__x.real (), __libcpp_isnan (__x.imag ()) ? __x.imag () : copysign (_Tp (0 ), __x.imag ()));
1051
+ return complex<_Tp>(__libcpp_isnan (__x.imag ()) ? __x.imag () : _Tp (0 ), copysign (__x.real (), __x.imag ()));
1053
1052
}
1054
1053
return polar (sqrt (abs (__x)), arg (__x) / _Tp (2 ));
1055
1054
}
@@ -1061,21 +1060,21 @@ complex<_Tp>
1061
1060
exp (const complex<_Tp>& __x)
1062
1061
{
1063
1062
_Tp __i = __x.imag ();
1064
- if (isinf (__x.real ()))
1063
+ if (__libcpp_isinf (__x.real ()))
1065
1064
{
1066
1065
if (__x.real () < _Tp (0 ))
1067
1066
{
1068
- if (!isfinite (__i))
1067
+ if (!__libcpp_isfinite (__i))
1069
1068
__i = _Tp (1 );
1070
1069
}
1071
- else if (__i == 0 || !isfinite (__i))
1070
+ else if (__i == 0 || !__libcpp_isfinite (__i))
1072
1071
{
1073
- if (isinf (__i))
1072
+ if (__libcpp_isinf (__i))
1074
1073
__i = _Tp (NAN);
1075
1074
return complex<_Tp>(__x.real (), __i);
1076
1075
}
1077
1076
}
1078
- else if (isnan (__x.real ()) && __x.imag () == 0 )
1077
+ else if (__libcpp_isnan (__x.real ()) && __x.imag () == 0 )
1079
1078
return __x;
1080
1079
_Tp __e = exp (__x.real ());
1081
1080
return complex<_Tp>(__e * cos (__i), __e * sin (__i));
@@ -1133,23 +1132,23 @@ complex<_Tp>
1133
1132
asinh (const complex<_Tp>& __x)
1134
1133
{
1135
1134
const _Tp __pi (atan2 (+0 ., -0 .));
1136
- if (isinf (__x.real ()))
1135
+ if (__libcpp_isinf (__x.real ()))
1137
1136
{
1138
- if (isnan (__x.imag ()))
1137
+ if (__libcpp_isnan (__x.imag ()))
1139
1138
return __x;
1140
- if (isinf (__x.imag ()))
1139
+ if (__libcpp_isinf (__x.imag ()))
1141
1140
return complex<_Tp>(__x.real (), copysign (__pi * _Tp (0.25 ), __x.imag ()));
1142
1141
return complex<_Tp>(__x.real (), copysign (_Tp (0 ), __x.imag ()));
1143
1142
}
1144
- if (isnan (__x.real ()))
1143
+ if (__libcpp_isnan (__x.real ()))
1145
1144
{
1146
- if (isinf (__x.imag ()))
1145
+ if (__libcpp_isinf (__x.imag ()))
1147
1146
return complex<_Tp>(__x.imag (), __x.real ());
1148
1147
if (__x.imag () == 0 )
1149
1148
return __x;
1150
1149
return complex<_Tp>(__x.real (), __x.real ());
1151
1150
}
1152
- if (isinf (__x.imag ()))
1151
+ if (__libcpp_isinf (__x.imag ()))
1153
1152
return complex<_Tp>(copysign (__x.imag (), __x.real ()), copysign (__pi/_Tp (2 ), __x.imag ()));
1154
1153
complex<_Tp> __z = log (__x + sqrt (pow (__x, _Tp (2 )) + _Tp (1 )));
1155
1154
return complex<_Tp>(copysign (__z.real (), __x.real ()), copysign (__z.imag (), __x.imag ()));
@@ -1162,11 +1161,11 @@ complex<_Tp>
1162
1161
acosh (const complex<_Tp>& __x)
1163
1162
{
1164
1163
const _Tp __pi (atan2 (+0 ., -0 .));
1165
- if (isinf (__x.real ()))
1164
+ if (__libcpp_isinf (__x.real ()))
1166
1165
{
1167
- if (isnan (__x.imag ()))
1166
+ if (__libcpp_isnan (__x.imag ()))
1168
1167
return complex<_Tp>(abs (__x.real ()), __x.imag ());
1169
- if (isinf (__x.imag ()))
1168
+ if (__libcpp_isinf (__x.imag ()))
1170
1169
{
1171
1170
if (__x.real () > 0 )
1172
1171
return complex<_Tp>(__x.real (), copysign (__pi * _Tp (0.25 ), __x.imag ()));
@@ -1177,13 +1176,13 @@ acosh(const complex<_Tp>& __x)
1177
1176
return complex<_Tp>(-__x.real (), copysign (__pi, __x.imag ()));
1178
1177
return complex<_Tp>(__x.real (), copysign (_Tp (0 ), __x.imag ()));
1179
1178
}
1180
- if (isnan (__x.real ()))
1179
+ if (__libcpp_isnan (__x.real ()))
1181
1180
{
1182
- if (isinf (__x.imag ()))
1181
+ if (__libcpp_isinf (__x.imag ()))
1183
1182
return complex<_Tp>(abs (__x.imag ()), __x.real ());
1184
1183
return complex<_Tp>(__x.real (), __x.real ());
1185
1184
}
1186
- if (isinf (__x.imag ()))
1185
+ if (__libcpp_isinf (__x.imag ()))
1187
1186
return complex<_Tp>(abs (__x.imag ()), copysign (__pi/_Tp (2 ), __x.imag ()));
1188
1187
complex<_Tp> __z = log (__x + sqrt (pow (__x, _Tp (2 )) - _Tp (1 )));
1189
1188
return complex<_Tp>(copysign (__z.real (), _Tp (0 )), copysign (__z.imag (), __x.imag ()));
@@ -1196,21 +1195,21 @@ complex<_Tp>
1196
1195
atanh (const complex<_Tp>& __x)
1197
1196
{
1198
1197
const _Tp __pi (atan2 (+0 ., -0 .));
1199
- if (isinf (__x.imag ()))
1198
+ if (__libcpp_isinf (__x.imag ()))
1200
1199
{
1201
1200
return complex<_Tp>(copysign (_Tp (0 ), __x.real ()), copysign (__pi/_Tp (2 ), __x.imag ()));
1202
1201
}
1203
- if (isnan (__x.imag ()))
1202
+ if (__libcpp_isnan (__x.imag ()))
1204
1203
{
1205
- if (isinf (__x.real ()) || __x.real () == 0 )
1204
+ if (__libcpp_isinf (__x.real ()) || __x.real () == 0 )
1206
1205
return complex<_Tp>(copysign (_Tp (0 ), __x.real ()), __x.imag ());
1207
1206
return complex<_Tp>(__x.imag (), __x.imag ());
1208
1207
}
1209
- if (isnan (__x.real ()))
1208
+ if (__libcpp_isnan (__x.real ()))
1210
1209
{
1211
1210
return complex<_Tp>(__x.real (), __x.real ());
1212
1211
}
1213
- if (isinf (__x.real ()))
1212
+ if (__libcpp_isinf (__x.real ()))
1214
1213
{
1215
1214
return complex<_Tp>(copysign (_Tp (0 ), __x.real ()), copysign (__pi/_Tp (2 ), __x.imag ()));
1216
1215
}
@@ -1228,11 +1227,11 @@ template<class _Tp>
1228
1227
complex<_Tp>
1229
1228
sinh (const complex<_Tp>& __x)
1230
1229
{
1231
- if (isinf (__x.real ()) && !isfinite (__x.imag ()))
1230
+ if (__libcpp_isinf (__x.real ()) && !__libcpp_isfinite (__x.imag ()))
1232
1231
return complex<_Tp>(__x.real (), _Tp (NAN));
1233
- if (__x.real () == 0 && !isfinite (__x.imag ()))
1232
+ if (__x.real () == 0 && !__libcpp_isfinite (__x.imag ()))
1234
1233
return complex<_Tp>(__x.real (), _Tp (NAN));
1235
- if (__x.imag () == 0 && !isfinite (__x.real ()))
1234
+ if (__x.imag () == 0 && !__libcpp_isfinite (__x.real ()))
1236
1235
return __x;
1237
1236
return complex<_Tp>(sinh (__x.real ()) * cos (__x.imag ()), cosh (__x.real ()) * sin (__x.imag ()));
1238
1237
}
@@ -1243,13 +1242,13 @@ template<class _Tp>
1243
1242
complex<_Tp>
1244
1243
cosh (const complex<_Tp>& __x)
1245
1244
{
1246
- if (isinf (__x.real ()) && !isfinite (__x.imag ()))
1245
+ if (__libcpp_isinf (__x.real ()) && !__libcpp_isfinite (__x.imag ()))
1247
1246
return complex<_Tp>(abs (__x.real ()), _Tp (NAN));
1248
- if (__x.real () == 0 && !isfinite (__x.imag ()))
1247
+ if (__x.real () == 0 && !__libcpp_isfinite (__x.imag ()))
1249
1248
return complex<_Tp>(_Tp (NAN), __x.real ());
1250
1249
if (__x.real () == 0 && __x.imag () == 0 )
1251
1250
return complex<_Tp>(_Tp (1 ), __x.imag ());
1252
- if (__x.imag () == 0 && !isfinite (__x.real ()))
1251
+ if (__x.imag () == 0 && !__libcpp_isfinite (__x.real ()))
1253
1252
return complex<_Tp>(abs (__x.real ()), __x.imag ());
1254
1253
return complex<_Tp>(cosh (__x.real ()) * cos (__x.imag ()), sinh (__x.real ()) * sin (__x.imag ()));
1255
1254
}
@@ -1260,19 +1259,19 @@ template<class _Tp>
1260
1259
complex<_Tp>
1261
1260
tanh (const complex<_Tp>& __x)
1262
1261
{
1263
- if (isinf (__x.real ()))
1262
+ if (__libcpp_isinf (__x.real ()))
1264
1263
{
1265
- if (!isfinite (__x.imag ()))
1264
+ if (!__libcpp_isfinite (__x.imag ()))
1266
1265
return complex<_Tp>(_Tp (1 ), _Tp (0 ));
1267
1266
return complex<_Tp>(_Tp (1 ), copysign (_Tp (0 ), sin (_Tp (2 ) * __x.imag ())));
1268
1267
}
1269
- if (isnan (__x.real ()) && __x.imag () == 0 )
1268
+ if (__libcpp_isnan (__x.real ()) && __x.imag () == 0 )
1270
1269
return __x;
1271
1270
_Tp __2r (_Tp (2 ) * __x.real ());
1272
1271
_Tp __2i (_Tp (2 ) * __x.imag ());
1273
1272
_Tp __d (cosh (__2r) + cos (__2i));
1274
1273
_Tp __2rsh (sinh (__2r));
1275
- if (isinf (__2rsh) && isinf (__d))
1274
+ if (__libcpp_isinf (__2rsh) && __libcpp_isinf (__d))
1276
1275
return complex<_Tp>(__2rsh > _Tp (0 ) ? _Tp (1 ) : _Tp (-1 ),
1277
1276
__2i > _Tp (0 ) ? _Tp (0 ) : _Tp (-0 .));
1278
1277
return complex<_Tp>(__2rsh/__d, sin (__2i)/__d);
@@ -1295,11 +1294,11 @@ complex<_Tp>
1295
1294
acos (const complex<_Tp>& __x)
1296
1295
{
1297
1296
const _Tp __pi (atan2 (+0 ., -0 .));
1298
- if (isinf (__x.real ()))
1297
+ if (__libcpp_isinf (__x.real ()))
1299
1298
{
1300
- if (isnan (__x.imag ()))
1299
+ if (__libcpp_isnan (__x.imag ()))
1301
1300
return complex<_Tp>(__x.imag (), __x.real ());
1302
- if (isinf (__x.imag ()))
1301
+ if (__libcpp_isinf (__x.imag ()))
1303
1302
{
1304
1303
if (__x.real () < _Tp (0 ))
1305
1304
return complex<_Tp>(_Tp (0.75 ) * __pi, -__x.imag ());
@@ -1309,13 +1308,13 @@ acos(const complex<_Tp>& __x)
1309
1308
return complex<_Tp>(__pi, signbit (__x.imag ()) ? -__x.real () : __x.real ());
1310
1309
return complex<_Tp>(_Tp (0 ), signbit (__x.imag ()) ? __x.real () : -__x.real ());
1311
1310
}
1312
- if (isnan (__x.real ()))
1311
+ if (__libcpp_isnan (__x.real ()))
1313
1312
{
1314
- if (isinf (__x.imag ()))
1313
+ if (__libcpp_isinf (__x.imag ()))
1315
1314
return complex<_Tp>(__x.real (), -__x.imag ());
1316
1315
return complex<_Tp>(__x.real (), __x.real ());
1317
1316
}
1318
- if (isinf (__x.imag ()))
1317
+ if (__libcpp_isinf (__x.imag ()))
1319
1318
return complex<_Tp>(__pi/_Tp (2 ), -__x.imag ());
1320
1319
if (__x.real () == 0 && (__x.imag () == 0 || isnan (__x.imag ())))
1321
1320
return complex<_Tp>(__pi/_Tp (2 ), -__x.imag ());
0 commit comments