3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isEqual($a, $b, $epsilon = 1e-10) { $a = floatval($a); $b = floatval($b); if ( $a == $b ) // handles infinites return true; if ( $a * $b == 0 ) // a or b or both are zero return abs($a - $b) < ( $epsilon * $epsilon ); return (abs($a - $b) / (abs($a) + abs($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/bMHCS
function name:  (null)
number of ops:  10
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->7
   16     2    >   INIT_FCALL                                               'isequal'
          3        SEND_VAL                                                 1.0e-6
          4        SEND_VAL                                                 1.0e-6
          5        DO_FCALL                                      0          
   15     6        PRE_INC                                                  !0
          7    >   IS_SMALLER                                               !0, 10000
          8      > JMPNZ                                                    ~4, ->2
   16     9    > > RETURN                                                   1

Function isequal:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bMHCS
function name:  isEqual
number of ops:  35
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        CAST                                          5  ~3      !0
          4        ASSIGN                                                   !0, ~3
    5     5        CAST                                          5  ~5      !1
          6        ASSIGN                                                   !1, ~5
    6     7        IS_EQUAL                                                 !0, !1
          8      > JMPZ                                                     ~7, ->10
    7     9    > > RETURN                                                   <true>
    9    10    >   MUL                                              ~8      !0, !1
         11        IS_EQUAL                                                 ~8, 0
         12      > JMPZ                                                     ~9, ->20
   10    13    >   INIT_FCALL                                               'abs'
         14        SUB                                              ~10     !0, !1
         15        SEND_VAL                                                 ~10
         16        DO_ICALL                                         $11     
         17        MUL                                              ~12     !2, !2
         18        IS_SMALLER                                       ~13     $11, ~12
         19      > RETURN                                                   ~13
   12    20    >   INIT_FCALL                                               'abs'
         21        SUB                                              ~14     !0, !1
         22        SEND_VAL                                                 ~14
         23        DO_ICALL                                         $15     
         24        INIT_FCALL                                               'abs'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $16     
         27        INIT_FCALL                                               'abs'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $17     
         30        ADD                                              ~18     $16, $17
         31        DIV                                              ~19     $15, ~18
         32        IS_SMALLER                                       ~20     ~19, !2
         33      > RETURN                                                   ~20
   13    34*     > RETURN                                                   null

End of function isequal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.9 ms | 1407 KiB | 16 Q