Ticket #1210: inf_nan.patch
File inf_nan.patch, 17.1 KB (added by bubaflub, 12 years ago) |
---|
-
t/op/inf_nan.t
diff --git t/op/inf_nan.t t/op/inf_nan.t index 2b590b8..e0e1ade 100644
1 #! p erl2 # Copyright (C) 200 9, Parrot Foundation.1 #! parrot 2 # Copyright (C) 2001-2009, Parrot Foundation. 3 3 # $Id$ 4 4 5 use strict;6 use warnings;7 use lib qw( . lib ../lib ../../lib );8 9 use Test::More;10 use Parrot::Test tests => 32;11 12 5 =head1 NAME 13 6 14 7 t/op/inf_nan.t - Test math properties of Inf and NaN … … 23 16 24 17 =cut 25 18 26 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - basic arith" ); 27 .sub 'test' :main 19 .sub main :main 20 .include 'test_more.pir' 21 plan(105) 22 23 test_basic_arith() 24 test_exp() 25 test_sqrt() 26 test_sin() 27 test_sinh() 28 test_asin() 29 test_cos() 30 test_cosh() 31 test_acos() 32 test_tan() 33 test_tanh() 34 test_atan() 35 test_cot() 36 test_coth() 37 test_acot() 38 test_sec() 39 test_sech() 40 test_asec() 41 test_ln() 42 test_log10() 43 test_log2() 44 test_neg() 45 test_pow() 46 test_mix_nan_inf() 47 test_rounding_n() 48 test_rounding_i() 49 test_nan_complex() 50 test_fdiv_integer_pmc_nan() 51 test_fdiv_float_pmc_nan() 52 test_fdiv_float_integer_pmc_nan() 53 test_cmod_float_integer_pmc_nan() 54 test_mod_float_integer_pmc_nan() 55 56 .end 57 58 .sub test_basic_arith 28 59 $N0 = 'Inf' 29 say $N060 is($N0, 'Inf', 'basic arithmetic: =') 30 61 $N0 -= $N0 31 say $N062 is($N0, 'NaN', '... -=') 32 63 $N0 *= -1 33 say $N064 is($N0, 'NaN', '... *= -1') 34 65 $N0 *= 0 35 say $N066 is($N0, 'NaN', '... *= 0') 36 67 $N0 += 5 37 say $N068 is($N0, 'NaN', '... += 5') 38 69 $N0 -= 42 39 say $N070 is($N0, 'NaN', '... -= 42') 40 71 inc $N0 41 say $N072 is($N0, 'NaN', '... inc') 42 73 dec $N0 43 say $N074 is($N0, 'NaN', '... dec') 44 75 $N2 = abs $N0 45 say $N276 is($N2, 'NaN', '... abs NaN') 46 77 $N1 = 'Inf' 47 78 $N3 = abs $N1 48 say $N379 is($N3, 'Inf', '... abs Inf') 49 80 $N1 = '-Inf' 50 81 $N3 = abs $N1 51 say $N3 52 .end 53 CODE 54 Inf 55 NaN 56 NaN 57 NaN 58 NaN 59 NaN 60 NaN 61 NaN 62 NaN 63 Inf 64 Inf 65 OUTPUT 66 67 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - exp" ); 68 .sub 'test' :main 82 is($N3, 'Inf', '... abs -Inf') 83 .end 84 85 86 .sub test_exp 69 87 $N0 = 'Inf' 70 88 $N1 = exp $N0 71 say $N189 is($N1, 'Inf', 'exp: exp Inf') 72 90 $N0 = '-Inf' 73 91 $N1 = exp $N0 74 say $N192 is($N1, 0, '... exp -Inf') 75 93 $N0 = 'NaN' 76 94 $N1 = exp $N0 77 say $N195 is($N1, 'NaN', '... exp NaN') 78 96 .end 79 CODE80 Inf81 082 NaN83 OUTPUT84 97 85 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sqrt" ); 86 .sub 'test' :main 98 .sub test_sqrt 87 99 $N0 = 'Inf' 88 100 $N1 = $N0 89 say $N1101 is($N1, 'Inf', 'sqrt: assignment') 90 102 $N0 = '-Inf' 91 103 $N1 = sqrt $N0 92 say $N1104 is($N1, 'NaN', '... sqrt -Inf') 93 105 $N0 = 'NaN' 94 106 $N1 = sqrt $N0 95 say $N1107 is($N1, 'NaN', '... sqrt NaN') 96 108 $N0 = -1 97 109 $N1 = sqrt $N0 98 say $N1110 is($N1, 'NaN', '... sqrt -1') 99 111 .end 100 CODE101 Inf102 NaN103 NaN104 NaN105 OUTPUT106 112 107 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sin" ); 108 .sub 'test' :main 113 .sub test_sin 109 114 $N0 = 'Inf' 110 115 $N1 = sin $N0 111 say $N1116 is($N1, 'NaN', 'sin: sin Inf') 112 117 $N0 = '-Inf' 113 118 $N1 = sin $N0 114 say $N1119 is($N1, 'NaN', '... sin -Inf') 115 120 $N0 = 'NaN' 116 121 $N1 = sin $N0 117 say $N1122 is($N1, 'NaN', '... sin NaN') 118 123 .end 119 CODE120 NaN121 NaN122 NaN123 OUTPUT124 124 125 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sinh" ); 126 .sub 'test' :main 125 .sub test_sinh 127 126 $N0 = 'Inf' 128 127 $N1 = sinh $N0 129 say $N1128 is($N1, 'Inf', 'sinh: sinh Inf') 130 129 $N0 = '-Inf' 131 130 $N1 = sinh $N0 132 say $N1131 is($N1, '-Inf', '... sinh -Inf') 133 132 $N0 = 'NaN' 134 133 $N1 = sinh $N0 135 say $N1134 is($N1, 'NaN', '... sinh NaN') 136 135 .end 137 CODE138 Inf139 -Inf140 NaN141 OUTPUT142 136 143 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - asin" ); 144 .sub 'test' :main 137 .sub test_asin 145 138 $N0 = 'Inf' 146 139 $N1 = asin $N0 147 say $N1140 is($N1, 'NaN', 'asin: asin Inf') 148 141 $N0 = '-Inf' 149 142 $N1 = asin $N0 150 say $N1143 is($N1, 'NaN', '... asin -Inf') 151 144 $N0 = 'NaN' 152 145 $N1 = asin $N0 153 say $N1146 is($N1, 'NaN', '... asin NaN') 154 147 $N0 = '-2' 155 148 $N1 = asin $N0 156 say $N1149 is($N1, 'NaN', '... asin -2') 157 150 $N0 = '2' 158 151 $N1 = asin $N0 159 say $N1 160 .end 161 CODE 162 NaN 163 NaN 164 NaN 165 NaN 166 NaN 167 OUTPUT 168 169 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - cos" ); 170 .sub 'test' :main 152 is($N1, 'NaN', '... asin 2') 153 .end 154 155 .sub test_cos 171 156 $N0 = 'Inf' 172 157 $N1 = cos $N0 173 say $N1158 is($N1, 'NaN', 'cos: cos Inf') 174 159 $N0 = '-Inf' 175 160 $N1 = cos $N0 176 say $N1161 is($N1, 'NaN', '... cos -Inf') 177 162 $N0 = 'NaN' 178 163 $N1 = cos $N0 179 say $N1164 is($N1, 'NaN', '... cos NaN') 180 165 .end 181 CODE182 NaN183 NaN184 NaN185 OUTPUT186 166 187 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - cosh" ); 188 .sub 'test' :main 167 .sub test_cosh 189 168 $N0 = 'Inf' 190 169 $N1 = cosh $N0 191 say $N1170 is($N1, 'Inf', 'cosh: cosh Inf') 192 171 $N0 = '-Inf' 193 172 $N1 = cosh $N0 194 say $N1173 is($N1, 'Inf', '... cosh -Inf') 195 174 $N0 = 'NaN' 196 175 $N1 = cosh $N0 197 say $N1176 is($N1, 'NaN', '... cosh NaN') 198 177 .end 199 CODE200 Inf201 Inf202 NaN203 OUTPUT204 178 205 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - acos" ); 206 .sub 'test' :main 179 .sub test_acos 207 180 $N0 = 'Inf' 208 181 $N1 = acos $N0 209 say $N1182 is($N1, 'NaN', 'acos: acos Inf') 210 183 $N0 = '-Inf' 211 184 $N1 = acos $N0 212 say $N1185 is($N1, 'NaN', '... acos -Inf') 213 186 $N0 = 'NaN' 214 187 $N1 = acos $N0 215 say $N1188 is($N1, 'NaN', '... acos NaN') 216 189 $N0 = '-2' 217 190 $N1 = acos $N0 218 say $N1191 is($N1, 'NaN', '... acos -2') 219 192 $N0 = '2' 220 193 $N1 = acos $N0 221 say $N1 222 .end 223 CODE 224 NaN 225 NaN 226 NaN 227 NaN 228 NaN 229 OUTPUT 230 231 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - tan" ); 232 .sub 'test' :main 194 is($N1, 'NaN', '... acos 2') 195 .end 196 197 .sub test_tan 233 198 $N0 = 'Inf' 234 199 $N1 = tan $N0 235 say $N1200 is($N1, 'NaN', 'tan: tan Inf') 236 201 $N0 = '-Inf' 237 202 $N1 = tan $N0 238 say $N1203 is($N1, 'NaN', '... tan -Inf') 239 204 $N0 = 'NaN' 240 205 $N1 = tan $N0 241 say $N1206 is($N1, 'NaN', '... tan NaN') 242 207 .end 243 CODE244 NaN245 NaN246 NaN247 OUTPUT248 208 249 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - tanh" ); 250 .sub 'test' :main 209 .sub test_tanh 251 210 $N0 = 'Inf' 252 211 $N1 = tanh $N0 253 say $N1212 is($N1, 1, 'tanh: tanh Inf') 254 213 $N0 = '-Inf' 255 214 $N1 = tanh $N0 256 say $N1215 is($N1, -1, '... tanh -Inf') 257 216 $N0 = 'NaN' 258 217 $N1 = tanh $N0 259 say $N1218 is($N1, 'NaN', '... tanh NaN') 260 219 .end 261 CODE262 1263 -1264 NaN265 OUTPUT266 220 267 pir_output_like( <<'CODE',qr/^1.5707963.*^-1.5707963.*^NaN/ms,"Inf/NaN - atan" ); 268 .sub 'test' :main 221 .sub test_atan 269 222 $N0 = 'Inf' 270 223 $N1 = atan $N0 271 say $N1224 like($N1,'1\.5707963.*', 'atan: atan Inf') 272 225 $N0 = '-Inf' 273 226 $N1 = atan $N0 274 say $N1227 like($N1, '\-1\.5707963.*', '... atan -Inf') 275 228 $N0 = 'NaN' 276 229 $N1 = atan $N0 277 say $N1230 is($N1, 'NaN', '... atan NaN') 278 231 .end 279 CODE280 232 281 { 282 local $TODO = 'cot/coth/acot not implemented for real numbers'; 283 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - cot" ); 284 .sub 'test' :main 233 .sub test_cot 285 234 $N0 = 'Inf' 286 $N1 = cot $N0 287 say $N1 235 #$N1 = cot $N0 236 #is($N1, 'NaN', 'cot: cot Inf') 237 todo(0, 'cot Inf', 'cot/coth/acot not implemented for real numbers') 288 238 $N0 = '-Inf' 289 $N1 = cot $N0 290 say $N1 239 #$N1 = cot $N0 240 #is($N1, 'NaN', '... cot -Inf') 241 todo(0, 'cot -Inf', 'cot/coth/acot not implemented for real numbers') 291 242 $N0 = 'NaN' 292 $N1 = cot $N0 293 say $N1 243 #$N1 = cot $N0 244 #is($N1, 'NaN', '... cot NaN') 245 todo(0, 'cot NaN', 'cot/coth/acot not implemented for real numbers') 294 246 .end 295 CODE296 NaN297 NaN298 NaN299 OUTPUT300 247 301 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - coth" ); 302 .sub 'test' :main 248 .sub test_coth 303 249 $N0 = 'Inf' 304 $N1 = coth $N0 305 say $N1 250 #$N1 = coth $N0 251 #is($N1, 1, 'coth: coth Inf') 252 todo(0, 'coth Inf', 'cot/coth/acot not implemented for real numbers') 306 253 $N0 = '-Inf' 307 $N1 = coth $N0 308 say $N1 254 #$N1 = coth $N0 255 #is($N1, -1, '... coth -Inf') 256 todo(0, 'coth -Inf', 'cot/coth/acot not implemented for real numbers') 309 257 $N0 = 'NaN' 310 $N1 = coth $N0 311 say $N1 258 #$N1 = coth $N0 259 #is($N1, 'NaN', '... coth NaN') 260 todo(0, 'coth NaN', 'cot/coth/acot not implemented for real numbers') 312 261 .end 313 CODE314 1315 -1316 NaN317 OUTPUT318 262 319 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - acot" ); 320 .sub 'test' :main 263 .sub test_acot 321 264 $N0 = 'Inf' 322 $N1 = acot $N0 323 say $N1 265 #$N1 = acot $N0 266 #is($N1, 'NaN', 'acot: acot Inf') 267 todo(0, 'acot Inf', 'cot/coth/acot not implemented for real numbers') 324 268 $N0 = '-Inf' 325 $N1 = acot $N0 326 say $N1 269 #$N1 = acot $N0 270 #is($N1, 'NaN', '... acot -Inf') 271 todo(0, 'acot -Inf', 'cot/coth/acot not implemented for real numbers') 327 272 $N0 = 'NaN' 328 $N1 = acot $N0 329 say $N1 273 #$N1 = acot $N0 274 #is($N1, 'NaN', '... acot NaN') 275 todo(0, 'acot NaN', 'cot/coth/acot not implemented for real numbers') 330 276 $N0 = '-2' 331 $N1 = acot $N0 332 say $N1 277 #$N1 = acot $N0 278 #is($N1, 'NaN', '... acot -2') 279 todo(0, 'acot -2', 'cot/coth/acot not implemented for real numbers') 333 280 $N0 = '2' 334 $N1 = acot $N0 335 say $N1 336 .end 337 CODE 338 NaN 339 NaN 340 NaN 341 NaN 342 NaN 343 OUTPUT 344 } 345 346 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sec" ); 347 .sub 'test' :main 281 #$N1 = acot $N0 282 #is($N1, 'NaN', '... acot 2') 283 todo(0, 'acot 2', 'cot/coth/acot not implemented for real numbers') 284 .end 285 286 .sub test_sec 348 287 $N0 = 'Inf' 349 288 $N1 = sec $N0 350 say $N1289 is($N1, 'NaN', 'sec: sec Inf') 351 290 $N0 = '-Inf' 352 291 $N1 = sec $N0 353 say $N1292 is($N1, 'NaN', '... sec -Inf') 354 293 $N0 = 'NaN' 355 294 $N1 = sec $N0 356 say $N1295 is($N1, 'NaN', '... sec NaN') 357 296 .end 358 CODE359 NaN360 NaN361 NaN362 OUTPUT363 297 364 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sech" ); 365 .sub 'test' :main 298 .sub test_sech 366 299 $N0 = 'Inf' 367 300 $N1 = sech $N0 368 say $N1301 is($N1, 0, 'sech: sech Inf') 369 302 $N0 = '-Inf' 370 303 $N1 = sech $N0 371 say $N1304 is($N1, 0, '... sech -Inf') 372 305 $N0 = 'NaN' 373 306 $N1 = sech $N0 374 say $N1307 is($N1, 'NaN', '... sech NaN') 375 308 .end 376 CODE377 0378 0379 NaN380 OUTPUT381 309 382 pir_output_like( <<'CODE',qr/^1.5707963.*^1.5707963.*^NaN/ms,"Inf/NaN - asec" ); 383 .sub 'test' :main 310 .sub test_asec 384 311 $N0 = 'Inf' 385 312 $N1 = asec $N0 386 say $N1313 like($N1, '1\.5707963.*', 'asec: asec Inf') 387 314 $N0 = '-Inf' 388 315 $N1 = asec $N0 389 say $N1316 like($N1, '1\.5707963.*', '... asec -Inf') 390 317 $N0 = 'NaN' 391 318 $N1 = asec $N0 392 say $N1319 is($N1, 'NaN', 'asec NaN') 393 320 .end 394 CODE395 396 321 397 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - ln" ); 398 .sub 'test' :main 322 .sub test_ln 399 323 $N0 = 'Inf' 400 324 $N1 = ln $N0 401 say $N1325 is($N1, 'Inf', 'ln: ln Inf') 402 326 $N0 = '-Inf' 403 327 $N1 = ln $N0 404 say $N1328 is($N1, 'NaN', '... ln Inf') 405 329 $N0 = 'NaN' 406 330 $N1 = ln $N0 407 say $N1331 is($N1, 'NaN', '... ln NaN') 408 332 .end 409 CODE410 Inf411 NaN412 NaN413 OUTPUT414 333 415 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - log10" ); 416 .sub 'test' :main 334 .sub test_log10 417 335 $N0 = 'Inf' 418 336 $N1 = log10 $N0 419 say $N1337 is($N1, 'Inf', 'log10: log10 Inf') 420 338 $N0 = '-Inf' 421 339 $N1 = log10 $N0 422 say $N1340 is($N1, 'NaN', '... log10 -Inf') 423 341 $N0 = 'NaN' 424 342 $N1 = log10 $N0 425 say $N1343 is($N1, 'NaN', '... log10 NaN') 426 344 .end 427 CODE428 Inf429 NaN430 NaN431 OUTPUT432 345 433 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - log2" ); 434 .sub 'test' :main 346 .sub test_log2 435 347 $N0 = 'Inf' 436 348 $N1 = log2 $N0 437 say $N1349 is($N1, 'Inf', 'log2: log2 Inf') 438 350 $N0 = '-Inf' 439 351 $N1 = log2 $N0 440 say $N1352 is($N1, 'NaN', '... log2 -Inf') 441 353 $N0 = 'NaN' 442 354 $N1 = log2 $N0 443 say $N1355 is($N1, 'NaN', '... log2 -Inf') 444 356 .end 445 CODE446 Inf447 NaN448 NaN449 OUTPUT450 357 451 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - neg" ); 452 .sub 'test' :main 358 .sub test_neg 453 359 $N0 = 'Inf' 454 360 $N1 = neg $N0 455 say $N1361 is($N1, '-Inf', 'negative: neg Inf') 456 362 $N0 = '-Inf' 457 363 $N1 = neg $N0 458 say $N1364 is($N1, 'Inf', '... neg -Inf') 459 365 $N0 = 'NaN' 460 366 $N1 = neg $N0 461 say $N1367 is($N1, 'NaN', '... neg NaN') 462 368 .end 463 CODE464 -Inf465 Inf466 NaN467 OUTPUT468 369 469 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - pow" ); 470 .sub 'test' :main 370 .sub test_pow 471 371 $N0 = 'Inf' 472 372 pow $N1, $N0, 2 473 say $N1373 is($N1, 'Inf', 'pow: Inf ^ 2') 474 374 pow $N1, 2, $N0 475 say $N1375 is($N1, 'Inf', '...: 2 ^ Inf') 476 376 $N0 = 'NaN' 477 377 pow $N1, $N0, 2 478 say $N1378 is($N1, 'NaN', '...: NaN ^ 2') 479 379 pow $N1, 2, $N0 480 say $N1380 is($N1, 'NaN', '...: 2 ^ NaN') 481 381 .end 482 CODE483 Inf484 Inf485 NaN486 NaN487 OUTPUT488 382 489 pir_output_is( <<'CODE', <<OUTPUT, "Mixing NaN and Inf should give NaN" ); 490 .sub 'test' :main 383 .sub test_mix_nan_inf 491 384 $N0 = 'NaN' 492 385 $N1 = 'Inf' 493 386 $N0 *= $N1 494 say $N0387 is($N0, 'NaN', 'mixing NaN and Inf: NaN * Inf') 495 388 $N0 /= $N1 496 say $N0389 is($N0, 'NaN', '... NaN / Inf') 497 390 $N0 -= $N1 498 say $N0391 is($N0, 'NaN', '... NaN - Inf') 499 392 $N0 += $N1 500 say $N0393 is($N0, 'NaN', '... NaN + Inf') 501 394 .end 502 CODE503 NaN504 NaN505 NaN506 NaN507 OUTPUT508 395 509 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - rounding" ); 510 .sub 'test' :main 396 .sub test_rounding_n 511 397 $N0 = 'NaN' 512 398 $N1 = floor $N0 513 say $N1399 is($N1, 'NaN', 'rounding n: floor NaN') 514 400 $N2 = ceil $N0 515 say $N2401 is($N2, 'NaN', '... ceil NaN') 516 402 $N0 = 'Inf' 517 403 $N1 = floor $N0 518 say $N1404 is($N1, 'Inf', '... floor Inf') 519 405 $N2 = ceil $N0 520 say $N2406 is($N2, 'Inf', '... ceil Inf') 521 407 $N0 = '-Inf' 522 408 $N1 = floor $N0 523 say $N1409 is($N1, '-Inf', '... floor -Inf') 524 410 $N2 = ceil $N0 525 say $N2 526 .end 527 CODE 528 NaN 529 NaN 530 Inf 531 Inf 532 -Inf 533 -Inf 534 OUTPUT 535 536 TODO: { 537 538 local $TODO = 'rounding nan/inf gives something like -2147483648'; 539 pir_output_is(<<'CODE',<<OUTPUT, "TT #370 Rounding inf/nan"); 540 .sub 'main' 541 $N0 = 'Inf' 542 $I0 = floor $N0 543 say $I0 544 $N0 = 'NaN' 545 $I0 = floor $N0 546 say $I0 547 $N0 = 'Inf' 548 $I0 = ceil $N0 549 say $I0 550 $N0 = 'NaN' 551 $I0 = ceil $N0 552 say $I0 553 .end 554 CODE 555 Inf 556 NaN 557 Inf 558 NaN 559 OUTPUT 560 561 } 562 563 TODO: { 564 local $TODO = '1+i + NaN should be NaN'; 565 pir_output_is(<<'CODE',<<OUTPUT,"Adding NaN to a Complex"); 566 .sub main 411 is($N2, '-Inf', '... ceil -Inf') 412 .end 413 414 #pir_output_is(<<'CODE',<<OUTPUT, "TT #370 Rounding inf/nan"); 415 .sub test_rounding_i 416 $N0 = 'Inf' 417 $I0 = floor $N0 418 #is($I0, 'Inf', 'floor Inf') 419 todo(0, 'floor Inf', 'rounding nan/inf gives something like -2147483648') 420 $N0 = 'NaN' 421 $I0 = floor $N0 422 #is($I0, 'NaN', 'floor Inf') 423 todo(0, 'floor NaN', 'rounding nan/inf gives something like -2147483648') 424 $N0 = 'Inf' 425 $I0 = ceil $N0 426 #is($I0, 'Inf', 'floor Inf') 427 todo(0, 'ceil Inf', 'rounding nan/inf gives something like -2147483648') 428 $N0 = 'NaN' 429 $I0 = ceil $N0 430 #is($I0, 'NaN', 'floor Inf') 431 todo(0, 'ceil NaN', 'rounding nan/inf gives something like -2147483648') 432 .end 433 434 .sub test_nan_complex 567 435 $P1 = new ["Complex"] 568 436 $N0 = 'NaN' 569 437 set $P1, "1 + i" 570 438 $P1 += $N0 571 say $P1 439 #is($P1, 'NaN', '1+i + NaN') 440 todo(0, '1+i + NaN should be NaN') 572 441 .end 573 CODE574 NaN575 OUTPUT576 }577 442 578 { 579 local $TODO = 'fdiv/mod/cmod do not play nicely with PMCs and NaN'; 580 pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Integer PMCs and NaN'); 581 .sub main 443 .sub test_fdiv_integer_pmc_nan 582 444 $P1 = new "Integer" 583 445 $P2 = new "Integer" 584 446 $P2 = 1 585 447 $N0 = 'NaN' 586 448 fdiv $P1, $P2, $N0 587 say $P1 449 #is($P1, 'NaN', 'fdiv with Integer PMCs and NaN') 450 todo(0, 'fdiv with Integer PMCs and NaN', 'fdiv/mod/cmod do not play nicely with PMCs and NaN') 588 451 .end 589 CODE590 NaN591 OUTPUT592 452 593 pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Float PMCs and NaN'); 594 .sub main 453 .sub test_fdiv_float_pmc_nan 595 454 $P1 = new 'Float' 596 455 $P2 = new 'Float' 597 456 $P2 = 1 598 457 $N0 = 'NaN' 599 458 fdiv $P1, $P2, $N0 600 say $P1 459 #is($P1, 'NaN','fdiv with Float PMCs and NaN') 460 todo(0,'fdiv with Float PMCs and NaN', 'fdiv/mod/cmod do not play nicely with PMCs and NaN') 601 461 .end 602 CODE603 NaN604 OUTPUT605 462 606 pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Float and Integer PMCs and NaN'); 607 .sub main 463 .sub test_fdiv_float_integer_pmc_nan 608 464 $P1 = new 'Float' 609 465 $P2 = new 'Integer' 610 466 $P2 = 1 611 467 $N0 = 'NaN' 612 468 fdiv $P1, $P2, $N0 613 say $P1 469 #is($P1, 'NaN', 'fdiv with Float and Integer PMCs and NaN') 470 todo(0, 'fdiv with Float and Integer PMCs and NaN', 'fdiv/mod/cmod do not play nicely with PMCs and NaN') 614 471 .end 615 CODE616 NaN617 OUTPUT618 472 619 pir_output_is(<<'CODE',<<OUTPUT,'cmod with Float and Integer PMCs and NaN'); 620 .sub main 473 .sub test_cmod_float_integer_pmc_nan 621 474 $P1 = new 'Float' 622 475 $P2 = new 'Integer' 623 476 $P2 = 1 624 477 $N0 = 'NaN' 625 478 cmod $P1, $P2, $N0 626 say $P1 479 #is($P1, 'NaN', 'cmod with Float and Integer PMCs and NaN') 480 todo(0, 'cmod with Float and Integer PMCs and NaN', 'fdiv/mod/cmod do not play nicely with PMCs and NaN') 627 481 .end 628 CODE629 NaN630 OUTPUT631 482 632 pir_output_is(<<'CODE',<<OUTPUT,'mod with Float and Integer PMCs and NaN'); 633 .sub main 483 .sub test_mod_float_integer_pmc_nan 634 484 $P1 = new 'Float' 635 485 $P2 = new 'Integer' 636 486 $P2 = 1 637 487 $N0 = 'NaN' 638 488 mod $P1, $P2, $N0 639 say $P1 489 #is($P1, 'NaN', 'mod with Float and Integer PMCs and NaN') 490 todo(0, 'mod with Float and Integer PMCs and NaN', 'fdiv/mod/cmod do not play nicely with PMCs and NaN') 640 491 .end 641 CODE642 NaN643 OUTPUT644 }645 492 646 493 # Local Variables: 647 494 # mode: cperl 648 495 # cperl-indent-level: 4 649 496 # fill-column: 100 650 497 # End: 651 # vim: expandtab shiftwidth=4: 652 498 # vim: expandtab shiftwidth=4 filetype=pir: