3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @see https://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Precision-Math-with-PHP/ba-p/8368 */ var_dump((0.2 + 1.4) * 10); var_dump(floor(((0.2 + 1.4) * 10))); // Should be 16. But it's 15! var_dump(floor(16.0)); // Using BC Math var_dump(bcadd('0.2', '1.4', 2) * 10); // It's 16 like we would expect it to be.
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e9Gch
function name:  (null)
number of ops:  25
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 16
          2        DO_ICALL                                                 
    9     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'floor'
          5        SEND_VAL                                                 16
          6        DO_ICALL                                         $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
   11     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'floor'
         11        SEND_VAL                                                 16
         12        DO_ICALL                                         $3      
         13        SEND_VAR                                                 $3
         14        DO_ICALL                                                 
   14    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL_BY_NAME                                       'bcadd'
         17        SEND_VAL_EX                                              '0.2'
         18        SEND_VAL_EX                                              '1.4'
         19        SEND_VAL_EX                                              2
         20        DO_FCALL                                      0  $5      
         21        MUL                                              ~6      $5, 10
         22        SEND_VAL                                                 ~6
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.49 ms | 1395 KiB | 20 Q