
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
def code(x, y, z, t, a, b): return ((x * y) + (z * (t - a))) / (y + (z * (b - y)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y)))) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * (t - a))) / (y + (z * (b - y))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (- t a) (- b y)))
(t_3 (/ (+ (* z (- t a)) (* x y)) t_1))
(t_4 (fma z (- b y) y)))
(if (<= t_3 (- INFINITY))
(* x (fma z (/ (- t a) (* x t_4)) (/ y t_4)))
(if (<= t_3 -5e-222)
(/ (fma (- t a) z (* x y)) t_1)
(if (<= t_3 0.0)
t_2
(if (<= t_3 1e+255)
(fma (/ (- (* x y) (* z a)) t_4) 1.0 (/ (* z t) t_4))
t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = (t - a) / (b - y);
double t_3 = ((z * (t - a)) + (x * y)) / t_1;
double t_4 = fma(z, (b - y), y);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = x * fma(z, ((t - a) / (x * t_4)), (y / t_4));
} else if (t_3 <= -5e-222) {
tmp = fma((t - a), z, (x * y)) / t_1;
} else if (t_3 <= 0.0) {
tmp = t_2;
} else if (t_3 <= 1e+255) {
tmp = fma((((x * y) - (z * a)) / t_4), 1.0, ((z * t) / t_4));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(Float64(t - a) / Float64(b - y)) t_3 = Float64(Float64(Float64(z * Float64(t - a)) + Float64(x * y)) / t_1) t_4 = fma(z, Float64(b - y), y) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(x * fma(z, Float64(Float64(t - a) / Float64(x * t_4)), Float64(y / t_4))); elseif (t_3 <= -5e-222) tmp = Float64(fma(Float64(t - a), z, Float64(x * y)) / t_1); elseif (t_3 <= 0.0) tmp = t_2; elseif (t_3 <= 1e+255) tmp = fma(Float64(Float64(Float64(x * y) - Float64(z * a)) / t_4), 1.0, Float64(Float64(z * t) / t_4)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(x * N[(z * N[(N[(t - a), $MachinePrecision] / N[(x * t$95$4), $MachinePrecision]), $MachinePrecision] + N[(y / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -5e-222], N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$3, 0.0], t$95$2, If[LessEqual[t$95$3, 1e+255], N[(N[(N[(N[(x * y), $MachinePrecision] - N[(z * a), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision] * 1.0 + N[(N[(z * t), $MachinePrecision] / t$95$4), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{t - a}{b - y}\\
t_3 := \frac{z \cdot \left(t - a\right) + x \cdot y}{t\_1}\\
t_4 := \mathsf{fma}\left(z, b - y, y\right)\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;x \cdot \mathsf{fma}\left(z, \frac{t - a}{x \cdot t\_4}, \frac{y}{t\_4}\right)\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-222}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, x \cdot y\right)}{t\_1}\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 10^{+255}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x \cdot y - z \cdot a}{t\_4}, 1, \frac{z \cdot t}{t\_4}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0Initial program 26.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6479.5
Simplified79.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.00000000000000008e-222Initial program 99.5%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.6
Applied egg-rr99.6%
if -5.00000000000000008e-222 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 9.99999999999999988e254 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 20.2%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6480.5
Simplified80.5%
if 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.99999999999999988e254Initial program 99.5%
Taylor expanded in t around inf
+-commutativeN/A
associate-+l+N/A
mul-1-negN/A
unsub-negN/A
*-commutativeN/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
Simplified88.6%
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr99.6%
Final simplification91.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (* z (- b y))))
(t_2 (/ (fma (- t a) z (* x y)) t_1))
(t_3 (/ (- t a) (- b y)))
(t_4 (/ (+ (* z (- t a)) (* x y)) t_1))
(t_5 (fma z (- b y) y)))
(if (<= t_4 (- INFINITY))
(* x (fma z (/ (- t a) (* x t_5)) (/ y t_5)))
(if (<= t_4 -5e-222)
t_2
(if (<= t_4 0.0) t_3 (if (<= t_4 1e+255) t_2 t_3))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (z * (b - y));
double t_2 = fma((t - a), z, (x * y)) / t_1;
double t_3 = (t - a) / (b - y);
double t_4 = ((z * (t - a)) + (x * y)) / t_1;
double t_5 = fma(z, (b - y), y);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = x * fma(z, ((t - a) / (x * t_5)), (y / t_5));
} else if (t_4 <= -5e-222) {
tmp = t_2;
} else if (t_4 <= 0.0) {
tmp = t_3;
} else if (t_4 <= 1e+255) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(z * Float64(b - y))) t_2 = Float64(fma(Float64(t - a), z, Float64(x * y)) / t_1) t_3 = Float64(Float64(t - a) / Float64(b - y)) t_4 = Float64(Float64(Float64(z * Float64(t - a)) + Float64(x * y)) / t_1) t_5 = fma(z, Float64(b - y), y) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(x * fma(z, Float64(Float64(t - a) / Float64(x * t_5)), Float64(y / t_5))); elseif (t_4 <= -5e-222) tmp = t_2; elseif (t_4 <= 0.0) tmp = t_3; elseif (t_4 <= 1e+255) tmp = t_2; else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$5 = N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(x * N[(z * N[(N[(t - a), $MachinePrecision] / N[(x * t$95$5), $MachinePrecision]), $MachinePrecision] + N[(y / t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -5e-222], t$95$2, If[LessEqual[t$95$4, 0.0], t$95$3, If[LessEqual[t$95$4, 1e+255], t$95$2, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + z \cdot \left(b - y\right)\\
t_2 := \frac{\mathsf{fma}\left(t - a, z, x \cdot y\right)}{t\_1}\\
t_3 := \frac{t - a}{b - y}\\
t_4 := \frac{z \cdot \left(t - a\right) + x \cdot y}{t\_1}\\
t_5 := \mathsf{fma}\left(z, b - y, y\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;x \cdot \mathsf{fma}\left(z, \frac{t - a}{x \cdot t\_5}, \frac{y}{t\_5}\right)\\
\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-222}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq 10^{+255}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -inf.0Initial program 26.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f6479.5
Simplified79.5%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -5.00000000000000008e-222 or 0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 9.99999999999999988e254Initial program 99.5%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.5
Applied egg-rr99.5%
if -5.00000000000000008e-222 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 0.0 or 9.99999999999999988e254 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 20.2%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6480.5
Simplified80.5%
Final simplification91.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- t a) (- b y))))
(if (<= z -8.8e+24)
t_1
(if (<= z 9e+14) (/ (fma (- t a) z (* x y)) (+ y (* z (- b y)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -8.8e+24) {
tmp = t_1;
} else if (z <= 9e+14) {
tmp = fma((t - a), z, (x * y)) / (y + (z * (b - y)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -8.8e+24) tmp = t_1; elseif (z <= 9e+14) tmp = Float64(fma(Float64(t - a), z, Float64(x * y)) / Float64(y + Float64(z * Float64(b - y)))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.8e+24], t$95$1, If[LessEqual[z, 9e+14], N[(N[(N[(t - a), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -8.8 \cdot 10^{+24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+14}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t - a, z, x \cdot y\right)}{y + z \cdot \left(b - y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -8.80000000000000007e24 or 9e14 < z Initial program 44.1%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6485.6
Simplified85.6%
if -8.80000000000000007e24 < z < 9e14Initial program 86.5%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f6486.5
Applied egg-rr86.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -1e-5) t_1 (if (<= z 2.65e-12) (fma z (/ (- t a) y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -1e-5) {
tmp = t_1;
} else if (z <= 2.65e-12) {
tmp = fma(z, ((t - a) / y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -1e-5) tmp = t_1; elseif (z <= 2.65e-12) tmp = fma(z, Float64(Float64(t - a) / y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e-5], t$95$1, If[LessEqual[z, 2.65e-12], N[(z * N[(N[(t - a), $MachinePrecision] / y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-12}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t - a}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.00000000000000008e-5 or 2.64999999999999982e-12 < z Initial program 47.9%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6485.4
Simplified85.4%
if -1.00000000000000008e-5 < z < 2.64999999999999982e-12Initial program 85.5%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate--r+N/A
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f6456.2
Simplified56.2%
Taylor expanded in x around 0
div-subN/A
/-lowering-/.f64N/A
--lowering--.f6461.3
Simplified61.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -5.5e-6) t_1 (if (<= z 5.1e-126) (fma z (- (/ a y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -5.5e-6) {
tmp = t_1;
} else if (z <= 5.1e-126) {
tmp = fma(z, -(a / y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -5.5e-6) tmp = t_1; elseif (z <= 5.1e-126) tmp = fma(z, Float64(-Float64(a / y)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e-6], t$95$1, If[LessEqual[z, 5.1e-126], N[(z * (-N[(a / y), $MachinePrecision]) + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-126}:\\
\;\;\;\;\mathsf{fma}\left(z, -\frac{a}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4999999999999999e-6 or 5.10000000000000002e-126 < z Initial program 53.9%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6478.8
Simplified78.8%
if -5.4999999999999999e-6 < z < 5.10000000000000002e-126Initial program 84.5%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate--r+N/A
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f6457.8
Simplified57.8%
Taylor expanded in a around inf
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-lowering-neg.f6455.2
Simplified55.2%
Final simplification69.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -1.5e-5) t_1 (if (<= z 3.3e-16) (fma z (/ t y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -1.5e-5) {
tmp = t_1;
} else if (z <= 3.3e-16) {
tmp = fma(z, (t / y), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -1.5e-5) tmp = t_1; elseif (z <= 3.3e-16) tmp = fma(z, Float64(t / y), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.5e-5], t$95$1, If[LessEqual[z, 3.3e-16], N[(z * N[(t / y), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -1.5 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{t}{y}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.50000000000000004e-5 or 3.29999999999999988e-16 < z Initial program 47.9%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6485.4
Simplified85.4%
if -1.50000000000000004e-5 < z < 3.29999999999999988e-16Initial program 85.5%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate--r+N/A
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f6456.2
Simplified56.2%
Taylor expanded in t around inf
/-lowering-/.f6451.8
Simplified51.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- t a) (- b y)))) (if (<= z -6.6e-70) t_1 (if (<= z 3.6e-128) x t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -6.6e-70) {
tmp = t_1;
} else if (z <= 3.6e-128) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (t - a) / (b - y)
if (z <= (-6.6d-70)) then
tmp = t_1
else if (z <= 3.6d-128) then
tmp = x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t - a) / (b - y);
double tmp;
if (z <= -6.6e-70) {
tmp = t_1;
} else if (z <= 3.6e-128) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (t - a) / (b - y) tmp = 0 if z <= -6.6e-70: tmp = t_1 elif z <= 3.6e-128: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t - a) / Float64(b - y)) tmp = 0.0 if (z <= -6.6e-70) tmp = t_1; elseif (z <= 3.6e-128) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (t - a) / (b - y); tmp = 0.0; if (z <= -6.6e-70) tmp = t_1; elseif (z <= 3.6e-128) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t - a), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.6e-70], t$95$1, If[LessEqual[z, 3.6e-128], x, t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - a}{b - y}\\
\mathbf{if}\;z \leq -6.6 \cdot 10^{-70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-128}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.60000000000000033e-70 or 3.60000000000000025e-128 < z Initial program 57.9%
Taylor expanded in z around inf
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6473.6
Simplified73.6%
if -6.60000000000000033e-70 < z < 3.60000000000000025e-128Initial program 82.7%
Taylor expanded in z around 0
Simplified50.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (- 1.0 z)))) (if (<= y -2.4e+57) t_1 (if (<= y 2.35e+14) (/ (- t a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -2.4e+57) {
tmp = t_1;
} else if (y <= 2.35e+14) {
tmp = (t - a) / b;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = x / (1.0d0 - z)
if (y <= (-2.4d+57)) then
tmp = t_1
else if (y <= 2.35d+14) then
tmp = (t - a) / b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x / (1.0 - z);
double tmp;
if (y <= -2.4e+57) {
tmp = t_1;
} else if (y <= 2.35e+14) {
tmp = (t - a) / b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x / (1.0 - z) tmp = 0 if y <= -2.4e+57: tmp = t_1 elif y <= 2.35e+14: tmp = (t - a) / b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x / Float64(1.0 - z)) tmp = 0.0 if (y <= -2.4e+57) tmp = t_1; elseif (y <= 2.35e+14) tmp = Float64(Float64(t - a) / b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x / (1.0 - z); tmp = 0.0; if (y <= -2.4e+57) tmp = t_1; elseif (y <= 2.35e+14) tmp = (t - a) / b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e+57], t$95$1, If[LessEqual[y, 2.35e+14], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{1 - z}\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.35 \cdot 10^{+14}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.40000000000000005e57 or 2.35e14 < y Initial program 51.3%
Taylor expanded in y around inf
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6447.8
Simplified47.8%
if -2.40000000000000005e57 < y < 2.35e14Initial program 77.3%
Taylor expanded in y around 0
/-lowering-/.f64N/A
--lowering--.f6456.1
Simplified56.1%
(FPCore (x y z t a b) :precision binary64 (/ x (- 1.0 z)))
double code(double x, double y, double z, double t, double a, double b) {
return x / (1.0 - z);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x / (1.0d0 - z)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x / (1.0 - z);
}
def code(x, y, z, t, a, b): return x / (1.0 - z)
function code(x, y, z, t, a, b) return Float64(x / Float64(1.0 - z)) end
function tmp = code(x, y, z, t, a, b) tmp = x / (1.0 - z); end
code[x_, y_, z_, t_, a_, b_] := N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1 - z}
\end{array}
Initial program 66.4%
Taylor expanded in y around inf
/-lowering-/.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6428.0
Simplified28.0%
(FPCore (x y z t a b) :precision binary64 (fma z x x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(z, x, x);
}
function code(x, y, z, t, a, b) return fma(z, x, x) end
code[x_, y_, z_, t_, a_, b_] := N[(z * x + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, x, x\right)
\end{array}
Initial program 66.4%
Taylor expanded in z around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate--r+N/A
div-subN/A
--lowering--.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
associate-/l*N/A
*-lowering-*.f64N/A
div-subN/A
sub-negN/A
*-inversesN/A
metadata-evalN/A
+-lowering-+.f64N/A
/-lowering-/.f6431.1
Simplified31.1%
Taylor expanded in y around inf
Simplified22.7%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 66.4%
Taylor expanded in z around 0
Simplified22.6%
(FPCore (x y z t a b) :precision binary64 (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)));
}
def code(x, y, z, t, a, b): return (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z)))
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(z * t) + Float64(y * x)) / Float64(y + Float64(z * Float64(b - y)))) - Float64(a / Float64(Float64(b - y) + Float64(y / z)))) end
function tmp = code(x, y, z, t, a, b) tmp = (((z * t) + (y * x)) / (y + (z * (b - y)))) - (a / ((b - y) + (y / z))); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(z * t), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[(N[(b - y), $MachinePrecision] + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}
\end{array}
herbie shell --seed 2024204
(FPCore (x y z t a b)
:name "Development.Shake.Progress:decay from shake-0.15.5"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z)))))
(/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))