Data.Colour.CIE:cieLABView from colour-2.3.3, A

Percentage Accurate: 99.9% → 99.9%
Time: 6.5s
Alternatives: 3
Speedup: 9.0×

Specification

?
\[\frac{841}{108} \cdot x + \frac{4}{29} \]

Your Program's Arguments

Results

Enter valid numbers for all inputs

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 3 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Alternative 1: 99.9% accurate, 1.8× speedup?

\[7.787037037037037 \cdot x + 0.13793103448275862 \]
Derivation
  1. Initial program 99.9%

    \[\frac{841}{108} \cdot x + \frac{4}{29} \]
  2. Step-by-step derivation
    1. fma-def99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{841}{108}, x, \frac{4}{29}\right)} \]
    2. metadata-eval99.9%

      \[\leadsto \mathsf{fma}\left(\color{blue}{7.787037037037037}, x, \frac{4}{29}\right) \]
    3. metadata-eval99.9%

      \[\leadsto \mathsf{fma}\left(7.787037037037037, x, \color{blue}{0.13793103448275862}\right) \]
  3. Simplified99.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(7.787037037037037, x, 0.13793103448275862\right)} \]
  4. Step-by-step derivation
    1. metadata-eval99.9%

      \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{841}{108}}, x, 0.13793103448275862\right) \]
    2. metadata-eval99.9%

      \[\leadsto \mathsf{fma}\left(\frac{841}{108}, x, \color{blue}{\frac{4}{29}}\right) \]
    3. fma-def99.9%

      \[\leadsto \color{blue}{\frac{841}{108} \cdot x + \frac{4}{29}} \]
    4. metadata-eval99.9%

      \[\leadsto \color{blue}{7.787037037037037} \cdot x + \frac{4}{29} \]
    5. metadata-eval99.9%

      \[\leadsto 7.787037037037037 \cdot x + \color{blue}{0.13793103448275862} \]
  5. Applied egg-rr99.9%

    \[\leadsto \color{blue}{7.787037037037037 \cdot x + 0.13793103448275862} \]
  6. Final simplification99.9%

    \[\leadsto 7.787037037037037 \cdot x + 0.13793103448275862 \]

Alternative 2: 98.1% accurate, 1.3× speedup?

\[\begin{array}{l} \mathbf{if}\;x \leq -0.0175:\\ \;\;\;\;7.787037037037037 \cdot x\\ \mathbf{elif}\;x \leq 0.0175:\\ \;\;\;\;0.13793103448275862\\ \mathbf{else}:\\ \;\;\;\;7.787037037037037 \cdot x\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if x < -0.017500000000000002 or 0.017500000000000002 < x

    1. Initial program 99.7%

      \[\frac{841}{108} \cdot x + \frac{4}{29} \]
    2. Step-by-step derivation
      1. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{841}{108}, x, \frac{4}{29}\right)} \]
      2. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{7.787037037037037}, x, \frac{4}{29}\right) \]
      3. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(7.787037037037037, x, \color{blue}{0.13793103448275862}\right) \]
    3. Simplified99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(7.787037037037037, x, 0.13793103448275862\right)} \]
    4. Step-by-step derivation
      1. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{841}{108}}, x, 0.13793103448275862\right) \]
      2. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(\frac{841}{108}, x, \color{blue}{\frac{4}{29}}\right) \]
      3. fma-def99.7%

        \[\leadsto \color{blue}{\frac{841}{108} \cdot x + \frac{4}{29}} \]
      4. metadata-eval99.7%

        \[\leadsto \color{blue}{7.787037037037037} \cdot x + \frac{4}{29} \]
      5. metadata-eval99.7%

        \[\leadsto 7.787037037037037 \cdot x + \color{blue}{0.13793103448275862} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{7.787037037037037 \cdot x + 0.13793103448275862} \]
    6. Taylor expanded in x around inf 97.4%

      \[\leadsto \color{blue}{7.787037037037037 \cdot x} \]

    if -0.017500000000000002 < x < 0.017500000000000002

    1. Initial program 100.0%

      \[\frac{841}{108} \cdot x + \frac{4}{29} \]
    2. Taylor expanded in x around 0 97.6%

      \[\leadsto \color{blue}{0.13793103448275862} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.0175:\\ \;\;\;\;7.787037037037037 \cdot x\\ \mathbf{elif}\;x \leq 0.0175:\\ \;\;\;\;0.13793103448275862\\ \mathbf{else}:\\ \;\;\;\;7.787037037037037 \cdot x\\ \end{array} \]

Alternative 3: 49.9% accurate, 9.0× speedup?

\[0.13793103448275862 \]
Derivation
  1. Initial program 99.9%

    \[\frac{841}{108} \cdot x + \frac{4}{29} \]
  2. Taylor expanded in x around 0 51.5%

    \[\leadsto \color{blue}{0.13793103448275862} \]
  3. Final simplification51.5%

    \[\leadsto 0.13793103448275862 \]

Reproduce

?
herbie shell --seed 2023167 
(FPCore (x)
  :name "Data.Colour.CIE:cieLABView from colour-2.3.3, A"
  :precision binary64
  (+ (* (/ 841.0 108.0) x) (/ 4.0 29.0)))