Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G

Percentage Accurate: 100.0% → 100.0%
Time: 3.6s
Alternatives: 9
Speedup: TODO×

Specification

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

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 9 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?

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

    \[\left(x + y\right) \cdot \left(z + 1\right) \]
  2. Final simplification100.0%

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

Alternative 2?

\[\begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{+85}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-160}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 3.55 \cdot 10^{-267}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-194}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+39}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+132} \lor \neg \left(z \leq 3.05 \cdot 10^{+159}\right) \land \left(z \leq 2.7 \cdot 10^{+210} \lor \neg \left(z \leq 8.5 \cdot 10^{+238}\right) \land z \leq 7 \cdot 10^{+275}\right):\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Derivation
  1. Split input into 4 regimes
  2. if z < -2.2999999999999999e85 or 4.3e39 < z < 3.70000000000000011e132 or 3.05e159 < z < 2.6999999999999999e210 or 8.49999999999999998e238 < z < 6.99999999999999987e275

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 54.9%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around inf 54.9%

      \[\leadsto \color{blue}{y \cdot z} \]

    if -2.2999999999999999e85 < z < -1 or 1.80000000000000005e-5 < z < 4.3e39 or 3.70000000000000011e132 < z < 3.05e159 or 2.6999999999999999e210 < z < 8.49999999999999998e238 or 6.99999999999999987e275 < z

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 56.6%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
    3. Taylor expanded in z around inf 52.3%

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

    if -1 < z < -1.94999999999999995e-160 or 3.55000000000000003e-267 < z < 1.5e-194

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 54.4%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around 0 53.5%

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

    if -1.94999999999999995e-160 < z < 3.55000000000000003e-267 or 1.5e-194 < z < 1.80000000000000005e-5

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 60.4%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
    3. Taylor expanded in z around 0 60.3%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification55.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.3 \cdot 10^{+85}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -1.95 \cdot 10^{-160}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 3.55 \cdot 10^{-267}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-194}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-5}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{+39}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{+132} \lor \neg \left(z \leq 3.05 \cdot 10^{+159}\right) \land \left(z \leq 2.7 \cdot 10^{+210} \lor \neg \left(z \leq 8.5 \cdot 10^{+238}\right) \land z \leq 7 \cdot 10^{+275}\right):\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]

Alternative 3?

\[\begin{array}{l} t_0 := y \cdot \left(z + 1\right)\\ \mathbf{if}\;z \leq -2.2 \cdot 10^{+85}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+38}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-11}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 20.5:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+39}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{+127}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{+160}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+210}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+239}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+276}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Derivation
  1. Split input into 4 regimes
  2. if z < -2.2000000000000002e85 or 2.80000000000000001e39 < z < 1.06000000000000006e127 or 1.32e160 < z < 2.64999999999999976e210

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 52.7%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around inf 52.7%

      \[\leadsto \color{blue}{y \cdot z} \]

    if -2.2000000000000002e85 < z < -1.99999999999999995e38 or 20.5 < z < 2.80000000000000001e39 or 1.06000000000000006e127 < z < 1.32e160 or 2.64999999999999976e210 < z < 2.80000000000000002e239 or 3.59999999999999979e276 < z

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 54.7%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
    3. Taylor expanded in z around inf 54.7%

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

    if -1.99999999999999995e38 < z < -2.34999999999999996e-11 or 2.80000000000000002e239 < z < 3.59999999999999979e276

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 55.4%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]

    if -2.34999999999999996e-11 < z < 20.5

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in z around 0 98.5%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.2 \cdot 10^{+85}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+38}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-11}:\\ \;\;\;\;y \cdot \left(z + 1\right)\\ \mathbf{elif}\;z \leq 20.5:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+39}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 1.06 \cdot 10^{+127}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 1.32 \cdot 10^{+160}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{+210}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 2.8 \cdot 10^{+239}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+276}:\\ \;\;\;\;y \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]

Alternative 4?

\[\begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{+85}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 17:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{+39}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+124} \lor \neg \left(z \leq 2.8 \cdot 10^{+158}\right) \land \left(z \leq 4.05 \cdot 10^{+210} \lor \neg \left(z \leq 1.8 \cdot 10^{+239}\right) \land z \leq 1.18 \cdot 10^{+278}\right):\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if z < -1.4e85 or 2.70000000000000003e39 < z < 3.30000000000000015e124 or 2.80000000000000001e158 < z < 4.0499999999999999e210 or 1.8e239 < z < 1.17999999999999993e278

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 54.9%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around inf 54.9%

      \[\leadsto \color{blue}{y \cdot z} \]

    if -1.4e85 < z < -1 or 17 < z < 2.70000000000000003e39 or 3.30000000000000015e124 < z < 2.80000000000000001e158 or 4.0499999999999999e210 < z < 1.8e239 or 1.17999999999999993e278 < z

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 55.0%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
    3. Taylor expanded in z around inf 53.6%

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

    if -1 < z < 17

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in z around 0 97.7%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{+85}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 17:\\ \;\;\;\;x + y\\ \mathbf{elif}\;z \leq 2.7 \cdot 10^{+39}:\\ \;\;\;\;x \cdot z\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+124} \lor \neg \left(z \leq 2.8 \cdot 10^{+158}\right) \land \left(z \leq 4.05 \cdot 10^{+210} \lor \neg \left(z \leq 1.8 \cdot 10^{+239}\right) \land z \leq 1.18 \cdot 10^{+278}\right):\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x \cdot z\\ \end{array} \]

Alternative 5?

\[\begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-160}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-268}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-199}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if z < -1 or 9.49999999999999985e-34 < z

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 50.6%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around inf 49.7%

      \[\leadsto \color{blue}{y \cdot z} \]

    if -1 < z < -1.30000000000000002e-160 or 4.5000000000000001e-268 < z < 9.5000000000000005e-199

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 54.4%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around 0 53.5%

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

    if -1.30000000000000002e-160 < z < 4.5000000000000001e-268 or 9.5000000000000005e-199 < z < 9.49999999999999985e-34

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 58.9%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
    3. Taylor expanded in z around 0 58.9%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification53.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-160}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{-268}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-199}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]

Alternative 6?

\[\begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;z \cdot \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if z < -1 or 1 < z

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in z around inf 97.7%

      \[\leadsto \color{blue}{\left(y + x\right) \cdot z} \]

    if -1 < z < 1

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in z around 0 98.3%

      \[\leadsto \color{blue}{y + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;z \cdot \left(x + y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]

Alternative 7?

\[\begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-104}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z + 1\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if y < 3.40000000000000015e-104

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 61.1%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]

    if 3.40000000000000015e-104 < y

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 66.2%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-104}:\\ \;\;\;\;x \cdot \left(z + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(z + 1\right)\\ \end{array} \]

Alternative 8?

\[\begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-117}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if x < -5.6e-117

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around inf 71.3%

      \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
    3. Taylor expanded in z around 0 44.4%

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

    if -5.6e-117 < x

    1. Initial program 100.0%

      \[\left(x + y\right) \cdot \left(z + 1\right) \]
    2. Taylor expanded in x around 0 60.4%

      \[\leadsto \color{blue}{y \cdot \left(1 + z\right)} \]
    3. Taylor expanded in z around 0 32.6%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification36.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.6 \cdot 10^{-117}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 9?

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

    \[\left(x + y\right) \cdot \left(z + 1\right) \]
  2. Taylor expanded in x around inf 53.1%

    \[\leadsto \color{blue}{\left(1 + z\right) \cdot x} \]
  3. Taylor expanded in z around 0 30.6%

    \[\leadsto \color{blue}{x} \]
  4. Final simplification30.6%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023166 
(FPCore (x y z)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, G"
  :precision binary64
  (* (+ x y) (+ z 1.0)))