public static int bccomp(Environment env, Memory left, Memory right, int scale){
        BigDecimal bd1 = toBigDecimal(left);
        BigDecimal bd2 = toBigDecimal(right);

        bd1 = bd1.setScale(scale, RoundingMode.DOWN);
        bd2 = bd2.setScale(scale, RoundingMode.DOWN);

        return bd1.compareTo(bd2);
    }
bcmath extension
http://www.php.net/manual/ru/book.bc.php
exts/jphp-zend-ext/src/main/java/org/develnext/jphp/zend/ext/standard/BCMathFunctions.java