Average Error: 14.1 → 1.0
Time: 15.0s
Precision: 64
Internal precision: 128
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le -6.4042332376573255 \cdot 10^{+208}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le -1.2665794875040561 \cdot 10^{-228}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le -0.0:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \le 8.240287997287591 \cdot 10^{+264}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}\]
Target
| Original | 14.1 |
| Comparison | 1.5 |
| Herbie | 1.0 |
\[ \begin{array}{l}
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.20672205123045 \cdot 10^{+245}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.907522236933906 \cdot 10^{-275}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415 \cdot 10^{-65}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.0087180502407133 \cdot 10^{+217}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array} \]
Derivation
- Split input into 3 regimes.
-
if (/ (* (/ y z) t) t) < -6.4042332376573255e+208 or -1.2665794875040561e-228 < (/ (* (/ y z) t) t) < -0.0 or 8.240287997287591e+264 < (/ (* (/ y z) t) t)
Initial program 34.3
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
Applied simplify 14.6
\[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
Applied taylor 1.9
\[\leadsto \frac{y \cdot x}{z}\]
Taylor expanded around 0 1.9
\[\leadsto \color{blue}{\frac{y \cdot x}{z}}\]
if -6.4042332376573255e+208 < (/ (* (/ y z) t) t) < -1.2665794875040561e-228
Initial program 0.5
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
Applied simplify 0.2
\[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
if -0.0 < (/ (* (/ y z) t) t) < 8.240287997287591e+264
Initial program 0.7
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
Applied simplify 0.5
\[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
- Using strategy
rm
Applied div-inv 0.6
\[\leadsto \color{blue}{x \cdot \frac{1}{\frac{z}{y}}}\]
Applied simplify 0.3
\[\leadsto x \cdot \color{blue}{\frac{y}{z}}\]
- Recombined 3 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(2087167090 2919088521 2565942127 1321061053 1594932999 3321085498)'
(FPCore (x y z t)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
:target
(if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))
(* x (/ (* (/ y z) t) t)))