#530: Failure of atan2 in jit core - ref TT #38
--------------------+-------------------------------------------------------
 Reporter:  mikehh  |        Type:  bug   
   Status:  new     |    Priority:  normal
Milestone:          |   Component:  none  
  Version:  trunk   |    Severity:  medium
 Keywords:          |        Lang:        
    Patch:          |    Platform:  linux 
--------------------+-------------------------------------------------------

Comment(by mikehh):

 I thought I would have a look at this again - r37921

 The test in question t/op/trans.t generates various .pasm files - the
 failing one bring t/op/trans_13.pasm:
 {{{
         .include 'include/fp_equality.pasm'
         set N0, 0.0
         set I0, 0
         set N1, 1.0
         set I1, 1
         set N2, 1.0
         set I2, 1
         set I3, -1
         set N3, -1.0

         atan N4, N1, N2
         .fp_eq_pasm  (N4, 0.785398, EQ1)
         print "not "
 EQ1:    print "ok 1\n"

         atan N4, N1, I2
         .fp_eq_pasm  (N4, 0.785398, EQ2)
         print "not "
 EQ2:    print "ok 2\n"

         atan N4, I1, N2
         .fp_eq_pasm  (N4, 0.785398, EQ3)
         print "not "
 EQ3:    print "ok 3\n"

         atan N4, I1, I2
         .fp_eq_pasm  (N4, 0.785398, EQ4)
         print "not "
 EQ4:    print "ok 4\n"

         atan N4, N3, 1.0
         .fp_eq_pasm   (N4, -0.785398, EQ5)
         print "not "
 EQ5:    print "ok 5\n"

         atan N4, N1, 0
         .fp_eq_pasm   (N4, 1.570796, EQ6)
         print "not "
 EQ6:    print "ok 6\n"

         atan N4, I3, 0.0
         .fp_eq_pasm   (N4, -1.570796, EQ7)
         print "not "
 EQ7:    print "ok 7\n"

         atan N4, I3, -1
         .fp_eq_pasm   (N4, -2.356194, EQ8)
         print "not "
 EQ8:    print "ok 8\n"

         atan N4, 1.0, N3
         .fp_eq_pasm   (N4, 2.356194, EQ9)
         print "not "
 EQ9:    print "ok 9\n"

         atan N4, 1.0, I0
         .fp_eq_pasm   (N4, 1.570796, EQ10)
         print "not "
 EQ10:   print "ok 10\n"

         atan N4, 1, N1
         .fp_eq_pasm   (N4, 0.785398, EQ11)
         print "not "
 EQ11:   print "ok 11\n"

         atan N4, 1, I1
         .fp_eq_pasm   (N4, 0.785398, EQ12)
         print "not "
 EQ12:   print "ok 12\n"

         atan N4, 0.0, 1.0
         .fp_eq_pasm   (N4, 0.000000, EQ13)
         print "not "
 EQ13:   print "ok 13\n"

         atan N4, -1.0, 0
         .fp_eq_pasm   (N4, -1.570796, EQ14)
         print "not "
 EQ14:   print "ok 14\n"

         atan N4, 1, -1.0
         .fp_eq_pasm   (N4, 2.356194, EQ15)
         print "not "
 EQ15:   print "ok 15\n"

         atan N4, 0, 1
         .fp_eq_pasm   (N4, 0.000000, EQ16)
         print "not "
 EQ16:   print "ok 16\n"
         end

 }}}

 running with the jit core gives the failing result:[[BR]]
 ./parrot -Rjit t/op/trans_13.pasm ->
 {{{
 not ok 1
 not ok 2
 not ok 3
 not ok 4
 not ok 5
 not ok 6
 not ok 7
 not ok 8
 not ok 9
 not ok 10
 not ok 11
 not ok 12
 ok 13
 ok 14
 ok 15
 ok 16

 }}}

 runnung without the jit core produces OK results.

 I then edited the .pasm file removing the test stuff and inserting print
 statements - trans_test_13.pasm ->
 {{{
         set N0, 0.0
         set I0, 0
         set N1, 1.0
         set I1, 1
         set N2, 1.0
         set I2, 1
         set I3, -1
         set N3, -1.0

         atan N4, N1, N2
         print N4
         print "\n"

         atan N4, N1, I2
         print N4
         print "\n"

         atan N4, I1, N2
         print N4
         print "\n"

         atan N4, I1, I2
         print N4
         print "\n"

         atan N4, N3, 1.0
         print N4
         print "\n"

         atan N4, N1, 0
         print N4
         print "\n"

         atan N4, I3, 0.0
         print N4
         print "\n"

         atan N4, I3, -1
         print N4
         print "\n"

         atan N4, 1.0, N3
         print N4
         print "\n"

         atan N4, 1.0, I0
         print N4
         print "\n"

         atan N4, 1, N1
         print N4
         print "\n"

         atan N4, 1, I1
         print N4
         print "\n"

         atan N4, 0.0, 1.0
         print N4
         print "\n"

         atan N4, -1.0, 0
         print N4
         print "\n"

         atan N4, 1, -1.0
         print N4
         print "\n"

         atan N4, 0, 1
         print N4
         print "\n"

         end

 }}}

 This generated the following - ./parrot -Rjit trans_test_13.pasm ->
 {{{
 NaN
 0.785398163397448
 0.785398163397448
 0.785398163397448
 -0.785398163397448
 1.5707963267949
 -1.5707963267949
 -2.35619449019234
 2.35619449019234
 1.5707963267949
 0.785398163397448
 0.785398163397448
 0
 -1.5707963267949
 2.35619449019234
 0

 }}}

 Running this without the jit core replaces the first line Nan with
 0.785398163397448

 I then inserted the following lines afrer the first call and print (line
 19) ->
 {{{
         print "do it again\n"
         atan N4, N1, N2
         print N4
         print "\n"

 ./parrot -Rjit trans_test_13.pasm
 NaN
 do it again
 0.785398163397448
 0.785398163397448
 0.785398163397448
 0.785398163397448
 -0.785398163397448
 1.5707963267949
 -1.5707963267949
 -2.35619449019234
 2.35619449019234
 1.5707963267949
 0.785398163397448
 0.785398163397448
 0
 -1.5707963267949
 2.35619449019234
 0

 }}}

 It appears that the jit core produces a Nan the first time it is run and
 afterwards produces the correct results.  This is NOT reflected in the
 test.

 Cheers, Michael (mikehh)

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/530#comment:2>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to