How to use frac - 1 common examples

To help you get started, we’ve selected a few frac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cncjs / cncjs / src / app / widgets / Axes / Keypad.jsx View on Github external
renderRationalNumberWithBoundedDenominator(value) {
        // https://github.com/SheetJS/frac
        const denominatorDigits = 4;
        const maximumDenominator = Math.pow(10, Number(denominatorDigits) || 0) - 1; // 10^4 - 1 = 9999
        const [quot, numerator, denominator] = frac(value, maximumDenominator, true);

        if (numerator > 0) {
            return (
                <span>
                    {quot &gt; 0 ? quot : ''}
                    
                    
                </span>
            );
        }

        return (
            <span>{quot &gt; 0 ? quot : ''}</span>

frac

Rational approximation with bounded denominator

Apache-2.0
Latest version published 6 years ago

Package Health Score

67 / 100
Full package analysis

Popular frac functions