Average Error: 7.5 → 7.4
Time: 42.8s
Precision: 64
Internal precision: 128
\[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
⬇
\[\begin{array}{l}
\mathbf{if}\;t \le -3.8447453506502606 \cdot 10^{-190}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{if}\;t \le 3.3156380580081446 \cdot 10^{+107}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}} - 4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{if}\;t \le 7.696604323863346 \cdot 10^{+213}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y}{\frac{a}{x}} - 4.5 \cdot \frac{t \cdot z}{a}\\
\end{array}\]
Target
| Original | 7.5 |
| Comparison | 5.5 |
| Herbie | 7.4 |
\[ \begin{array}{l}
\mathbf{if}\;a \lt -2.090464557976709 \cdot 10^{+86}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\
\mathbf{if}\;a \lt 2.144030707833976 \cdot 10^{+99}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9.0 \cdot t\right)}{a \cdot 2.0}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\
\end{array} \]
Derivation
- Split input into 2 regimes.
-
if t < -3.8447453506502606e-190 or 3.3156380580081446e+107 < t < 7.696604323863346e+213
Initial program 9.2
\[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
Applied taylor 9.2
\[\leadsto 0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]
Taylor expanded around 0 9.2
\[\leadsto \color{blue}{0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
- Using strategy
rm
Applied associate-/l* 8.0
\[\leadsto 0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
if -3.8447453506502606e-190 < t < 3.3156380580081446e+107 or 7.696604323863346e+213 < t
Initial program 5.9
\[\frac{x \cdot y - \left(z \cdot 9.0\right) \cdot t}{a \cdot 2.0}\]
Applied taylor 5.9
\[\leadsto 0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t \cdot z}{a}\]
Taylor expanded around 0 5.9
\[\leadsto \color{blue}{0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
- Using strategy
rm
Applied associate-/l* 6.8
\[\leadsto 0.5 \cdot \color{blue}{\frac{y}{\frac{a}{x}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(1434845648 3023931597 1833908445 1892332934 2207144950 1865795020)'
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))