3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = 6.02 + 0.835; // 6.855 var_dump($a); // float(6.8549999999999995) var_dump(round((6.855), 2)); // float(6.86) var_dump(round($a, 2)); // float(6.85) var_dump(round(6.8549999999999995, 2)); // float(6.85) # new behavior in document from https://wiki.php.net/rfc/change_the_edge_case_of_round#expecting_fp_to_behave_like_fp var_dump(round(0.285, 2)); // float(0.29) var_dump(round(0.28499999999999998, 2)); //float(0.29) ## what's didifferent in this case var_dump(round(0.8549999999999995, 2)); // float(0.85) my expect is float(0.86) var_dump(round(0.28499999999999998, 2)); //float(0.29)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SlVAj
function name:  (null)
number of ops:  54
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 6.855
    4     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
    5     4        INIT_FCALL                                                   'var_dump'
          5        INIT_FCALL                                                   'round'
          6        SEND_VAL                                                     6.855
          7        SEND_VAL                                                     2
          8        DO_ICALL                                             $3      
          9        SEND_VAR                                                     $3
         10        DO_ICALL                                                     
    6    11        INIT_FCALL                                                   'var_dump'
         12        INIT_FCALL                                                   'round'
         13        SEND_VAR                                                     !0
         14        SEND_VAL                                                     2
         15        DO_ICALL                                             $5      
         16        SEND_VAR                                                     $5
         17        DO_ICALL                                                     
    7    18        INIT_FCALL                                                   'var_dump'
         19        INIT_FCALL                                                   'round'
         20        SEND_VAL                                                     6.855
         21        SEND_VAL                                                     2
         22        DO_ICALL                                             $7      
         23        SEND_VAR                                                     $7
         24        DO_ICALL                                                     
   10    25        INIT_FCALL                                                   'var_dump'
         26        INIT_FCALL                                                   'round'
         27        SEND_VAL                                                     0.285
         28        SEND_VAL                                                     2
         29        DO_ICALL                                             $9      
         30        SEND_VAR                                                     $9
         31        DO_ICALL                                                     
   11    32        INIT_FCALL                                                   'var_dump'
         33        INIT_FCALL                                                   'round'
         34        SEND_VAL                                                     0.285
         35        SEND_VAL                                                     2
         36        DO_ICALL                                             $11     
         37        SEND_VAR                                                     $11
         38        DO_ICALL                                                     
   15    39        INIT_FCALL                                                   'var_dump'
         40        INIT_FCALL                                                   'round'
         41        SEND_VAL                                                     0.855
         42        SEND_VAL                                                     2
         43        DO_ICALL                                             $13     
         44        SEND_VAR                                                     $13
         45        DO_ICALL                                                     
   16    46        INIT_FCALL                                                   'var_dump'
         47        INIT_FCALL                                                   'round'
         48        SEND_VAL                                                     0.285
         49        SEND_VAL                                                     2
         50        DO_ICALL                                             $15     
         51        SEND_VAR                                                     $15
         52        DO_ICALL                                                     
         53      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
114.2 ms | 495 KiB | 11 Q