(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 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (<= t_2 -5000.0)
(* (/ y (+ x 1.0)) (/ z t_1))
(if (<= t_2 4e+281) t_2 (+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0))))))))
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -5e3
Initial program 17.5
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\]
Simplified17.5
\[\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
(*.f64 (/.f64 y (+.f64 1 x)) (/.f64 z (-.f64 (Rewrite<= *-commutative_binary64 (*.f64 z t)) x))): 0 points increase in error, 0 points decrease in error
(*.f64 (/.f64 y (+.f64 1 x)) (/.f64 z (Rewrite=> fma-neg_binary64 (fma.f64 z t (neg.f64 x))))): 0 points increase in error, 0 points decrease in error
(Rewrite<= times-frac_binary64 (/.f64 (*.f64 y z) (*.f64 (+.f64 1 x) (fma.f64 z t (neg.f64 x))))): 68 points increase in error, 29 points decrease in error
(/.f64 (*.f64 y z) (*.f64 (+.f64 1 x) (Rewrite<= fma-neg_binary64 (-.f64 (*.f64 z t) x)))): 0 points increase in error, 0 points decrease in error
(/.f64 (*.f64 y z) (*.f64 (+.f64 1 x) (-.f64 (Rewrite=> *-commutative_binary64 (*.f64 t z)) x))): 0 points increase in error, 0 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
if -5e3 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.0000000000000001e281
Initial program 0.7
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\]
if 4.0000000000000001e281 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))
Initial program 61.2
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\]
Simplified61.2
\[\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 1)))): 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 1)))): 0 points increase in error, 0 points decrease in error
(+.f64 (/.f64 x (+.f64 1 x)) (/.f64 y (*.f64 t (Rewrite<= +-commutative_binary64 (+.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.0
\[\leadsto \begin{array}{l}
\mathbf{if}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq -5000:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{z \cdot t - x}\\
\mathbf{elif}\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1} \leq 4 \cdot 10^{+281}:\\
\;\;\;\;\frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\\
\end{array}
\]
herbie shell --seed 2022331
(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)))