Changeset 96203 in vbox for trunk/src/VBox/Runtime/testcase/tstRTNoCrt-2.cpp
- Timestamp:
- Aug 14, 2022 3:27:49 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstRTNoCrt-2.cpp
r96198 r96203 33 33 #endif 34 34 35 #include <math.h>36 35 #include <float.h> 37 36 #include <limits.h> 37 #include <math.h> 38 38 39 39 #define IPRT_NO_CRT_FOR_3RD_PARTY … … 42 42 #define IPRT_INCLUDED_nocrt_limits_h /* prevent our limits from being included */ 43 43 #include <iprt/nocrt/stdlib.h> 44 #include <iprt/nocrt/fenv.h> /* Need to test fegetround and stuff. */ 44 45 45 46 #include <iprt/string.h> 46 47 #include <iprt/test.h> 48 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 49 # include <iprt/x86.h> 50 #endif 47 51 48 52 … … 295 299 RTTEST g_hTest; 296 300 char g_szFloat[2][128]; 301 302 303 #ifdef _MSC_VER 304 # pragma fenv_access(on) 305 #endif 297 306 298 307 … … 997 1006 998 1007 1008 void testTrunc() 1009 { 1010 RTTestSub(g_hTest, "trunc[f]"); 1011 CHECK_DBL(RT_NOCRT(trunc)( +0.0), +0.0); 1012 CHECK_DBL(RT_NOCRT(trunc)( -0.0), -0.0); 1013 CHECK_DBL(RT_NOCRT(trunc)( -42.0), -42.0); 1014 CHECK_DBL(RT_NOCRT(trunc)( -42.5), -42.0); 1015 CHECK_DBL(RT_NOCRT(trunc)( +42.5), +42.0); 1016 CHECK_DBL(RT_NOCRT(trunc)(-42.25), -42.0); 1017 CHECK_DBL(RT_NOCRT(trunc)(+42.25), +42.0); 1018 CHECK_DBL_SAME(trunc,( -0.0)); 1019 CHECK_DBL_SAME(trunc,( +0.0)); 1020 CHECK_DBL_SAME(trunc,( +42.25)); 1021 CHECK_DBL_SAME(trunc,(+1234.60958634e+10)); 1022 CHECK_DBL_SAME(trunc,(-1234.60958634e+10)); 1023 CHECK_DBL_SAME(trunc,( -1234.499999e+10)); 1024 CHECK_DBL_SAME(trunc,( -1234.499999e-10)); 1025 CHECK_DBL_SAME(trunc,( -2.1984e-310)); /* subnormal */ 1026 CHECK_DBL_SAME(trunc,(-INFINITY)); 1027 CHECK_DBL_SAME(trunc,(+INFINITY)); 1028 CHECK_DBL_SAME(trunc,(RTStrNanDouble(NULL, true))); 1029 CHECK_DBL_SAME(trunc,(RTStrNanDouble("s", false))); 1030 1031 CHECK_DBL(RT_NOCRT(truncf)( +0.0f), +0.0f); 1032 CHECK_DBL(RT_NOCRT(truncf)( -0.0f), -0.0f); 1033 CHECK_DBL(RT_NOCRT(truncf)( -42.0f), -42.0f); 1034 CHECK_DBL(RT_NOCRT(truncf)( -42.5f), -42.0f); 1035 CHECK_DBL(RT_NOCRT(truncf)( +42.5f), +42.0f); 1036 CHECK_DBL(RT_NOCRT(truncf)(-42.25f), -42.0f); 1037 CHECK_DBL(RT_NOCRT(truncf)(+42.25f), +42.0f); 1038 CHECK_DBL_SAME(truncf,( -0.0f)); 1039 CHECK_DBL_SAME(truncf,( +0.0f)); 1040 CHECK_DBL_SAME(truncf,( +42.25f)); 1041 CHECK_DBL_SAME(truncf,(+1234.60958634e+10f)); 1042 CHECK_DBL_SAME(truncf,(-1234.60958634e+10f)); 1043 CHECK_DBL_SAME(truncf,( -1234.499999e+10f)); 1044 CHECK_DBL_SAME(truncf,( -1234.499999e-10f)); 1045 CHECK_DBL_SAME(truncf,( -2.1984e-40f)); /* subnormal */ 1046 CHECK_DBL_SAME(truncf,(-INFINITY)); 1047 CHECK_DBL_SAME(truncf,(+INFINITY)); 1048 CHECK_DBL_SAME(truncf,(RTStrNanFloat(NULL, true))); 1049 CHECK_DBL_SAME(truncf,(RTStrNanFloat("s", false))); 1050 } 1051 1052 999 1053 void testRound() 1000 1054 { … … 1020 1074 CHECK_DBL_SAME(round,(RTStrNanDouble("s", false))); 1021 1075 1022 CHECK_DBL(RT_NOCRT(round)( +0.0f), +0.0f); 1023 CHECK_DBL(RT_NOCRT(round)( -0.0f), -0.0f); 1024 CHECK_DBL(RT_NOCRT(round)( -42.0f), -42.0f); 1025 CHECK_DBL(RT_NOCRT(round)( -42.5f), -43.0f); 1026 CHECK_DBL(RT_NOCRT(round)( +42.5f), +43.0f); 1027 CHECK_DBL(RT_NOCRT(round)(-42.25f), -42.0f); 1028 CHECK_DBL(RT_NOCRT(round)(+42.25f), +42.0f); 1029 CHECK_DBL_SAME(round,( -0.0f)); 1030 CHECK_DBL_SAME(round,( +0.0f)); 1031 CHECK_DBL_SAME(round,( +42.25f)); 1032 CHECK_DBL_SAME(round,(+1234.60958634e+10f)); 1033 CHECK_DBL_SAME(round,(-1234.60958634e+10f)); 1034 CHECK_DBL_SAME(round,( -1234.499999e+10f)); 1035 CHECK_DBL_SAME(round,( -1234.499999e-10f)); 1036 CHECK_DBL_SAME(round,( -2.1984e-40f)); /* subnormal */ 1037 CHECK_DBL_SAME(round,(-INFINITY)); 1038 CHECK_DBL_SAME(round,(+INFINITY)); 1039 CHECK_DBL_SAME(round,(RTStrNanFloat(NULL, true))); 1040 CHECK_DBL_SAME(round,(RTStrNanFloat("s", false))); 1076 CHECK_DBL(RT_NOCRT(roundf)( +0.0f), +0.0f); 1077 CHECK_DBL(RT_NOCRT(roundf)( -0.0f), -0.0f); 1078 CHECK_DBL(RT_NOCRT(roundf)( -42.0f), -42.0f); 1079 CHECK_DBL(RT_NOCRT(roundf)( -42.5f), -43.0f); 1080 CHECK_DBL(RT_NOCRT(roundf)( +42.5f), +43.0f); 1081 CHECK_DBL(RT_NOCRT(roundf)(-42.25f), -42.0f); 1082 CHECK_DBL(RT_NOCRT(roundf)(+42.25f), +42.0f); 1083 CHECK_DBL_SAME(roundf,( -0.0f)); 1084 CHECK_DBL_SAME(roundf,( +0.0f)); 1085 CHECK_DBL_SAME(roundf,( +42.25f)); 1086 CHECK_DBL_SAME(roundf,(+1234.60958634e+10f)); 1087 CHECK_DBL_SAME(roundf,(-1234.60958634e+10f)); 1088 CHECK_DBL_SAME(roundf,( -1234.499999e+10f)); 1089 CHECK_DBL_SAME(roundf,( -1234.499999e-10f)); 1090 CHECK_DBL_SAME(roundf,( -2.1984e-40f)); /* subnormal */ 1091 CHECK_DBL_SAME(roundf,(-INFINITY)); 1092 CHECK_DBL_SAME(roundf,(+INFINITY)); 1093 CHECK_DBL_SAME(roundf,(RTStrNanFloat(NULL, true))); 1094 CHECK_DBL_SAME(roundf,(RTStrNanFloat("s", false))); 1095 } 1096 1097 1098 void testRInt() 1099 { 1100 RTTestSub(g_hTest, "rint[f]"); 1101 1102 /* 1103 * Round nearest. 1104 */ 1105 #if defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86) 1106 AssertCompile(FE_TONEAREST == X86_FCW_RC_NEAREST); 1107 AssertCompile(FE_DOWNWARD == X86_FCW_RC_DOWN); 1108 AssertCompile(FE_UPWARD == X86_FCW_RC_UP); 1109 AssertCompile(FE_TOWARDZERO == X86_FCW_RC_ZERO); 1110 AssertCompile(_ROUND_MASK == X86_FCW_RC_MASK); 1111 #endif 1112 int const iSavedMode = RT_NOCRT(fegetround)(); 1113 RT_NOCRT(fesetround)(FE_TONEAREST); 1114 1115 CHECK_DBL(RT_NOCRT(rint)( +0.0), +0.0); 1116 CHECK_DBL(RT_NOCRT(rint)( -0.0), -0.0); 1117 CHECK_DBL(RT_NOCRT(rint)( -42.0), -42.0); 1118 CHECK_DBL(RT_NOCRT(rint)( -42.5), -42.0); 1119 CHECK_DBL(RT_NOCRT(rint)( +42.5), +42.0); 1120 CHECK_DBL(RT_NOCRT(rint)( -43.5), -44.0); 1121 CHECK_DBL(RT_NOCRT(rint)( +43.5), +44.0); 1122 CHECK_DBL(RT_NOCRT(rint)(-42.25), -42.0); 1123 CHECK_DBL(RT_NOCRT(rint)(+42.25), +42.0); 1124 CHECK_DBL(RT_NOCRT(rint)(-42.75), -43.0); 1125 CHECK_DBL(RT_NOCRT(rint)(+42.75), +43.0); 1126 CHECK_DBL_SAME(rint,( -0.0)); 1127 CHECK_DBL_SAME(rint,( +0.0)); 1128 CHECK_DBL_SAME(rint,( +42.25)); 1129 CHECK_DBL_SAME(rint,( +42.50)); 1130 CHECK_DBL_SAME(rint,( +42.75)); 1131 CHECK_DBL_SAME(rint,( -42.25)); 1132 CHECK_DBL_SAME(rint,( -42.50)); 1133 CHECK_DBL_SAME(rint,( -42.75)); 1134 CHECK_DBL_SAME(rint,(+1234.60958634e+10)); 1135 CHECK_DBL_SAME(rint,(-1234.60958634e+10)); 1136 CHECK_DBL_SAME(rint,( -1234.499999e+10)); 1137 CHECK_DBL_SAME(rint,( -1234.499999e-10)); 1138 CHECK_DBL_SAME(rint,( -2.1984e-310)); /* subnormal */ 1139 CHECK_DBL_SAME(rint,(-INFINITY)); 1140 CHECK_DBL_SAME(rint,(+INFINITY)); 1141 CHECK_DBL_SAME(rint,(RTStrNanDouble(NULL, true))); 1142 CHECK_DBL_SAME(rint,(RTStrNanDouble("s", false))); 1143 1144 CHECK_DBL(RT_NOCRT(rintf)( +0.0f), +0.0f); 1145 CHECK_DBL(RT_NOCRT(rintf)( -0.0f), -0.0f); 1146 CHECK_DBL(RT_NOCRT(rintf)( -42.0f), -42.0f); 1147 CHECK_DBL(RT_NOCRT(rintf)( -42.5f), -42.0f); 1148 CHECK_DBL(RT_NOCRT(rintf)( +42.5f), +42.0f); 1149 CHECK_DBL(RT_NOCRT(rintf)( -43.5f), -44.0f); 1150 CHECK_DBL(RT_NOCRT(rintf)( +43.5f), +44.0f); 1151 CHECK_DBL(RT_NOCRT(rintf)(-42.25f), -42.0f); 1152 CHECK_DBL(RT_NOCRT(rintf)(+42.25f), +42.0f); 1153 CHECK_DBL_SAME(rintf,( -0.0f)); 1154 CHECK_DBL_SAME(rintf,( +0.0f)); 1155 CHECK_DBL_SAME(rintf,( +42.25f)); 1156 CHECK_DBL_SAME(rintf,( +42.50f)); 1157 CHECK_DBL_SAME(rintf,( +42.75f)); 1158 CHECK_DBL_SAME(rintf,( -42.25f)); 1159 CHECK_DBL_SAME(rintf,( -42.50f)); 1160 CHECK_DBL_SAME(rintf,( -42.75f)); 1161 CHECK_DBL_SAME(rintf,(+1234.60958634e+10f)); 1162 CHECK_DBL_SAME(rintf,(-1234.60958634e+10f)); 1163 CHECK_DBL_SAME(rintf,( -1234.499999e+10f)); 1164 CHECK_DBL_SAME(rintf,( -1234.499999e-10f)); 1165 CHECK_DBL_SAME(rintf,( -2.1984e-40f)); /* subnormal */ 1166 CHECK_DBL_SAME(rintf,(-INFINITY)); 1167 CHECK_DBL_SAME(rintf,(+INFINITY)); 1168 CHECK_DBL_SAME(rintf,(RTStrNanFloat(NULL, true))); 1169 CHECK_DBL_SAME(rintf,(RTStrNanFloat("s", false))); 1170 1171 /* 1172 * Round UP. 1173 */ 1174 RT_NOCRT(fesetround)(FE_UPWARD); 1175 1176 CHECK_DBL(RT_NOCRT(rint)( +0.0), +0.0); 1177 CHECK_DBL(RT_NOCRT(rint)( -0.0), -0.0); 1178 CHECK_DBL(RT_NOCRT(rint)( -42.0), -42.0); 1179 CHECK_DBL(RT_NOCRT(rint)( -42.5), -42.0); 1180 CHECK_DBL(RT_NOCRT(rint)( +42.5), +43.0); 1181 CHECK_DBL(RT_NOCRT(rint)( -43.5), -43.0); 1182 CHECK_DBL(RT_NOCRT(rint)( +43.5), +44.0); 1183 CHECK_DBL(RT_NOCRT(rint)(-42.25), -42.0); 1184 CHECK_DBL(RT_NOCRT(rint)(+42.25), +43.0); 1185 CHECK_DBL(RT_NOCRT(rint)(-42.75), -42.0); 1186 CHECK_DBL(RT_NOCRT(rint)(+42.75), +43.0); 1187 CHECK_DBL_SAME(rint,( -0.0)); 1188 CHECK_DBL_SAME(rint,( +0.0)); 1189 CHECK_DBL_SAME(rint,( +42.25)); 1190 CHECK_DBL_SAME(rint,( +42.50)); 1191 CHECK_DBL_SAME(rint,( +42.75)); 1192 CHECK_DBL_SAME(rint,( -42.25)); 1193 CHECK_DBL_SAME(rint,( -42.50)); 1194 CHECK_DBL_SAME(rint,( -42.75)); 1195 CHECK_DBL_SAME(rint,(+1234.60958634e+10)); 1196 CHECK_DBL_SAME(rint,(-1234.60958634e+10)); 1197 CHECK_DBL_SAME(rint,( -1234.499999e+10)); 1198 CHECK_DBL_SAME(rint,( -1234.499999e-10)); 1199 CHECK_DBL_SAME(rint,( -2.1984e-310)); /* subnormal */ 1200 CHECK_DBL_SAME(rint,(-INFINITY)); 1201 CHECK_DBL_SAME(rint,(+INFINITY)); 1202 CHECK_DBL_SAME(rint,(RTStrNanDouble(NULL, true))); 1203 CHECK_DBL_SAME(rint,(RTStrNanDouble("s", false))); 1204 1205 CHECK_DBL(RT_NOCRT(rintf)( +0.0f), +0.0f); 1206 CHECK_DBL(RT_NOCRT(rintf)( -0.0f), -0.0f); 1207 CHECK_DBL(RT_NOCRT(rintf)( -42.0f), -42.0f); 1208 CHECK_DBL(RT_NOCRT(rintf)( -42.5f), -42.0f); 1209 CHECK_DBL(RT_NOCRT(rintf)( +42.5f), +43.0f); 1210 CHECK_DBL(RT_NOCRT(rintf)( -43.5f), -43.0f); 1211 CHECK_DBL(RT_NOCRT(rintf)( +43.5f), +44.0f); 1212 CHECK_DBL(RT_NOCRT(rintf)(-42.25f), -42.0f); 1213 CHECK_DBL(RT_NOCRT(rintf)(+42.25f), +43.0f); 1214 CHECK_DBL_SAME(rintf,( -0.0f)); 1215 CHECK_DBL_SAME(rintf,( +0.0f)); 1216 CHECK_DBL_SAME(rintf,( +42.25f)); 1217 CHECK_DBL_SAME(rintf,( +42.50f)); 1218 CHECK_DBL_SAME(rintf,( +42.75f)); 1219 CHECK_DBL_SAME(rintf,( -42.25f)); 1220 CHECK_DBL_SAME(rintf,( -42.50f)); 1221 CHECK_DBL_SAME(rintf,( -42.75f)); 1222 CHECK_DBL_SAME(rintf,(+1234.60958634e+10f)); 1223 CHECK_DBL_SAME(rintf,(-1234.60958634e+10f)); 1224 CHECK_DBL_SAME(rintf,( -1234.499999e+10f)); 1225 CHECK_DBL_SAME(rintf,( -1234.499999e-10f)); 1226 CHECK_DBL_SAME(rintf,( -2.1984e-40f)); /* subnormal */ 1227 CHECK_DBL_SAME(rintf,(-INFINITY)); 1228 CHECK_DBL_SAME(rintf,(+INFINITY)); 1229 CHECK_DBL_SAME(rintf,(RTStrNanFloat(NULL, true))); 1230 CHECK_DBL_SAME(rintf,(RTStrNanFloat("s", false))); 1231 1232 /* 1233 * Round DOWN. 1234 */ 1235 RT_NOCRT(fesetround)(FE_DOWNWARD); 1236 1237 CHECK_DBL(RT_NOCRT(rint)( +0.0), +0.0); 1238 CHECK_DBL(RT_NOCRT(rint)( -0.0), -0.0); 1239 CHECK_DBL(RT_NOCRT(rint)( -42.0), -42.0); 1240 CHECK_DBL(RT_NOCRT(rint)( -42.5), -43.0); 1241 CHECK_DBL(RT_NOCRT(rint)( +42.5), +42.0); 1242 CHECK_DBL(RT_NOCRT(rint)( -43.5), -44.0); 1243 CHECK_DBL(RT_NOCRT(rint)( +43.5), +43.0); 1244 CHECK_DBL(RT_NOCRT(rint)(-42.25), -43.0); 1245 CHECK_DBL(RT_NOCRT(rint)(+42.25), +42.0); 1246 CHECK_DBL(RT_NOCRT(rint)(-42.75), -43.0); 1247 CHECK_DBL(RT_NOCRT(rint)(+42.75), +42.0); 1248 CHECK_DBL_SAME(rint,( -0.0)); 1249 CHECK_DBL_SAME(rint,( +0.0)); 1250 CHECK_DBL_SAME(rint,( +42.25)); 1251 CHECK_DBL_SAME(rint,( +42.50)); 1252 CHECK_DBL_SAME(rint,( +42.75)); 1253 CHECK_DBL_SAME(rint,( -42.25)); 1254 CHECK_DBL_SAME(rint,( -42.50)); 1255 CHECK_DBL_SAME(rint,( -42.75)); 1256 CHECK_DBL_SAME(rint,(+1234.60958634e+10)); 1257 CHECK_DBL_SAME(rint,(-1234.60958634e+10)); 1258 CHECK_DBL_SAME(rint,( -1234.499999e+10)); 1259 CHECK_DBL_SAME(rint,( -1234.499999e-10)); 1260 CHECK_DBL_SAME(rint,( -2.1984e-310)); /* subnormal */ 1261 CHECK_DBL_SAME(rint,(-INFINITY)); 1262 CHECK_DBL_SAME(rint,(+INFINITY)); 1263 CHECK_DBL_SAME(rint,(RTStrNanDouble(NULL, true))); 1264 CHECK_DBL_SAME(rint,(RTStrNanDouble("s", false))); 1265 1266 CHECK_DBL(RT_NOCRT(rintf)( +0.0f), +0.0f); 1267 CHECK_DBL(RT_NOCRT(rintf)( -0.0f), -0.0f); 1268 CHECK_DBL(RT_NOCRT(rintf)( -42.0f), -42.0f); 1269 CHECK_DBL(RT_NOCRT(rintf)( -42.5f), -43.0f); 1270 CHECK_DBL(RT_NOCRT(rintf)( +42.5f), +42.0f); 1271 CHECK_DBL(RT_NOCRT(rintf)( -43.5f), -44.0f); 1272 CHECK_DBL(RT_NOCRT(rintf)( +43.5f), +43.0f); 1273 CHECK_DBL(RT_NOCRT(rintf)(-42.25f), -43.0f); 1274 CHECK_DBL(RT_NOCRT(rintf)(+42.25f), +42.0f); 1275 CHECK_DBL_SAME(rintf,( -0.0f)); 1276 CHECK_DBL_SAME(rintf,( +0.0f)); 1277 CHECK_DBL_SAME(rintf,( +42.25f)); 1278 CHECK_DBL_SAME(rintf,( +42.50f)); 1279 CHECK_DBL_SAME(rintf,( +42.75f)); 1280 CHECK_DBL_SAME(rintf,( -42.25f)); 1281 CHECK_DBL_SAME(rintf,( -42.50f)); 1282 CHECK_DBL_SAME(rintf,( -42.75f)); 1283 CHECK_DBL_SAME(rintf,(+1234.60958634e+10f)); 1284 CHECK_DBL_SAME(rintf,(-1234.60958634e+10f)); 1285 CHECK_DBL_SAME(rintf,( -1234.499999e+10f)); 1286 CHECK_DBL_SAME(rintf,( -1234.499999e-10f)); 1287 CHECK_DBL_SAME(rintf,( -2.1984e-40f)); /* subnormal */ 1288 CHECK_DBL_SAME(rintf,(-INFINITY)); 1289 CHECK_DBL_SAME(rintf,(+INFINITY)); 1290 CHECK_DBL_SAME(rintf,(RTStrNanFloat(NULL, true))); 1291 CHECK_DBL_SAME(rintf,(RTStrNanFloat("s", false))); 1292 1293 /* 1294 * Round towards ZERO. 1295 */ 1296 RT_NOCRT(fesetround)(FE_TOWARDZERO); 1297 1298 CHECK_DBL(RT_NOCRT(rint)( +0.0), +0.0); 1299 CHECK_DBL(RT_NOCRT(rint)( -0.0), -0.0); 1300 CHECK_DBL(RT_NOCRT(rint)( -42.0), -42.0); 1301 CHECK_DBL(RT_NOCRT(rint)( -42.5), -42.0); 1302 CHECK_DBL(RT_NOCRT(rint)( +42.5), +42.0); 1303 CHECK_DBL(RT_NOCRT(rint)( -43.5), -43.0); 1304 CHECK_DBL(RT_NOCRT(rint)( +43.5), +43.0); 1305 CHECK_DBL(RT_NOCRT(rint)(-42.25), -42.0); 1306 CHECK_DBL(RT_NOCRT(rint)(+42.25), +42.0); 1307 CHECK_DBL(RT_NOCRT(rint)(-42.75), -42.0); 1308 CHECK_DBL(RT_NOCRT(rint)(+42.75), +42.0); 1309 CHECK_DBL_SAME(rint,( -0.0)); 1310 CHECK_DBL_SAME(rint,( +0.0)); 1311 CHECK_DBL_SAME(rint,( +42.25)); 1312 CHECK_DBL_SAME(rint,( +42.50)); 1313 CHECK_DBL_SAME(rint,( +42.75)); 1314 CHECK_DBL_SAME(rint,( -42.25)); 1315 CHECK_DBL_SAME(rint,( -42.50)); 1316 CHECK_DBL_SAME(rint,( -42.75)); 1317 CHECK_DBL_SAME(rint,(+1234.60958634e+10)); 1318 CHECK_DBL_SAME(rint,(-1234.60958634e+10)); 1319 CHECK_DBL_SAME(rint,( -1234.499999e+10)); 1320 CHECK_DBL_SAME(rint,( -1234.499999e-10)); 1321 CHECK_DBL_SAME(rint,( -2.1984e-310)); /* subnormal */ 1322 CHECK_DBL_SAME(rint,(-INFINITY)); 1323 CHECK_DBL_SAME(rint,(+INFINITY)); 1324 CHECK_DBL_SAME(rint,(RTStrNanDouble(NULL, true))); 1325 CHECK_DBL_SAME(rint,(RTStrNanDouble("s", false))); 1326 1327 CHECK_DBL(RT_NOCRT(rintf)( +0.0f), +0.0f); 1328 CHECK_DBL(RT_NOCRT(rintf)( -0.0f), -0.0f); 1329 CHECK_DBL(RT_NOCRT(rintf)( -42.0f), -42.0f); 1330 CHECK_DBL(RT_NOCRT(rintf)( -42.5f), -42.0f); 1331 CHECK_DBL(RT_NOCRT(rintf)( +42.5f), +42.0f); 1332 CHECK_DBL(RT_NOCRT(rintf)( -43.5f), -43.0f); 1333 CHECK_DBL(RT_NOCRT(rintf)( +43.5f), +43.0f); 1334 CHECK_DBL(RT_NOCRT(rintf)(-42.25f), -42.0f); 1335 CHECK_DBL(RT_NOCRT(rintf)(+42.25f), +42.0f); 1336 CHECK_DBL_SAME(rintf,( -0.0f)); 1337 CHECK_DBL_SAME(rintf,( +0.0f)); 1338 CHECK_DBL_SAME(rintf,( +42.25f)); 1339 CHECK_DBL_SAME(rintf,( +42.50f)); 1340 CHECK_DBL_SAME(rintf,( +42.75f)); 1341 CHECK_DBL_SAME(rintf,( -42.25f)); 1342 CHECK_DBL_SAME(rintf,( -42.50f)); 1343 CHECK_DBL_SAME(rintf,( -42.75f)); 1344 CHECK_DBL_SAME(rintf,(+1234.60958634e+10f)); 1345 CHECK_DBL_SAME(rintf,(-1234.60958634e+10f)); 1346 CHECK_DBL_SAME(rintf,( -1234.499999e+10f)); 1347 CHECK_DBL_SAME(rintf,( -1234.499999e-10f)); 1348 CHECK_DBL_SAME(rintf,( -2.1984e-40f)); /* subnormal */ 1349 CHECK_DBL_SAME(rintf,(-INFINITY)); 1350 CHECK_DBL_SAME(rintf,(+INFINITY)); 1351 CHECK_DBL_SAME(rintf,(RTStrNanFloat(NULL, true))); 1352 CHECK_DBL_SAME(rintf,(RTStrNanFloat("s", false))); 1353 1354 RT_NOCRT(fesetround)(iSavedMode); 1041 1355 } 1042 1356 … … 1245 1559 return rcExit; 1246 1560 1561 /* Some preconditions: */ 1562 RTFLOAT32U r32; 1563 r32.r = RTStrNanFloat("s", false); 1564 RTTEST_CHECK(g_hTest, RTFLOAT32U_IS_SIGNALLING_NAN(&r32)); 1565 r32.r = RTStrNanFloat("q", false); 1566 RTTEST_CHECK(g_hTest, RTFLOAT32U_IS_QUIET_NAN(&r32)); 1567 r32.r = RTStrNanFloat(NULL, false); 1568 RTTEST_CHECK(g_hTest, RTFLOAT32U_IS_QUIET_NAN(&r32)); 1569 1570 RTFLOAT64U r64; 1571 r64.r = RTStrNanDouble("s", false); 1572 RTTEST_CHECK(g_hTest, RTFLOAT64U_IS_SIGNALLING_NAN(&r64)); 1573 r64.r = RTStrNanDouble("q", false); 1574 RTTEST_CHECK(g_hTest, RTFLOAT64U_IS_QUIET_NAN(&r64)); 1575 r64.r = RTStrNanDouble(NULL, false); 1576 RTTEST_CHECK(g_hTest, RTFLOAT64U_IS_QUIET_NAN(&r64)); 1577 1247 1578 /* stdlib.h (integer) */ 1248 1579 testAbs(); … … 1262 1593 testCeil(); 1263 1594 testFloor(); 1595 testTrunc(); 1264 1596 testRound(); 1597 testRInt(); 1265 1598 testLRound(); 1266 1599 testLLRound(); … … 1278 1611 ../common/math/fabs.asm \ 1279 1612 ../common/math/fabsf.asm \ 1280 ../common/math/fma-asm.asm \1281 ../common/math/fmaf-asm.asm \1282 1613 ../common/math/ldexp.asm \ 1283 1614 ../common/math/ldexpf.asm \ … … 1298 1629 ../common/math/tan.asm \ 1299 1630 ../common/math/tanf.asm \ 1300 ../common/math/trunc.asm \ 1301 ../common/math/truncf.asm 1631 1302 1632 #endif 1303 1633 1304 1305 1634 return RTTestSummaryAndDestroy(g_hTest); 1306 1635 }
Note:
See TracChangeset
for help on using the changeset viewer.