3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isEqual($a, $b, $epsilon = 1e-10) { if ( float($a) == float($b) ) // handles infinites return true; if ( (float)$a * (float)$b == 0 ) // a or b or both are zero return abs(float($a) - float($b)) < ( $epsilon * $epsilon ); return (abs(float($a) - float($b)) / (abs(float($a)) + abs(float($b)))) < $epsilon; } for ( $i = 0; $i < 10000; $i++ ) isEqual(0.000001, 0.000001);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
Branch analysis from position: 2
filename:       /in/vBYP1
function name:  (null)
number of ops:  10
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->7
   14     2    >   INIT_FCALL                                               'isequal'
          3        SEND_VAL                                                 1.0e-6
          4        SEND_VAL                                                 1.0e-6
          5        DO_FCALL                                      0          
   13     6        PRE_INC                                                  !0
          7    >   IS_SMALLER                                               !0, 10000
          8      > JMPNZ                                                    ~4, ->2
   14     9    > > RETURN                                                   1

Function isequal:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 30
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vBYP1
function name:  isEqual
number of ops:  57
compiled vars:  !0 = $a, !1 = $b, !2 = $epsilon
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1.0e-10
    4     3        INIT_FCALL_BY_NAME                                       'float'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $3      
          6        INIT_FCALL_BY_NAME                                       'float'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $4      
          9        IS_EQUAL                                                 $3, $4
         10      > JMPZ                                                     ~5, ->12
    5    11    > > RETURN                                                   <true>
    7    12    >   CAST                                          5  ~6      !0
         13        CAST                                          5  ~7      !1
         14        MUL                                              ~8      ~6, ~7
         15        IS_EQUAL                                                 ~8, 0
         16      > JMPZ                                                     ~9, ->30
    8    17    >   INIT_FCALL                                               'abs'
         18        INIT_FCALL_BY_NAME                                       'float'
         19        SEND_VAR_EX                                              !0
         20        DO_FCALL                                      0  $10     
         21        INIT_FCALL_BY_NAME                                       'float'
         22        SEND_VAR_EX                                              !1
         23        DO_FCALL                                      0  $11     
         24        SUB                                              ~12     $10, $11
         25        SEND_VAL                                                 ~12
         26        DO_ICALL                                         $13     
         27        MUL                                              ~14     !2, !2
         28        IS_SMALLER                                       ~15     $13, ~14
         29      > RETURN                                                   ~15
   10    30    >   INIT_FCALL                                               'abs'
         31        INIT_FCALL_BY_NAME                                       'float'
         32        SEND_VAR_EX                                              !0
         33        DO_FCALL                                      0  $16     
         34        INIT_FCALL_BY_NAME                                       'float'
         35        SEND_VAR_EX                                              !1
         36        DO_FCALL                                      0  $17     
         37        SUB                                              ~18     $16, $17
         38        SEND_VAL                                                 ~18
         39        DO_ICALL                                         $19     
         40        INIT_FCALL                                               'abs'
         41        INIT_FCALL_BY_NAME                                       'float'
         42        SEND_VAR_EX                                              !0
         43        DO_FCALL                                      0  $20     
         44        SEND_VAR                                                 $20
         45        DO_ICALL                                         $21     
         46        INIT_FCALL                                               'abs'
         47        INIT_FCALL_BY_NAME                                       'float'
         48        SEND_VAR_EX                                              !1
         49        DO_FCALL                                      0  $22     
         50        SEND_VAR                                                 $22
         51        DO_ICALL                                         $23     
         52        ADD                                              ~24     $21, $23
         53        DIV                                              ~25     $19, ~24
         54        IS_SMALLER                                       ~26     ~25, !2
         55      > RETURN                                                   ~26
   11    56*     > RETURN                                                   null

End of function isequal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.42 ms | 1394 KiB | 16 Q