public static Memory bcmod(Memory left, Memory modus){
        BigDecimal base = toBigDecimal(left).setScale(0, RoundingMode.DOWN);
        BigDecimal mod = toBigDecimal(modus).setScale(0, RoundingMode.DOWN);

        if (mod.compareTo(BigDecimal.ZERO) == 0) {
            return Memory.NULL;
        }

        return new StringMemory(base.remainder(mod, MathContext.UNLIMITED).toString());
    }
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