public static function countDecimals(float $value)
    {
        // When the value when cast to an integer is about the same, return 0 decimal places. Otherwise count them.
        return (int) $value == $value ? 0 : (strlen($value) - strrpos($value, '.') - 1);
    }