Ticket #1210: inf_nan.patch

File inf_nan.patch, 17.1 KB (added by bubaflub, 12 years ago)

t/op/inf_nan.t patch

  • t/op/inf_nan.t

    diff --git t/op/inf_nan.t t/op/inf_nan.t
    index 2b590b8..e0e1ade 100644
     
    1 #! perl 
    2 # Copyright (C) 2009, Parrot Foundation. 
     1#! parrot 
     2# Copyright (C) 2001-2009, Parrot Foundation. 
    33# $Id$ 
    44 
    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  
    125=head1 NAME 
    136 
    147t/op/inf_nan.t - Test math properties of Inf and NaN 
     
    2316 
    2417=cut 
    2518 
    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 
    2859    $N0 = 'Inf' 
    29     say $N0 
     60    is($N0, 'Inf', 'basic arithmetic: =') 
    3061    $N0 -= $N0 
    31     say $N0 
     62    is($N0, 'NaN', '... -=') 
    3263    $N0 *= -1 
    33     say $N0 
     64    is($N0, 'NaN', '... *= -1') 
    3465    $N0 *= 0 
    35     say $N0 
     66    is($N0, 'NaN', '... *= 0') 
    3667    $N0 += 5 
    37     say $N0 
     68    is($N0, 'NaN', '... += 5') 
    3869    $N0 -= 42 
    39     say $N0 
     70    is($N0, 'NaN', '... -= 42') 
    4071    inc $N0 
    41     say $N0 
     72    is($N0, 'NaN', '... inc') 
    4273    dec $N0 
    43     say $N0 
     74    is($N0, 'NaN', '... dec') 
    4475    $N2 = abs $N0 
    45     say $N2 
     76    is($N2, 'NaN', '... abs NaN') 
    4677    $N1 = 'Inf' 
    4778    $N3 = abs $N1 
    48     say $N3 
     79    is($N3, 'Inf', '... abs Inf') 
    4980    $N1 = '-Inf' 
    5081    $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 
    6987    $N0 = 'Inf' 
    7088    $N1 = exp $N0 
    71     say $N1 
     89    is($N1, 'Inf', 'exp: exp Inf') 
    7290    $N0 = '-Inf' 
    7391    $N1 = exp $N0 
    74     say $N1 
     92    is($N1, 0, '... exp -Inf') 
    7593    $N0 = 'NaN' 
    7694    $N1 = exp $N0 
    77     say $N1 
     95    is($N1, 'NaN', '... exp NaN') 
    7896.end 
    79 CODE 
    80 Inf 
    81 0 
    82 NaN 
    83 OUTPUT 
    8497 
    85 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sqrt" ); 
    86 .sub 'test' :main 
     98.sub test_sqrt 
    8799    $N0 = 'Inf' 
    88100    $N1 =  $N0 
    89     say $N1 
     101    is($N1, 'Inf', 'sqrt: assignment') 
    90102    $N0 = '-Inf' 
    91103    $N1 = sqrt $N0 
    92     say $N1 
     104    is($N1, 'NaN', '... sqrt -Inf') 
    93105    $N0 = 'NaN' 
    94106    $N1 = sqrt $N0 
    95     say $N1 
     107    is($N1, 'NaN', '... sqrt NaN') 
    96108    $N0 = -1 
    97109    $N1 = sqrt $N0 
    98     say $N1 
     110    is($N1, 'NaN', '... sqrt -1') 
    99111.end 
    100 CODE 
    101 Inf 
    102 NaN 
    103 NaN 
    104 NaN 
    105 OUTPUT 
    106112 
    107 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sin" ); 
    108 .sub 'test' :main 
     113.sub test_sin 
    109114    $N0 = 'Inf' 
    110115    $N1 = sin $N0 
    111     say $N1 
     116    is($N1, 'NaN', 'sin: sin Inf') 
    112117    $N0 = '-Inf' 
    113118    $N1 = sin $N0 
    114     say $N1 
     119    is($N1, 'NaN', '... sin -Inf') 
    115120    $N0 = 'NaN' 
    116121    $N1 = sin $N0 
    117     say $N1 
     122    is($N1, 'NaN', '... sin NaN') 
    118123.end 
    119 CODE 
    120 NaN 
    121 NaN 
    122 NaN 
    123 OUTPUT 
    124124 
    125 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sinh" ); 
    126 .sub 'test' :main 
     125.sub test_sinh  
    127126    $N0 = 'Inf' 
    128127    $N1 = sinh $N0 
    129     say $N1 
     128    is($N1, 'Inf', 'sinh: sinh Inf') 
    130129    $N0 = '-Inf' 
    131130    $N1 = sinh $N0 
    132     say $N1 
     131    is($N1, '-Inf', '... sinh -Inf') 
    133132    $N0 = 'NaN' 
    134133    $N1 = sinh $N0 
    135     say $N1 
     134    is($N1, 'NaN', '... sinh NaN') 
    136135.end 
    137 CODE 
    138 Inf 
    139 -Inf 
    140 NaN 
    141 OUTPUT 
    142136 
    143 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - asin" ); 
    144 .sub 'test' :main 
     137.sub test_asin  
    145138    $N0 = 'Inf' 
    146139    $N1 = asin $N0 
    147     say $N1 
     140    is($N1, 'NaN', 'asin: asin Inf') 
    148141    $N0 = '-Inf' 
    149142    $N1 = asin $N0 
    150     say $N1 
     143    is($N1, 'NaN', '... asin -Inf') 
    151144    $N0 = 'NaN' 
    152145    $N1 = asin $N0 
    153     say $N1 
     146    is($N1, 'NaN', '... asin NaN') 
    154147    $N0 = '-2' 
    155148    $N1 = asin $N0 
    156     say $N1 
     149    is($N1, 'NaN', '... asin -2') 
    157150    $N0 = '2' 
    158151    $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 
    171156    $N0 = 'Inf' 
    172157    $N1 = cos $N0 
    173     say $N1 
     158    is($N1, 'NaN', 'cos: cos Inf') 
    174159    $N0 = '-Inf' 
    175160    $N1 = cos $N0 
    176     say $N1 
     161    is($N1, 'NaN', '... cos -Inf') 
    177162    $N0 = 'NaN' 
    178163    $N1 = cos $N0 
    179     say $N1 
     164    is($N1, 'NaN', '... cos NaN') 
    180165.end 
    181 CODE 
    182 NaN 
    183 NaN 
    184 NaN 
    185 OUTPUT 
    186166 
    187 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - cosh" ); 
    188 .sub 'test' :main 
     167.sub test_cosh 
    189168    $N0 = 'Inf' 
    190169    $N1 = cosh $N0 
    191     say $N1 
     170    is($N1, 'Inf', 'cosh: cosh Inf') 
    192171    $N0 = '-Inf' 
    193172    $N1 = cosh $N0 
    194     say $N1 
     173    is($N1, 'Inf', '... cosh -Inf') 
    195174    $N0 = 'NaN' 
    196175    $N1 = cosh $N0 
    197     say $N1 
     176    is($N1, 'NaN', '... cosh NaN') 
    198177.end 
    199 CODE 
    200 Inf 
    201 Inf 
    202 NaN 
    203 OUTPUT 
    204178 
    205 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - acos" ); 
    206 .sub 'test' :main 
     179.sub test_acos 
    207180    $N0 = 'Inf' 
    208181    $N1 = acos $N0 
    209     say $N1 
     182    is($N1, 'NaN', 'acos: acos Inf') 
    210183    $N0 = '-Inf' 
    211184    $N1 = acos $N0 
    212     say $N1 
     185    is($N1, 'NaN', '... acos -Inf') 
    213186    $N0 = 'NaN' 
    214187    $N1 = acos $N0 
    215     say $N1 
     188    is($N1, 'NaN', '... acos NaN') 
    216189    $N0 = '-2' 
    217190    $N1 = acos $N0 
    218     say $N1 
     191    is($N1, 'NaN', '... acos -2') 
    219192    $N0 = '2' 
    220193    $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 
    233198    $N0 = 'Inf' 
    234199    $N1 = tan $N0 
    235     say $N1 
     200    is($N1, 'NaN', 'tan: tan Inf') 
    236201    $N0 = '-Inf' 
    237202    $N1 = tan $N0 
    238     say $N1 
     203    is($N1, 'NaN', '... tan -Inf') 
    239204    $N0 = 'NaN' 
    240205    $N1 = tan $N0 
    241     say $N1 
     206    is($N1, 'NaN', '... tan NaN') 
    242207.end 
    243 CODE 
    244 NaN 
    245 NaN 
    246 NaN 
    247 OUTPUT 
    248208 
    249 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - tanh" ); 
    250 .sub 'test' :main 
     209.sub test_tanh 
    251210    $N0 = 'Inf' 
    252211    $N1 = tanh $N0 
    253     say $N1 
     212    is($N1, 1, 'tanh: tanh Inf') 
    254213    $N0 = '-Inf' 
    255214    $N1 = tanh $N0 
    256     say $N1 
     215    is($N1, -1, '... tanh -Inf') 
    257216    $N0 = 'NaN' 
    258217    $N1 = tanh $N0 
    259     say $N1 
     218    is($N1, 'NaN', '... tanh NaN') 
    260219.end 
    261 CODE 
    262 1 
    263 -1 
    264 NaN 
    265 OUTPUT 
    266220 
    267 pir_output_like( <<'CODE',qr/^1.5707963.*^-1.5707963.*^NaN/ms,"Inf/NaN - atan" ); 
    268 .sub 'test' :main 
     221.sub test_atan  
    269222    $N0 = 'Inf' 
    270223    $N1 = atan $N0 
    271     say $N1 
     224    like($N1,'1\.5707963.*', 'atan: atan Inf') 
    272225    $N0 = '-Inf' 
    273226    $N1 = atan $N0 
    274     say $N1 
     227    like($N1, '\-1\.5707963.*', '... atan -Inf') 
    275228    $N0 = 'NaN' 
    276229    $N1 = atan $N0 
    277     say $N1 
     230    is($N1, 'NaN', '... atan NaN') 
    278231.end 
    279 CODE 
    280232 
    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 
    285234    $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') 
    288238    $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') 
    291242    $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') 
    294246.end 
    295 CODE 
    296 NaN 
    297 NaN 
    298 NaN 
    299 OUTPUT 
    300247 
    301 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - coth" ); 
    302 .sub 'test' :main 
     248.sub test_coth 
    303249    $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') 
    306253    $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') 
    309257    $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') 
    312261.end 
    313 CODE 
    314 1 
    315 -1 
    316 NaN 
    317 OUTPUT 
    318262 
    319 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - acot" ); 
    320 .sub 'test' :main 
     263.sub test_acot  
    321264    $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') 
    324268    $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') 
    327272    $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') 
    330276    $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') 
    333280    $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 
    348287    $N0 = 'Inf' 
    349288    $N1 = sec $N0 
    350     say $N1 
     289    is($N1, 'NaN', 'sec: sec Inf') 
    351290    $N0 = '-Inf' 
    352291    $N1 = sec $N0 
    353     say $N1 
     292    is($N1, 'NaN', '... sec -Inf') 
    354293    $N0 = 'NaN' 
    355294    $N1 = sec $N0 
    356     say $N1 
     295    is($N1, 'NaN', '... sec NaN') 
    357296.end 
    358 CODE 
    359 NaN 
    360 NaN 
    361 NaN 
    362 OUTPUT 
    363297 
    364 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sech" ); 
    365 .sub 'test' :main 
     298.sub test_sech 
    366299    $N0 = 'Inf' 
    367300    $N1 = sech $N0 
    368     say $N1 
     301    is($N1, 0, 'sech: sech Inf') 
    369302    $N0 = '-Inf' 
    370303    $N1 = sech $N0 
    371     say $N1 
     304    is($N1, 0, '... sech -Inf') 
    372305    $N0 = 'NaN' 
    373306    $N1 = sech $N0 
    374     say $N1 
     307    is($N1, 'NaN', '... sech NaN') 
    375308.end 
    376 CODE 
    377 0 
    378 0 
    379 NaN 
    380 OUTPUT 
    381309 
    382 pir_output_like( <<'CODE',qr/^1.5707963.*^1.5707963.*^NaN/ms,"Inf/NaN - asec" ); 
    383 .sub 'test' :main 
     310.sub test_asec 
    384311    $N0 = 'Inf' 
    385312    $N1 = asec $N0 
    386     say $N1 
     313    like($N1, '1\.5707963.*', 'asec: asec Inf') 
    387314    $N0 = '-Inf' 
    388315    $N1 = asec $N0 
    389     say $N1 
     316    like($N1, '1\.5707963.*', '... asec -Inf') 
    390317    $N0 = 'NaN' 
    391318    $N1 = asec $N0 
    392     say $N1 
     319    is($N1, 'NaN', 'asec NaN') 
    393320.end 
    394 CODE 
    395  
    396321 
    397 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - ln" ); 
    398 .sub 'test' :main 
     322.sub test_ln 
    399323    $N0 = 'Inf' 
    400324    $N1 = ln $N0 
    401     say $N1 
     325    is($N1, 'Inf', 'ln: ln Inf') 
    402326    $N0 = '-Inf' 
    403327    $N1 = ln $N0 
    404     say $N1 
     328    is($N1, 'NaN', '... ln Inf') 
    405329    $N0 = 'NaN' 
    406330    $N1 = ln $N0 
    407     say $N1 
     331    is($N1, 'NaN', '... ln NaN') 
    408332.end 
    409 CODE 
    410 Inf 
    411 NaN 
    412 NaN 
    413 OUTPUT 
    414333 
    415 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - log10" ); 
    416 .sub 'test' :main 
     334.sub test_log10 
    417335    $N0 = 'Inf' 
    418336    $N1 = log10 $N0 
    419     say $N1 
     337    is($N1, 'Inf', 'log10: log10 Inf') 
    420338    $N0 = '-Inf' 
    421339    $N1 = log10 $N0 
    422     say $N1 
     340    is($N1, 'NaN', '... log10 -Inf') 
    423341    $N0 = 'NaN' 
    424342    $N1 = log10 $N0 
    425     say $N1 
     343    is($N1, 'NaN', '... log10 NaN') 
    426344.end 
    427 CODE 
    428 Inf 
    429 NaN 
    430 NaN 
    431 OUTPUT 
    432345 
    433 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - log2" ); 
    434 .sub 'test' :main 
     346.sub test_log2 
    435347    $N0 = 'Inf' 
    436348    $N1 = log2 $N0 
    437     say $N1 
     349    is($N1, 'Inf', 'log2: log2 Inf') 
    438350    $N0 = '-Inf' 
    439351    $N1 = log2 $N0 
    440     say $N1 
     352    is($N1, 'NaN', '... log2 -Inf') 
    441353    $N0 = 'NaN' 
    442354    $N1 = log2 $N0 
    443     say $N1 
     355    is($N1, 'NaN', '... log2 -Inf') 
    444356.end 
    445 CODE 
    446 Inf 
    447 NaN 
    448 NaN 
    449 OUTPUT 
    450357 
    451 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - neg" ); 
    452 .sub 'test' :main 
     358.sub test_neg 
    453359    $N0 = 'Inf' 
    454360    $N1 = neg $N0 
    455     say $N1 
     361    is($N1, '-Inf', 'negative: neg Inf') 
    456362    $N0 = '-Inf' 
    457363    $N1 = neg $N0 
    458     say $N1 
     364    is($N1, 'Inf', '... neg -Inf') 
    459365    $N0 = 'NaN' 
    460366    $N1 = neg $N0 
    461     say $N1 
     367    is($N1, 'NaN', '... neg NaN') 
    462368.end 
    463 CODE 
    464 -Inf 
    465 Inf 
    466 NaN 
    467 OUTPUT 
    468369 
    469 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - pow" ); 
    470 .sub 'test' :main 
     370.sub test_pow 
    471371    $N0 = 'Inf' 
    472372    pow $N1, $N0, 2 
    473     say $N1 
     373    is($N1, 'Inf', 'pow: Inf ^ 2') 
    474374    pow $N1, 2, $N0 
    475     say $N1 
     375    is($N1, 'Inf', '...: 2 ^ Inf') 
    476376    $N0 = 'NaN' 
    477377    pow $N1, $N0, 2 
    478     say $N1 
     378    is($N1, 'NaN', '...: NaN ^ 2') 
    479379    pow $N1, 2, $N0 
    480     say $N1 
     380    is($N1, 'NaN', '...: 2 ^ NaN') 
    481381.end 
    482 CODE 
    483 Inf 
    484 Inf 
    485 NaN 
    486 NaN 
    487 OUTPUT 
    488382 
    489 pir_output_is( <<'CODE', <<OUTPUT, "Mixing NaN and Inf should give NaN" ); 
    490 .sub 'test' :main 
     383.sub test_mix_nan_inf 
    491384    $N0 = 'NaN' 
    492385    $N1 = 'Inf' 
    493386    $N0 *= $N1 
    494     say $N0 
     387    is($N0, 'NaN', 'mixing NaN and Inf: NaN * Inf') 
    495388    $N0 /= $N1 
    496     say $N0 
     389    is($N0, 'NaN', '... NaN / Inf') 
    497390    $N0 -= $N1 
    498     say $N0 
     391    is($N0, 'NaN', '... NaN - Inf') 
    499392    $N0 += $N1 
    500     say $N0 
     393    is($N0, 'NaN', '... NaN + Inf') 
    501394.end 
    502 CODE 
    503 NaN 
    504 NaN 
    505 NaN 
    506 NaN 
    507 OUTPUT 
    508395 
    509 pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - rounding" ); 
    510 .sub 'test' :main 
     396.sub test_rounding_n 
    511397    $N0 = 'NaN' 
    512398    $N1 = floor $N0 
    513     say $N1 
     399    is($N1, 'NaN', 'rounding n: floor NaN')  
    514400    $N2 = ceil $N0 
    515     say $N2 
     401    is($N2, 'NaN', '... ceil NaN') 
    516402    $N0 = 'Inf' 
    517403    $N1 = floor $N0 
    518     say $N1 
     404    is($N1, 'Inf', '... floor Inf') 
    519405    $N2 = ceil $N0 
    520     say $N2 
     406    is($N2, 'Inf', '... ceil Inf') 
    521407    $N0 = '-Inf' 
    522408    $N1 = floor $N0 
    523     say $N1 
     409    is($N1, '-Inf', '... floor -Inf') 
    524410    $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 
    567435    $P1 = new ["Complex"] 
    568436    $N0 = 'NaN' 
    569437    set $P1, "1 + i" 
    570438    $P1 += $N0 
    571     say $P1 
     439    #is($P1, 'NaN', '1+i + NaN') 
     440    todo(0, '1+i + NaN should be NaN') 
    572441.end 
    573 CODE 
    574 NaN 
    575 OUTPUT 
    576 } 
    577442 
    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 
    582444    $P1 = new "Integer" 
    583445    $P2 = new "Integer" 
    584446    $P2 = 1 
    585447    $N0 = 'NaN' 
    586448    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') 
    588451.end 
    589 CODE 
    590 NaN 
    591 OUTPUT 
    592452 
    593 pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Float PMCs and NaN'); 
    594 .sub main 
     453.sub test_fdiv_float_pmc_nan 
    595454    $P1 = new 'Float' 
    596455    $P2 = new 'Float' 
    597456    $P2 = 1 
    598457    $N0 = 'NaN' 
    599458    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') 
    601461.end 
    602 CODE 
    603 NaN 
    604 OUTPUT 
    605462 
    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 
    608464    $P1 = new 'Float' 
    609465    $P2 = new 'Integer' 
    610466    $P2 = 1 
    611467    $N0 = 'NaN' 
    612468    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')     
    614471.end 
    615 CODE 
    616 NaN 
    617 OUTPUT 
    618472 
    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 
    621474    $P1 = new 'Float' 
    622475    $P2 = new 'Integer' 
    623476    $P2 = 1 
    624477    $N0 = 'NaN' 
    625478    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') 
    627481.end 
    628 CODE 
    629 NaN 
    630 OUTPUT 
    631482 
    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 
    634484    $P1 = new 'Float' 
    635485    $P2 = new 'Integer' 
    636486    $P2 = 1 
    637487    $N0 = 'NaN' 
    638488    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') 
    640491.end 
    641 CODE 
    642 NaN 
    643 OUTPUT 
    644 } 
    645492 
    646493# Local Variables: 
    647494#   mode: cperl 
    648495#   cperl-indent-level: 4 
    649496#   fill-column: 100 
    650497# End: 
    651 # vim: expandtab shiftwidth=4: 
    652  
     498# vim: expandtab shiftwidth=4 filetype=pir: