Average Error: 14.5 → 5.5
Time: 22.3s
Precision: binary64
Cost: 41345
Math TeX FPCore C \[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
↓
\[\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -5.564850423439244 \cdot 10^{-293}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\\
\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\
\;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\end{array}\]
x + \left(y - z\right) \cdot \frac{t - x}{a - z} ↓
\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -5.564850423439244 \cdot 10^{-293}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\\
\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\
\;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\end{array} (FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z))))) ↓
(FPCore (x y z t a)
:precision binary64
(if (<= (+ x (* (- y z) (/ (- t x) (- a z)))) -5.564850423439244e-293)
(+
x
(*
(*
(- y z)
(/ (* (cbrt (- t x)) (cbrt (- t x))) (* (cbrt (- a z)) (cbrt (- a z)))))
(/ (cbrt (- t x)) (cbrt (- a z)))))
(if (<= (+ x (* (- y z) (/ (- t x) (- a z)))) 0.0)
(- (+ t (+ (/ (* x y) z) (/ (* t a) z))) (+ (/ (* y t) z) (/ (* x a) z)))
(+ x (* (- t x) (/ (- y z) (- a z))))))) double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
↓
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x + ((y - z) * ((t - x) / (a - z)))) <= -5.564850423439244e-293) {
tmp = x + (((y - z) * ((cbrt(t - x) * cbrt(t - x)) / (cbrt(a - z) * cbrt(a - z)))) * (cbrt(t - x) / cbrt(a - z)));
} else if ((x + ((y - z) * ((t - x) / (a - z)))) <= 0.0) {
tmp = (t + (((x * y) / z) + ((t * a) / z))) - (((y * t) / z) + ((x * a) / z));
} else {
tmp = x + ((t - x) * ((y - z) / (a - z)));
}
return tmp;
}
Try it out Enter valid numbers for all inputs
Alternatives Alternative 1 Error 5.3 Cost 3778
\[\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -5.564850423439244 \cdot 10^{-293}:\\
\;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\
\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\
\;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\end{array}\]
Alternative 2 Error 7.5 Cost 3010
\[\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -5.564850423439244 \cdot 10^{-293}:\\
\;\;\;\;x + \frac{t - x}{\frac{a - z}{y - z}}\\
\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\end{array}\]
Alternative 3 Error 7.5 Cost 2696
\[\begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -5.564850423439244 \cdot 10^{-293} \lor \neg \left(x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0\right):\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\
\end{array}\]
Alternative 4 Error 19.3 Cost 2437
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.1065456018015844 \cdot 10^{+159}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\
\mathbf{elif}\;z \leq -3.230498399668289 \cdot 10^{-112}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{elif}\;z \leq 1.3448406161200768 \cdot 10^{-304}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a}\\
\mathbf{elif}\;z \leq 1.0268148611647885 \cdot 10^{-78}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;z \leq 7.290790375995201 \cdot 10^{+72}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\
\end{array}\]
Alternative 5 Error 18.1 Cost 2309
\[\begin{array}{l}
\mathbf{if}\;z \leq -6.665853333749956 \cdot 10^{+66}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;z \leq -6.79079239797028 \cdot 10^{-127}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;z \leq -6.438624753893702 \cdot 10^{-232}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{elif}\;z \leq 2.196901045502701 \cdot 10^{-75}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;z \leq 2.3713107167910814 \cdot 10^{+191}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}\]
Alternative 6 Error 18.4 Cost 2309
\[\begin{array}{l}
\mathbf{if}\;z \leq -5.410060959312064 \cdot 10^{+66}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;z \leq -5.729605727354131 \cdot 10^{-187}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;z \leq 3.169359730626377 \cdot 10^{-297}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a}\\
\mathbf{elif}\;z \leq 3.6661775307493256 \cdot 10^{-78}:\\
\;\;\;\;x + y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;z \leq 9.816631933300534 \cdot 10^{+192}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}\]
Alternative 7 Error 18.4 Cost 2316
\[\begin{array}{l}
\mathbf{if}\;z \leq -7.22228907873366 \cdot 10^{+135}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;z \leq -1.8498987351211166 \cdot 10^{-112}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{elif}\;z \leq 1.2837602305437623 \cdot 10^{-303}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a}\\
\mathbf{elif}\;z \leq 9.12816395138647 \cdot 10^{-78}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - x}}\\
\mathbf{elif}\;z \leq 1.115216595490904 \cdot 10^{-77} \lor \neg \left(z \leq 2.8933186684551406 \cdot 10^{+191}\right):\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot \frac{t}{a - z}\\
\end{array}\]
Alternative 8 Error 22.6 Cost 1539
\[\begin{array}{l}
\mathbf{if}\;z \leq -7.022874729869137 \cdot 10^{-86}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;z \leq 6.839542103627195 \cdot 10^{-303}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a}\\
\mathbf{elif}\;z \leq 2.2024990084922998 \cdot 10^{-13}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}\]
Alternative 9 Error 23.0 Cost 2181
\[\begin{array}{l}
\mathbf{if}\;z \leq -4.140065133924344 \cdot 10^{-92}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;z \leq -5.670244790612329 \cdot 10^{-128}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - x}}\\
\mathbf{elif}\;z \leq -2.577626534518484 \cdot 10^{-155}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;z \leq 2.4805744476890313 \cdot 10^{-301}:\\
\;\;\;\;x + \frac{y \cdot \left(t - x\right)}{a}\\
\mathbf{elif}\;z \leq 1.0816153418962741 \cdot 10^{-13}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\end{array}\]
Alternative 10 Error 23.7 Cost 904
\[\begin{array}{l}
\mathbf{if}\;z \leq -4.411908277092227 \cdot 10^{-92} \lor \neg \left(z \leq 1.5037676701846026 \cdot 10^{-21}\right):\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(t - x\right)}{a}\\
\end{array}\]
Alternative 11 Error 30.9 Cost 3465
\[\begin{array}{l}
\mathbf{if}\;y \leq -4.6690160927098065 \cdot 10^{+66}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;y \leq -5.101305874151799 \cdot 10^{-05}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;y \leq -2.5941186884107495 \cdot 10^{-31}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;y \leq -3.379930575287696 \cdot 10^{-146}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.5828322355922122 \cdot 10^{-282}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;y \leq 6.489719878560136 \cdot 10^{-186}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 9.129557786319857 \cdot 10^{-76}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{elif}\;y \leq 8.423055366884215 \cdot 10^{-45}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.5710176342395365 \cdot 10^{+56}:\\
\;\;\;\;t \cdot \frac{y - z}{a - z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\end{array}\]
Alternative 12 Error 34.5 Cost 2823
\[\begin{array}{l}
\mathbf{if}\;y \leq -6.479028663700075 \cdot 10^{-33}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\mathbf{elif}\;y \leq -1.4213739970540865 \cdot 10^{-166}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.9585995717491176 \cdot 10^{-288}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.642055366151123 \cdot 10^{-184}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.344165540000138 \cdot 10^{-81}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 6.8227190093713665 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 1.5727977826896943 \cdot 10^{-06}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - x}{a - z}\\
\end{array}\]
Alternative 13 Error 35.4 Cost 706
\[\begin{array}{l}
\mathbf{if}\;a \leq -9.734376177857755 \cdot 10^{+77}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.2702128404607037 \cdot 10^{+120}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}\]
Alternative 14 Error 45.5 Cost 64
\[x\]
Alternative 15 Error 61.8 Cost 64
\[-1\]
Alternative 16 Error 61.8 Cost 64
\[1\]
Error Derivation Split input into 3 regimes if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -5.5648504234392436e-293 Initial program 6.9
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
Using strategy rm Applied add-cube-cbrt_binary64_3864 7.6
\[\leadsto x + \left(y - z\right) \cdot \frac{t - x}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}\]
Applied add-cube-cbrt_binary64_3864 7.8
\[\leadsto x + \left(y - z\right) \cdot \frac{\color{blue}{\left(\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}\right) \cdot \sqrt[3]{t - x}}}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}\]
Applied times-frac_binary64_3835 7.8
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\right)}\]
Applied associate-*r*_binary64_3769 4.5
\[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}}\]
Simplified4.5
\[\leadsto \color{blue}{x + \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}}\]
if -5.5648504234392436e-293 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0 Initial program 61.0
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
Taylor expanded around inf 12.3
\[\leadsto \color{blue}{\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{a \cdot x}{z} + \frac{t \cdot y}{z}\right)}\]
Simplified12.3
\[\leadsto \color{blue}{\left(t + \left(\frac{y \cdot x}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{x \cdot a}{z} + \frac{y \cdot t}{z}\right)}\]
Simplified12.3
\[\leadsto \color{blue}{\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{t \cdot y}{z} + \frac{x \cdot a}{z}\right)}\]
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 7.6
\[x + \left(y - z\right) \cdot \frac{t - x}{a - z}\]
Using strategy rm Applied clear-num_binary64_3828 7.9
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{\frac{1}{\frac{a - z}{t - x}}}\]
Using strategy rm Applied associate-/r/_binary64_3775 7.7
\[\leadsto x + \left(y - z\right) \cdot \color{blue}{\left(\frac{1}{a - z} \cdot \left(t - x\right)\right)}\]
Applied associate-*r*_binary64_3769 4.4
\[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{a - z}\right) \cdot \left(t - x\right)}\]
Simplified4.3
\[\leadsto x + \color{blue}{\frac{y - z}{a - z}} \cdot \left(t - x\right)\]
Simplified4.3
\[\leadsto \color{blue}{x + \left(t - x\right) \cdot \frac{y - z}{a - z}}\]
Recombined 3 regimes into one program. Final simplification5.5
\[\leadsto \begin{array}{l}
\mathbf{if}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq -5.564850423439244 \cdot 10^{-293}:\\
\;\;\;\;x + \left(\left(y - z\right) \cdot \frac{\sqrt[3]{t - x} \cdot \sqrt[3]{t - x}}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \frac{\sqrt[3]{t - x}}{\sqrt[3]{a - z}}\\
\mathbf{elif}\;x + \left(y - z\right) \cdot \frac{t - x}{a - z} \leq 0:\\
\;\;\;\;\left(t + \left(\frac{x \cdot y}{z} + \frac{t \cdot a}{z}\right)\right) - \left(\frac{y \cdot t}{z} + \frac{x \cdot a}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right) \cdot \frac{y - z}{a - z}\\
\end{array}\]
Reproduce herbie shell --seed 2021044
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))