src/CRUDlex/TwigExtensions.php
public function formatFloat($float)
    {

        if (!$float) {
            return $float;
        }

        $zeroFraction = $float - floor($float) == 0 ? '0' : '';

        // We don't want values like 0.004 converted to 0.00400000000000000008
        if ($float > 0.0001) {
            return $float.($zeroFraction === '0' ? '.'.$zeroFraction : '');
        }

        // We don't want values like 0.00004 converted to its scientific notation 4.0E-5
        return rtrim(sprintf('%.20F', $float), '0').$zeroFraction;
    }
public function formatFloat($float)
    {

        if (!$float) {
            return $float;
        }

        $zeroFraction = $float - floor($float) == 0 ? '0' : '';

        // We don't want values like 0.004 converted to 0.00400000000000000008
        if ($float > 0.0001) {
            return $float.($zeroFraction === '0' ? '.'.$zeroFraction : '');
        }

        // We don't want values like 0.00004 converted to its scientific notation 4.0E-5
        return rtrim(sprintf('%.20F', $float), '0').$zeroFraction;
    }
public function formatFloat ( $ float ) { if ( ! $ float ) { return $ float ; } $ zeroFraction = $ float - floor ( $ float ) == 0 ? '0' : '' ; // We don't want values like 0.004 converted to 0.00400000000000000008 if ( $ float > 0.0001 ) { return $ float . ( $ zeroFraction === '0' ? '.' . $ zeroFraction : '' ) ; } // We don't want values like 0.00004 converted to its scientific notation 4.0E-5 return rtrim ( sprintf ( '%.20F' , $ float ) , '0' ) . $ zeroFraction ; }
Formats a float to not display in scientific notation.

@param float $float
the float to format

@return double|string
the formated float
Formats a float to not display in scientific notation .