
(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 17 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 b) (- y b)))
(t_2 (* (- b y) z))
(t_3 (/ (- (* y x) (* (- a t) z)) (+ t_2 y)))
(t_4 (/ (- a t) (- y b))))
(if (<= t_3 (- INFINITY))
(-
(/ x (- 1.0 z))
(/
(fma z (/ (- a t) (- 1.0 z)) (/ (* (* z x) b) (* (- z 1.0) (- z 1.0))))
y))
(if (<= t_3 -1e-304)
t_3
(if (<= t_3 0.0)
(-
t_4
(/
(fma
(/ (- t a) t_1)
y
(-
(fma
(/ y (- b y))
x
(* (/ y t_2) (fma (- y) (/ x (- b y)) (/ (* (- t a) y) t_1))))))
z))
(if (<= t_3 2e+304) t_3 t_4))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y - b) * (y - b);
double t_2 = (b - y) * z;
double t_3 = ((y * x) - ((a - t) * z)) / (t_2 + y);
double t_4 = (a - t) / (y - b);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = (x / (1.0 - z)) - (fma(z, ((a - t) / (1.0 - z)), (((z * x) * b) / ((z - 1.0) * (z - 1.0)))) / y);
} else if (t_3 <= -1e-304) {
tmp = t_3;
} else if (t_3 <= 0.0) {
tmp = t_4 - (fma(((t - a) / t_1), y, -fma((y / (b - y)), x, ((y / t_2) * fma(-y, (x / (b - y)), (((t - a) * y) / t_1))))) / z);
} else if (t_3 <= 2e+304) {
tmp = t_3;
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y - b) * Float64(y - b)) t_2 = Float64(Float64(b - y) * z) t_3 = Float64(Float64(Float64(y * x) - Float64(Float64(a - t) * z)) / Float64(t_2 + y)) t_4 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(x / Float64(1.0 - z)) - Float64(fma(z, Float64(Float64(a - t) / Float64(1.0 - z)), Float64(Float64(Float64(z * x) * b) / Float64(Float64(z - 1.0) * Float64(z - 1.0)))) / y)); elseif (t_3 <= -1e-304) tmp = t_3; elseif (t_3 <= 0.0) tmp = Float64(t_4 - Float64(fma(Float64(Float64(t - a) / t_1), y, Float64(-fma(Float64(y / Float64(b - y)), x, Float64(Float64(y / t_2) * fma(Float64(-y), Float64(x / Float64(b - y)), Float64(Float64(Float64(t - a) * y) / t_1)))))) / z)); elseif (t_3 <= 2e+304) tmp = t_3; else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y - b), $MachinePrecision] * N[(y - b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(b - y), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(y * x), $MachinePrecision] - N[(N[(a - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / N[(t$95$2 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(N[(z * N[(N[(a - t), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z * x), $MachinePrecision] * b), $MachinePrecision] / N[(N[(z - 1.0), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, -1e-304], t$95$3, If[LessEqual[t$95$3, 0.0], N[(t$95$4 - N[(N[(N[(N[(t - a), $MachinePrecision] / t$95$1), $MachinePrecision] * y + (-N[(N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision] * x + N[(N[(y / t$95$2), $MachinePrecision] * N[((-y) * N[(x / N[(b - y), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t - a), $MachinePrecision] * y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e+304], t$95$3, t$95$4]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - b\right) \cdot \left(y - b\right)\\
t_2 := \left(b - y\right) \cdot z\\
t_3 := \frac{y \cdot x - \left(a - t\right) \cdot z}{t\_2 + y}\\
t_4 := \frac{a - t}{y - b}\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;\frac{x}{1 - z} - \frac{\mathsf{fma}\left(z, \frac{a - t}{1 - z}, \frac{\left(z \cdot x\right) \cdot b}{\left(z - 1\right) \cdot \left(z - 1\right)}\right)}{y}\\
\mathbf{elif}\;t\_3 \leq -1 \cdot 10^{-304}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;t\_4 - \frac{\mathsf{fma}\left(\frac{t - a}{t\_1}, y, -\mathsf{fma}\left(\frac{y}{b - y}, x, \frac{y}{t\_2} \cdot \mathsf{fma}\left(-y, \frac{x}{b - y}, \frac{\left(t - a\right) \cdot y}{t\_1}\right)\right)\right)}{z}\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\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 11.6%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6411.2
Applied rewrites11.2%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6457.3
Applied rewrites57.3%
Applied rewrites57.1%
Taylor expanded in y around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
lower-/.f64N/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites68.8%
if -inf.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -9.99999999999999971e-305 or -0.0 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < 1.9999999999999999e304Initial program 99.7%
if -9.99999999999999971e-305 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) < -0.0Initial program 17.8%
Taylor expanded in z around -inf
Applied rewrites93.1%
if 1.9999999999999999e304 < (/.f64 (+.f64 (*.f64 x y) (*.f64 z (-.f64 t a))) (+.f64 y (*.f64 z (-.f64 b y)))) Initial program 10.0%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6473.6
Applied rewrites73.6%
Final simplification90.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -1.6e+43)
t_1
(if (<= z 9.2e+45)
(/ (- (* y x) (* (- a t) z)) (+ (* (- b y) z) y))
t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -1.6e+43) {
tmp = t_1;
} else if (z <= 9.2e+45) {
tmp = ((y * x) - ((a - t) * z)) / (((b - y) * z) + y);
} 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 = (a - t) / (y - b)
if (z <= (-1.6d+43)) then
tmp = t_1
else if (z <= 9.2d+45) then
tmp = ((y * x) - ((a - t) * z)) / (((b - y) * z) + y)
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 = (a - t) / (y - b);
double tmp;
if (z <= -1.6e+43) {
tmp = t_1;
} else if (z <= 9.2e+45) {
tmp = ((y * x) - ((a - t) * z)) / (((b - y) * z) + y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - t) / (y - b) tmp = 0 if z <= -1.6e+43: tmp = t_1 elif z <= 9.2e+45: tmp = ((y * x) - ((a - t) * z)) / (((b - y) * z) + y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -1.6e+43) tmp = t_1; elseif (z <= 9.2e+45) tmp = Float64(Float64(Float64(y * x) - Float64(Float64(a - t) * z)) / Float64(Float64(Float64(b - y) * z) + y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - t) / (y - b); tmp = 0.0; if (z <= -1.6e+43) tmp = t_1; elseif (z <= 9.2e+45) tmp = ((y * x) - ((a - t) * z)) / (((b - y) * z) + y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.6e+43], t$95$1, If[LessEqual[z, 9.2e+45], N[(N[(N[(y * x), $MachinePrecision] - N[(N[(a - t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(b - y), $MachinePrecision] * z), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+45}:\\
\;\;\;\;\frac{y \cdot x - \left(a - t\right) \cdot z}{\left(b - y\right) \cdot z + y}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.60000000000000007e43 or 9.20000000000000049e45 < z Initial program 34.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6484.4
Applied rewrites84.4%
if -1.60000000000000007e43 < z < 9.20000000000000049e45Initial program 88.3%
Final simplification86.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -0.27)
t_1
(if (<= z 2.1e+14) (/ (fma y x (* t z)) (fma (- b y) z y)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -0.27) {
tmp = t_1;
} else if (z <= 2.1e+14) {
tmp = fma(y, x, (t * z)) / fma((b - y), z, y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -0.27) tmp = t_1; elseif (z <= 2.1e+14) tmp = Float64(fma(y, x, Float64(t * z)) / fma(Float64(b - y), z, y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.27], t$95$1, If[LessEqual[z, 2.1e+14], N[(N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision] / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -0.27:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+14}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, t \cdot z\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.27000000000000002 or 2.1e14 < z Initial program 42.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6482.6
Applied rewrites82.6%
if -0.27000000000000002 < z < 2.1e14Initial program 88.8%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6476.3
Applied rewrites76.3%
Final simplification79.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -7.5e-16)
t_1
(if (<= z 4400000.0) (* (/ 1.0 y) (fma (- t a) z (* y x))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -7.5e-16) {
tmp = t_1;
} else if (z <= 4400000.0) {
tmp = (1.0 / y) * fma((t - a), z, (y * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -7.5e-16) tmp = t_1; elseif (z <= 4400000.0) tmp = Float64(Float64(1.0 / y) * fma(Float64(t - a), z, Float64(y * x))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e-16], t$95$1, If[LessEqual[z, 4400000.0], N[(N[(1.0 / y), $MachinePrecision] * N[(N[(t - a), $MachinePrecision] * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4400000:\\
\;\;\;\;\frac{1}{y} \cdot \mathsf{fma}\left(t - a, z, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5e-16 or 4.4e6 < z Initial program 44.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.4
Applied rewrites81.4%
if -7.5e-16 < z < 4.4e6Initial program 89.0%
lift-/.f64N/A
div-invN/A
lift-+.f64N/A
flip-+N/A
clear-numN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
clear-numN/A
flip-+N/A
lift-+.f64N/A
Applied rewrites88.9%
Taylor expanded in z around 0
lower-/.f6461.9
Applied rewrites61.9%
Final simplification72.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -9.2e-7)
t_1
(if (<= z 820000000.0) (* (/ y (fma (- b y) z y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -9.2e-7) {
tmp = t_1;
} else if (z <= 820000000.0) {
tmp = (y / fma((b - y), z, y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -9.2e-7) tmp = t_1; elseif (z <= 820000000.0) tmp = Float64(Float64(y / fma(Float64(b - y), z, y)) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.2e-7], t$95$1, If[LessEqual[z, 820000000.0], N[(N[(y / N[(N[(b - y), $MachinePrecision] * z + y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -9.2 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 820000000:\\
\;\;\;\;\frac{y}{\mathsf{fma}\left(b - y, z, y\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -9.1999999999999998e-7 or 8.2e8 < z Initial program 44.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.9
Applied rewrites81.9%
if -9.1999999999999998e-7 < z < 8.2e8Initial program 88.3%
Taylor expanded in x around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6458.0
Applied rewrites58.0%
Final simplification71.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.25e+128)
(/ (- t a) (- y))
(if (<= z -1.8e-7)
(/ (- t a) b)
(if (<= z 1800000.0) (/ x (- 1.0 z)) (/ a (- y b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.25e+128) {
tmp = (t - a) / -y;
} else if (z <= -1.8e-7) {
tmp = (t - a) / b;
} else if (z <= 1800000.0) {
tmp = x / (1.0 - z);
} else {
tmp = a / (y - b);
}
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) :: tmp
if (z <= (-1.25d+128)) then
tmp = (t - a) / -y
else if (z <= (-1.8d-7)) then
tmp = (t - a) / b
else if (z <= 1800000.0d0) then
tmp = x / (1.0d0 - z)
else
tmp = a / (y - b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.25e+128) {
tmp = (t - a) / -y;
} else if (z <= -1.8e-7) {
tmp = (t - a) / b;
} else if (z <= 1800000.0) {
tmp = x / (1.0 - z);
} else {
tmp = a / (y - b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.25e+128: tmp = (t - a) / -y elif z <= -1.8e-7: tmp = (t - a) / b elif z <= 1800000.0: tmp = x / (1.0 - z) else: tmp = a / (y - b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.25e+128) tmp = Float64(Float64(t - a) / Float64(-y)); elseif (z <= -1.8e-7) tmp = Float64(Float64(t - a) / b); elseif (z <= 1800000.0) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(a / Float64(y - b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.25e+128) tmp = (t - a) / -y; elseif (z <= -1.8e-7) tmp = (t - a) / b; elseif (z <= 1800000.0) tmp = x / (1.0 - z); else tmp = a / (y - b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.25e+128], N[(N[(t - a), $MachinePrecision] / (-y)), $MachinePrecision], If[LessEqual[z, -1.8e-7], N[(N[(t - a), $MachinePrecision] / b), $MachinePrecision], If[LessEqual[z, 1800000.0], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[(a / N[(y - b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+128}:\\
\;\;\;\;\frac{t - a}{-y}\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{elif}\;z \leq 1800000:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{y - b}\\
\end{array}
\end{array}
if z < -1.25e128Initial program 18.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6414.7
Applied rewrites14.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6490.2
Applied rewrites90.2%
Taylor expanded in b around 0
Applied rewrites70.2%
if -1.25e128 < z < -1.79999999999999997e-7Initial program 76.3%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6459.2
Applied rewrites59.2%
if -1.79999999999999997e-7 < z < 1.8e6Initial program 88.2%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6449.4
Applied rewrites49.4%
if 1.8e6 < z Initial program 50.7%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6444.0
Applied rewrites44.0%
Taylor expanded in z around inf
Applied rewrites55.8%
Final simplification56.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.85e+171)
(/ a y)
(if (<= z -9.5e-7)
(/ t b)
(if (<= z 1.05e+15) (fma (fma x z x) z x) (/ (- a) b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.85e+171) {
tmp = a / y;
} else if (z <= -9.5e-7) {
tmp = t / b;
} else if (z <= 1.05e+15) {
tmp = fma(fma(x, z, x), z, x);
} else {
tmp = -a / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.85e+171) tmp = Float64(a / y); elseif (z <= -9.5e-7) tmp = Float64(t / b); elseif (z <= 1.05e+15) tmp = fma(fma(x, z, x), z, x); else tmp = Float64(Float64(-a) / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.85e+171], N[(a / y), $MachinePrecision], If[LessEqual[z, -9.5e-7], N[(t / b), $MachinePrecision], If[LessEqual[z, 1.05e+15], N[(N[(x * z + x), $MachinePrecision] * z + x), $MachinePrecision], N[((-a) / b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+171}:\\
\;\;\;\;\frac{a}{y}\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, z, x\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{b}\\
\end{array}
\end{array}
if z < -1.84999999999999999e171Initial program 16.1%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6420.0
Applied rewrites20.0%
Taylor expanded in z around inf
Applied rewrites44.2%
Taylor expanded in b around 0
Applied rewrites41.3%
if -1.84999999999999999e171 < z < -9.5000000000000001e-7Initial program 60.5%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6449.7
Applied rewrites49.7%
Taylor expanded in y around 0
Applied rewrites38.0%
if -9.5000000000000001e-7 < z < 1.05e15Initial program 87.7%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.2
Applied rewrites48.2%
Taylor expanded in z around 0
Applied rewrites48.2%
if 1.05e15 < z Initial program 49.8%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6444.4
Applied rewrites44.4%
Taylor expanded in b around inf
Applied rewrites39.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.85e+171)
(/ a y)
(if (<= z -9.5e-7)
(/ t b)
(if (<= z 4.4e+14) (fma (fma x z x) z x) (/ a y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.85e+171) {
tmp = a / y;
} else if (z <= -9.5e-7) {
tmp = t / b;
} else if (z <= 4.4e+14) {
tmp = fma(fma(x, z, x), z, x);
} else {
tmp = a / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.85e+171) tmp = Float64(a / y); elseif (z <= -9.5e-7) tmp = Float64(t / b); elseif (z <= 4.4e+14) tmp = fma(fma(x, z, x), z, x); else tmp = Float64(a / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.85e+171], N[(a / y), $MachinePrecision], If[LessEqual[z, -9.5e-7], N[(t / b), $MachinePrecision], If[LessEqual[z, 4.4e+14], N[(N[(x * z + x), $MachinePrecision] * z + x), $MachinePrecision], N[(a / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+171}:\\
\;\;\;\;\frac{a}{y}\\
\mathbf{elif}\;z \leq -9.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, z, x\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{y}\\
\end{array}
\end{array}
if z < -1.84999999999999999e171 or 4.4e14 < z Initial program 37.1%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6436.1
Applied rewrites36.1%
Taylor expanded in z around inf
Applied rewrites52.6%
Taylor expanded in b around 0
Applied rewrites30.5%
if -1.84999999999999999e171 < z < -9.5000000000000001e-7Initial program 60.5%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6449.7
Applied rewrites49.7%
Taylor expanded in y around 0
Applied rewrites38.0%
if -9.5000000000000001e-7 < z < 4.4e14Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around 0
Applied rewrites48.5%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.85e+171) (/ a y) (if (<= z -9e-7) (/ t b) (if (<= z 4.4e+14) (fma x z x) (/ a y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.85e+171) {
tmp = a / y;
} else if (z <= -9e-7) {
tmp = t / b;
} else if (z <= 4.4e+14) {
tmp = fma(x, z, x);
} else {
tmp = a / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.85e+171) tmp = Float64(a / y); elseif (z <= -9e-7) tmp = Float64(t / b); elseif (z <= 4.4e+14) tmp = fma(x, z, x); else tmp = Float64(a / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.85e+171], N[(a / y), $MachinePrecision], If[LessEqual[z, -9e-7], N[(t / b), $MachinePrecision], If[LessEqual[z, 4.4e+14], N[(x * z + x), $MachinePrecision], N[(a / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+171}:\\
\;\;\;\;\frac{a}{y}\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-7}:\\
\;\;\;\;\frac{t}{b}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{y}\\
\end{array}
\end{array}
if z < -1.84999999999999999e171 or 4.4e14 < z Initial program 37.1%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6436.1
Applied rewrites36.1%
Taylor expanded in z around inf
Applied rewrites52.6%
Taylor expanded in b around 0
Applied rewrites30.5%
if -1.84999999999999999e171 < z < -8.99999999999999959e-7Initial program 60.5%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6449.7
Applied rewrites49.7%
Taylor expanded in y around 0
Applied rewrites38.0%
if -8.99999999999999959e-7 < z < 4.4e14Initial program 88.4%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.6
Applied rewrites48.6%
Taylor expanded in z around 0
Applied rewrites48.3%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a t) (- y b)))) (if (<= z -2.4e-8) t_1 (if (<= z 4400000.0) (fma (/ t y) z x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -2.4e-8) {
tmp = t_1;
} else if (z <= 4400000.0) {
tmp = fma((t / y), z, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -2.4e-8) tmp = t_1; elseif (z <= 4400000.0) tmp = fma(Float64(t / y), z, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e-8], t$95$1, If[LessEqual[z, 4400000.0], N[(N[(t / y), $MachinePrecision] * z + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4400000:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.39999999999999998e-8 or 4.4e6 < z Initial program 44.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.9
Applied rewrites81.9%
if -2.39999999999999998e-8 < z < 4.4e6Initial program 88.3%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
difference-of-squaresN/A
lift--.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f6472.5
Applied rewrites72.5%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
associate--r+N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6452.3
Applied rewrites52.3%
Taylor expanded in t around inf
Applied rewrites56.2%
Final simplification70.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a t) (- y b)))) (if (<= z -3.7e-16) t_1 (if (<= z 2.5e-5) (/ x (- 1.0 z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a - t) / (y - b);
double tmp;
if (z <= -3.7e-16) {
tmp = t_1;
} else if (z <= 2.5e-5) {
tmp = x / (1.0 - z);
} 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 = (a - t) / (y - b)
if (z <= (-3.7d-16)) then
tmp = t_1
else if (z <= 2.5d-5) then
tmp = x / (1.0d0 - z)
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 = (a - t) / (y - b);
double tmp;
if (z <= -3.7e-16) {
tmp = t_1;
} else if (z <= 2.5e-5) {
tmp = x / (1.0 - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (a - t) / (y - b) tmp = 0 if z <= -3.7e-16: tmp = t_1 elif z <= 2.5e-5: tmp = x / (1.0 - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(a - t) / Float64(y - b)) tmp = 0.0 if (z <= -3.7e-16) tmp = t_1; elseif (z <= 2.5e-5) tmp = Float64(x / Float64(1.0 - z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (a - t) / (y - b); tmp = 0.0; if (z <= -3.7e-16) tmp = t_1; elseif (z <= 2.5e-5) tmp = x / (1.0 - z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.7e-16], t$95$1, If[LessEqual[z, 2.5e-5], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.7e-16 or 2.50000000000000012e-5 < z Initial program 44.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.4
Applied rewrites80.4%
if -3.7e-16 < z < 2.50000000000000012e-5Initial program 88.8%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6450.1
Applied rewrites50.1%
Final simplification67.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (- 1.0 z)))) (if (<= y -620000000.0) t_1 (if (<= y 1.75) (/ (- 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 <= -620000000.0) {
tmp = t_1;
} else if (y <= 1.75) {
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 <= (-620000000.0d0)) then
tmp = t_1
else if (y <= 1.75d0) 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 <= -620000000.0) {
tmp = t_1;
} else if (y <= 1.75) {
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 <= -620000000.0: tmp = t_1 elif y <= 1.75: 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 <= -620000000.0) tmp = t_1; elseif (y <= 1.75) 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 <= -620000000.0) tmp = t_1; elseif (y <= 1.75) 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, -620000000.0], t$95$1, If[LessEqual[y, 1.75], 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 -620000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.75:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -6.2e8 or 1.75 < y Initial program 50.8%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.3
Applied rewrites48.3%
if -6.2e8 < y < 1.75Initial program 79.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6460.0
Applied rewrites60.0%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.8e-16) (/ t (- b y)) (if (<= z 1.05e+16) (/ x (- 1.0 z)) (/ (- a) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.8e-16) {
tmp = t / (b - y);
} else if (z <= 1.05e+16) {
tmp = x / (1.0 - z);
} else {
tmp = -a / b;
}
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) :: tmp
if (z <= (-3.8d-16)) then
tmp = t / (b - y)
else if (z <= 1.05d+16) then
tmp = x / (1.0d0 - z)
else
tmp = -a / b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.8e-16) {
tmp = t / (b - y);
} else if (z <= 1.05e+16) {
tmp = x / (1.0 - z);
} else {
tmp = -a / b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -3.8e-16: tmp = t / (b - y) elif z <= 1.05e+16: tmp = x / (1.0 - z) else: tmp = -a / b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.8e-16) tmp = Float64(t / Float64(b - y)); elseif (z <= 1.05e+16) tmp = Float64(x / Float64(1.0 - z)); else tmp = Float64(Float64(-a) / b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -3.8e-16) tmp = t / (b - y); elseif (z <= 1.05e+16) tmp = x / (1.0 - z); else tmp = -a / b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.8e-16], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+16], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], N[((-a) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-16}:\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{b}\\
\end{array}
\end{array}
if z < -3.80000000000000012e-16Initial program 40.1%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6432.2
Applied rewrites32.2%
Taylor expanded in z around inf
Applied rewrites52.7%
if -3.80000000000000012e-16 < z < 1.05e16Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.9
Applied rewrites48.9%
if 1.05e16 < z Initial program 49.8%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6444.4
Applied rewrites44.4%
Taylor expanded in b around inf
Applied rewrites39.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.8e-16) (/ t (- b y)) (if (<= z 1.05e+15) (fma (fma x z x) z x) (/ (- a) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.8e-16) {
tmp = t / (b - y);
} else if (z <= 1.05e+15) {
tmp = fma(fma(x, z, x), z, x);
} else {
tmp = -a / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.8e-16) tmp = Float64(t / Float64(b - y)); elseif (z <= 1.05e+15) tmp = fma(fma(x, z, x), z, x); else tmp = Float64(Float64(-a) / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.8e-16], N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e+15], N[(N[(x * z + x), $MachinePrecision] * z + x), $MachinePrecision], N[((-a) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-16}:\\
\;\;\;\;\frac{t}{b - y}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(x, z, x\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{b}\\
\end{array}
\end{array}
if z < -3.80000000000000012e-16Initial program 40.1%
Taylor expanded in a around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6432.2
Applied rewrites32.2%
Taylor expanded in z around inf
Applied rewrites52.7%
if -3.80000000000000012e-16 < z < 1.05e15Initial program 88.3%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6448.9
Applied rewrites48.9%
Taylor expanded in z around 0
Applied rewrites48.9%
if 1.05e15 < z Initial program 49.8%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6444.4
Applied rewrites44.4%
Taylor expanded in b around inf
Applied rewrites39.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -0.0033) (/ a y) (if (<= z 4.4e+14) (fma x z x) (/ a y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -0.0033) {
tmp = a / y;
} else if (z <= 4.4e+14) {
tmp = fma(x, z, x);
} else {
tmp = a / y;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -0.0033) tmp = Float64(a / y); elseif (z <= 4.4e+14) tmp = fma(x, z, x); else tmp = Float64(a / y); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -0.0033], N[(a / y), $MachinePrecision], If[LessEqual[z, 4.4e+14], N[(x * z + x), $MachinePrecision], N[(a / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0033:\\
\;\;\;\;\frac{a}{y}\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+14}:\\
\;\;\;\;\mathsf{fma}\left(x, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{y}\\
\end{array}
\end{array}
if z < -0.0033 or 4.4e14 < z Initial program 43.1%
Taylor expanded in a around inf
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f6432.6
Applied rewrites32.6%
Taylor expanded in z around inf
Applied rewrites45.3%
Taylor expanded in b around 0
Applied rewrites24.5%
if -0.0033 < z < 4.4e14Initial program 88.6%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6447.8
Applied rewrites47.8%
Taylor expanded in z around 0
Applied rewrites47.6%
(FPCore (x y z t a b) :precision binary64 (fma x z x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, z, x);
}
function code(x, y, z, t, a, b) return fma(x, z, x) end
code[x_, y_, z_, t_, a_, b_] := N[(x * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, z, x\right)
\end{array}
Initial program 64.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6431.5
Applied rewrites31.5%
Taylor expanded in z around 0
Applied rewrites23.3%
(FPCore (x y z t a b) :precision binary64 (* z x))
double code(double x, double y, double z, double t, double a, double b) {
return z * 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 = z * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return z * x;
}
def code(x, y, z, t, a, b): return z * x
function code(x, y, z, t, a, b) return Float64(z * x) end
function tmp = code(x, y, z, t, a, b) tmp = z * x; end
code[x_, y_, z_, t_, a_, b_] := N[(z * x), $MachinePrecision]
\begin{array}{l}
\\
z \cdot x
\end{array}
Initial program 64.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6431.5
Applied rewrites31.5%
Taylor expanded in z around 0
Applied rewrites23.3%
Taylor expanded in z around inf
Applied rewrites3.2%
Final simplification3.2%
(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 2024235
(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)))))