(FPCore (x y z t)
:precision binary64
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
↓
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (<= t_1 -2e+19)
(/ (/ y (+ x 1.0)) (- t (/ x z)))
(if (<= t_1 1e+220) t_1 (+ (/ x (+ x 1.0)) (/ y (+ t (* x t))))))))
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -2e19
Initial program 18.8
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\]
Simplified18.8
\[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}}
\]
Proof
(/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 z t) x))) (+.f64 x 1)): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 t z)) x))) (+.f64 x 1)): 0 points increase in error, 0 points decrease in error
(*.f64 (/.f64 y (+.f64 x 1)) (/.f64 z (-.f64 (*.f64 t z) x))): 0 points increase in error, 0 points decrease in error
(*.f64 (/.f64 y (Rewrite<= +-commutative_binary64 (+.f64 1 x))) (/.f64 z (-.f64 (*.f64 t z) x))): 0 points increase in error, 0 points decrease in error
(Rewrite<= times-frac_binary64 (/.f64 (*.f64 y z) (*.f64 (+.f64 1 x) (-.f64 (*.f64 t z) x)))): 52 points increase in error, 38 points decrease in error
(/.f64 (*.f64 y z) (Rewrite<= *-commutative_binary64 (*.f64 (-.f64 (*.f64 t z) x) (+.f64 1 x)))): 0 points increase in error, 0 points decrease in error
Applied egg-rr7.0
\[\leadsto \color{blue}{\frac{\frac{y}{\frac{z \cdot t - x}{z}}}{x + 1}}
\]
(/.f64 (/.f64 y (+.f64 x 1)) (-.f64 t (/.f64 x z))): 0 points increase in error, 0 points decrease in error
(/.f64 (/.f64 y (Rewrite<= +-commutative_binary64 (+.f64 1 x))) (-.f64 t (/.f64 x z))): 0 points increase in error, 0 points decrease in error
(Rewrite=> associate-/l/_binary64 (/.f64 y (*.f64 (-.f64 t (/.f64 x z)) (+.f64 1 x)))): 7 points increase in error, 24 points decrease in error
if -2e19 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1e220
Initial program 0.7
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\]
Simplified0.7
\[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}}
\]
Proof
(/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 z t) x))) (+.f64 x 1)): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 t z)) x))) (+.f64 x 1)): 0 points increase in error, 0 points decrease in error
if 1e220 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))
Initial program 54.9
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\]
Simplified54.9
\[\leadsto \color{blue}{\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}}
\]
Proof
(/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 z t) x))) (+.f64 x 1)): 0 points increase in error, 0 points decrease in error
(/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 t z)) x))) (+.f64 x 1)): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 x (+.f64 x 1)) (/.f64 y (+.f64 t (*.f64 x t)))): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 x (Rewrite<= +-commutative_binary64 (+.f64 1 x))) (/.f64 y (+.f64 t (*.f64 x t)))): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 x (+.f64 1 x)) (/.f64 y (+.f64 (Rewrite<= *-lft-identity_binary64 (*.f64 1 t)) (*.f64 x t)))): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 x (+.f64 1 x)) (/.f64 y (Rewrite<= distribute-rgt-in_binary64 (*.f64 t (+.f64 1 x))))): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 x (+.f64 1 x)) (/.f64 y (Rewrite<= *-commutative_binary64 (*.f64 (+.f64 1 x) t)))): 0 points increase in error, 0 points decrease in error
Recombined 3 regimes into one program.
Final simplification2.4
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -2 \cdot 10^{+19}:\\
\;\;\;\;\frac{\frac{y}{x + 1}}{t - \frac{x}{z}}\\
\mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 10^{+220}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{t + x \cdot t}\\
\end{array}
\]
herbie shell --seed 2022310
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))