Average Error: 2.1 → 2.1
Time: 8.9s
Precision: binary64
Cost: 20616
Math TeX FPCore C \[\frac{x - y}{z - y} \cdot t\]
↓
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.6399878561446166 \cdot 10^{-103} \lor \neg \left(y \leq 2.4182139109528022 \cdot 10^{-296}\right):\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \left(t \cdot \frac{\sqrt[3]{x - y}}{z - y}\right)\\
\end{array}\]
\frac{x - y}{z - y} \cdot t ↓
\begin{array}{l}
\mathbf{if}\;y \leq -3.6399878561446166 \cdot 10^{-103} \lor \neg \left(y \leq 2.4182139109528022 \cdot 10^{-296}\right):\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \left(t \cdot \frac{\sqrt[3]{x - y}}{z - y}\right)\\
\end{array} (FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t)) ↓
(FPCore (x y z t)
:precision binary64
(if (or (<= y -3.6399878561446166e-103) (not (<= y 2.4182139109528022e-296)))
(* t (/ (- x y) (- z y)))
(* (* (cbrt (- x y)) (cbrt (- x y))) (* t (/ (cbrt (- x y)) (- z y)))))) double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
↓
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.6399878561446166e-103) || !(y <= 2.4182139109528022e-296)) {
tmp = t * ((x - y) / (z - y));
} else {
tmp = (cbrt(x - y) * cbrt(x - y)) * (t * (cbrt(x - y) / (z - y)));
}
return tmp;
}
Try it out Enter valid numbers for all inputs
Target Original 2.1 Target 2.1 Herbie 2.1
\[\frac{t}{\frac{z - y}{x - y}}\]
Alternatives Alternative 1 Error 1.7 Cost 1409
\[\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \leq 1.387502400050649 \cdot 10^{+195}:\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z - y}{t \cdot \left(x - y\right)}}\\
\end{array}\]
Alternative 2 Error 1.6 Cost 1281
\[\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \leq 1.6007126439202062 \cdot 10^{+216}:\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\
\end{array}\]
Alternative 3 Error 2.2 Cost 904
\[\begin{array}{l}
\mathbf{if}\;t \leq -1.40767092518502 \cdot 10^{+33} \lor \neg \left(t \leq 2.898877055568305 \cdot 10^{-36}\right):\\
\;\;\;\;\frac{x - y}{\frac{z - y}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot \left(x - y\right)}{z - y}\\
\end{array}\]
Alternative 4 Error 8.4 Cost 1860
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.525824907060968 \cdot 10^{+129}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{elif}\;y \leq 3.594613337010265 \cdot 10^{-289}:\\
\;\;\;\;\frac{t \cdot \left(x - y\right)}{z - y}\\
\mathbf{elif}\;y \leq 1.2959754135062816 \cdot 10^{-142}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;y \leq 3.0222160492804032 \cdot 10^{+100}:\\
\;\;\;\;\frac{t \cdot \left(x - y\right)}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\end{array}\]
Alternative 5 Error 17.6 Cost 2438
\[\begin{array}{l}
\mathbf{if}\;z \leq -6.639300546884983 \cdot 10^{+137}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;z \leq -7.442136343304366 \cdot 10^{+103}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{elif}\;z \leq -1.1137586544646253 \cdot 10^{-17}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;z \leq -6.059204683548443 \cdot 10^{-70}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z - y}\right)\\
\mathbf{elif}\;z \leq 1.74448141155217 \cdot 10^{-127}:\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{elif}\;z \leq 3.85800650526104 \cdot 10^{+62}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z - y}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\end{array}\]
Alternative 6 Error 17.0 Cost 776
\[\begin{array}{l}
\mathbf{if}\;y \leq -3.574830395066524 \cdot 10^{-19} \lor \neg \left(y \leq 2.0613631863461637 \cdot 10^{+56}\right):\\
\;\;\;\;t \cdot \frac{y - x}{y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\end{array}\]
Alternative 7 Error 21.8 Cost 2053
\[\begin{array}{l}
\mathbf{if}\;z \leq -6.639300546884983 \cdot 10^{+137}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;z \leq -9.163865475934495 \cdot 10^{+103}:\\
\;\;\;\;t\\
\mathbf{elif}\;z \leq -6.907201991687983 \cdot 10^{-45}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\mathbf{elif}\;z \leq 1.3524827658108075 \cdot 10^{-127}:\\
\;\;\;\;\frac{t \cdot \left(y - x\right)}{y}\\
\mathbf{elif}\;z \leq 7.4952751032772635 \cdot 10^{+62}:\\
\;\;\;\;t\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x - y}{z}\\
\end{array}\]
Alternative 8 Error 24.3 Cost 1925
\[\begin{array}{l}
\mathbf{if}\;y \leq -2.6065230799284282 \cdot 10^{+151}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -5.536359091920371 \cdot 10^{-20}:\\
\;\;\;\;\frac{t \cdot \left(y - x\right)}{y}\\
\mathbf{elif}\;y \leq 3.438628285428713 \cdot 10^{-139}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 5.4162945233182605 \cdot 10^{-98}:\\
\;\;\;\;\frac{t \cdot \left(y - x\right)}{y}\\
\mathbf{elif}\;y \leq 7.735441981929651 \cdot 10^{+28}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}\]
Alternative 9 Error 25.0 Cost 962
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.397427563751888 \cdot 10^{-17}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.571719478587357 \cdot 10^{+29}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}\]
Alternative 10 Error 37.8 Cost 706
\[\begin{array}{l}
\mathbf{if}\;y \leq -7.76938455488459 \cdot 10^{-99}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.551125784651601 \cdot 10^{-25}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}\]
Alternative 11 Error 56.0 Cost 64
\[0\]
Alternative 12 Error 61.8 Cost 64
\[1\]
Error Derivation Split input into 2 regimes if y < -3.63998785614461661e-103 or 2.4182139109528022e-296 < y Initial program 1.4
\[\frac{x - y}{z - y} \cdot t\]
Simplified1.4
\[\leadsto \color{blue}{t \cdot \frac{x - y}{z - y}}\]
if -3.63998785614461661e-103 < y < 2.4182139109528022e-296 Initial program 5.4
\[\frac{x - y}{z - y} \cdot t\]
Using strategy rm Applied *-un-lft-identity_binary64_8262 5.4
\[\leadsto \frac{x - y}{\color{blue}{1 \cdot \left(z - y\right)}} \cdot t\]
Applied add-cube-cbrt_binary64_8297 6.3
\[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \sqrt[3]{x - y}}}{1 \cdot \left(z - y\right)} \cdot t\]
Applied times-frac_binary64_8268 6.3
\[\leadsto \color{blue}{\left(\frac{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}{1} \cdot \frac{\sqrt[3]{x - y}}{z - y}\right)} \cdot t\]
Applied associate-*l*_binary64_8203 5.3
\[\leadsto \color{blue}{\frac{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}{1} \cdot \left(\frac{\sqrt[3]{x - y}}{z - y} \cdot t\right)}\]
Simplified5.3
\[\leadsto \frac{\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}}{1} \cdot \color{blue}{\left(t \cdot \frac{\sqrt[3]{x - y}}{z - y}\right)}\]
Simplified5.3
\[\leadsto \color{blue}{\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \left(t \cdot \frac{\sqrt[3]{x - y}}{z - y}\right)}\]
Recombined 2 regimes into one program. Final simplification2.1
\[\leadsto \begin{array}{l}
\mathbf{if}\;y \leq -3.6399878561446166 \cdot 10^{-103} \lor \neg \left(y \leq 2.4182139109528022 \cdot 10^{-296}\right):\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{x - y} \cdot \sqrt[3]{x - y}\right) \cdot \left(t \cdot \frac{\sqrt[3]{x - y}}{z - y}\right)\\
\end{array}\]
Reproduce herbie shell --seed 2021044
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(/ t (/ (- z y) (- x y)))
(* (/ (- x y) (- z y)) t))