Data.Number.Erf:$dmerfcx from erf-2.0.0.0

Percentage Accurate: 100.0% → 100.0%
Time: 4.9s
Alternatives: 6
Speedup: TODO×

Specification

?
\[x \cdot e^{y \cdot y} \]

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 6 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.

Target

Original100.0%
Target100.0%
Herbie100.0%
\[x \cdot {\left(e^{y}\right)}^{y} \]

Alternative 1?

\[x \cdot {\left(e^{y}\right)}^{y} \]
Derivation
  1. Initial program 100.0%

    \[x \cdot e^{y \cdot y} \]
  2. Step-by-step derivation
    1. exp-prod100.0%

      \[\leadsto x \cdot \color{blue}{{\left(e^{y}\right)}^{y}} \]
  3. Simplified100.0%

    \[\leadsto \color{blue}{x \cdot {\left(e^{y}\right)}^{y}} \]
  4. Final simplification100.0%

    \[\leadsto x \cdot {\left(e^{y}\right)}^{y} \]

Alternative 2?

\[x \cdot e^{y \cdot y} \]
Derivation
  1. Initial program 100.0%

    \[x \cdot e^{y \cdot y} \]
  2. Final simplification100.0%

    \[\leadsto x \cdot e^{y \cdot y} \]

Alternative 3?

\[\begin{array}{l} \mathbf{if}\;y \cdot y \leq 0.4:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot y\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 y y) < 0.40000000000000002

    1. Initial program 100.0%

      \[x \cdot e^{y \cdot y} \]
    2. Taylor expanded in y around 0 98.6%

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

    if 0.40000000000000002 < (*.f64 y y)

    1. Initial program 99.9%

      \[x \cdot e^{y \cdot y} \]
    2. Taylor expanded in y around 0 63.5%

      \[\leadsto x \cdot \color{blue}{\left(1 + {y}^{2}\right)} \]
    3. Step-by-step derivation
      1. unpow263.5%

        \[\leadsto x \cdot \left(1 + \color{blue}{y \cdot y}\right) \]
    4. Simplified63.5%

      \[\leadsto x \cdot \color{blue}{\left(1 + y \cdot y\right)} \]
    5. Taylor expanded in y around inf 63.5%

      \[\leadsto \color{blue}{{y}^{2} \cdot x} \]
    6. Step-by-step derivation
      1. unpow263.5%

        \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot x \]
      2. *-commutative63.5%

        \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right)} \]
    7. Simplified63.5%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification81.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot y \leq 0.4:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 4?

\[x \cdot \left(y \cdot y + 1\right) \]
Derivation
  1. Initial program 100.0%

    \[x \cdot e^{y \cdot y} \]
  2. Taylor expanded in y around 0 81.3%

    \[\leadsto x \cdot \color{blue}{\left(1 + {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow281.3%

      \[\leadsto x \cdot \left(1 + \color{blue}{y \cdot y}\right) \]
  4. Simplified81.3%

    \[\leadsto x \cdot \color{blue}{\left(1 + y \cdot y\right)} \]
  5. Final simplification81.3%

    \[\leadsto x \cdot \left(y \cdot y + 1\right) \]

Alternative 5?

\[x + x \cdot \left(y \cdot y\right) \]
Derivation
  1. Initial program 100.0%

    \[x \cdot e^{y \cdot y} \]
  2. Taylor expanded in y around 0 81.3%

    \[\leadsto x \cdot \color{blue}{\left(1 + {y}^{2}\right)} \]
  3. Step-by-step derivation
    1. unpow281.3%

      \[\leadsto x \cdot \left(1 + \color{blue}{y \cdot y}\right) \]
  4. Simplified81.3%

    \[\leadsto x \cdot \color{blue}{\left(1 + y \cdot y\right)} \]
  5. Step-by-step derivation
    1. +-commutative81.3%

      \[\leadsto x \cdot \color{blue}{\left(y \cdot y + 1\right)} \]
    2. distribute-lft-in81.3%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right) + x \cdot 1} \]
    3. *-rgt-identity81.3%

      \[\leadsto x \cdot \left(y \cdot y\right) + \color{blue}{x} \]
  6. Applied egg-rr81.3%

    \[\leadsto \color{blue}{x \cdot \left(y \cdot y\right) + x} \]
  7. Final simplification81.3%

    \[\leadsto x + x \cdot \left(y \cdot y\right) \]

Alternative 6?

\[x \]
Derivation
  1. Initial program 100.0%

    \[x \cdot e^{y \cdot y} \]
  2. Taylor expanded in y around 0 51.2%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification51.2%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023166 
(FPCore (x y)
  :name "Data.Number.Erf:$dmerfcx from erf-2.0.0.0"
  :precision binary64

  :herbie-target
  (* x (pow (exp y) y))

  (* x (exp (* y y))))