
(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 15 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 (- (/ -1.0 (/ z (* (/ y (- y b)) x))) (/ (- a t) (- b y)))))
(if (<= z -2000000000.0)
t_1
(if (<= z 25000000000.0)
(/ (- (* 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 = (-1.0 / (z / ((y / (y - b)) * x))) - ((a - t) / (b - y));
double tmp;
if (z <= -2000000000.0) {
tmp = t_1;
} else if (z <= 25000000000.0) {
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 = ((-1.0d0) / (z / ((y / (y - b)) * x))) - ((a - t) / (b - y))
if (z <= (-2000000000.0d0)) then
tmp = t_1
else if (z <= 25000000000.0d0) 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 = (-1.0 / (z / ((y / (y - b)) * x))) - ((a - t) / (b - y));
double tmp;
if (z <= -2000000000.0) {
tmp = t_1;
} else if (z <= 25000000000.0) {
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 = (-1.0 / (z / ((y / (y - b)) * x))) - ((a - t) / (b - y)) tmp = 0 if z <= -2000000000.0: tmp = t_1 elif z <= 25000000000.0: 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(-1.0 / Float64(z / Float64(Float64(y / Float64(y - b)) * x))) - Float64(Float64(a - t) / Float64(b - y))) tmp = 0.0 if (z <= -2000000000.0) tmp = t_1; elseif (z <= 25000000000.0) 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 = (-1.0 / (z / ((y / (y - b)) * x))) - ((a - t) / (b - y)); tmp = 0.0; if (z <= -2000000000.0) tmp = t_1; elseif (z <= 25000000000.0) 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[(-1.0 / N[(z / N[(N[(y / N[(y - b), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(a - t), $MachinePrecision] / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2000000000.0], t$95$1, If[LessEqual[z, 25000000000.0], 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{-1}{\frac{z}{\frac{y}{y - b} \cdot x}} - \frac{a - t}{b - y}\\
\mathbf{if}\;z \leq -2000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 25000000000:\\
\;\;\;\;\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 < -2e9 or 2.5e10 < z Initial program 48.6%
Taylor expanded in z around inf
Applied rewrites92.7%
Taylor expanded in x around inf
Applied rewrites87.2%
Applied rewrites99.7%
if -2e9 < z < 2.5e10Initial program 86.0%
Final simplification93.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (/ (- a t) (- y b)) (/ (/ (* y x) (- y b)) z))))
(if (<= z -10200000000000.0)
t_1
(if (<= z 2.7e+15)
(/ (- (* 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)) - (((y * x) / (y - b)) / z);
double tmp;
if (z <= -10200000000000.0) {
tmp = t_1;
} else if (z <= 2.7e+15) {
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)) - (((y * x) / (y - b)) / z)
if (z <= (-10200000000000.0d0)) then
tmp = t_1
else if (z <= 2.7d+15) 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)) - (((y * x) / (y - b)) / z);
double tmp;
if (z <= -10200000000000.0) {
tmp = t_1;
} else if (z <= 2.7e+15) {
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)) - (((y * x) / (y - b)) / z) tmp = 0 if z <= -10200000000000.0: tmp = t_1 elif z <= 2.7e+15: 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(Float64(a - t) / Float64(y - b)) - Float64(Float64(Float64(y * x) / Float64(y - b)) / z)) tmp = 0.0 if (z <= -10200000000000.0) tmp = t_1; elseif (z <= 2.7e+15) 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)) - (((y * x) / (y - b)) / z); tmp = 0.0; if (z <= -10200000000000.0) tmp = t_1; elseif (z <= 2.7e+15) 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[(N[(a - t), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(y * x), $MachinePrecision] / N[(y - b), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -10200000000000.0], t$95$1, If[LessEqual[z, 2.7e+15], 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} - \frac{\frac{y \cdot x}{y - b}}{z}\\
\mathbf{if}\;z \leq -10200000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+15}:\\
\;\;\;\;\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.02e13 or 2.7e15 < z Initial program 48.2%
Taylor expanded in z around inf
Applied rewrites92.6%
Taylor expanded in x around inf
Applied rewrites87.6%
if -1.02e13 < z < 2.7e15Initial program 85.6%
Final simplification86.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -3.4e+76)
t_1
(if (<= z 2.55e+23)
(/ (- (* 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 <= -3.4e+76) {
tmp = t_1;
} else if (z <= 2.55e+23) {
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 <= (-3.4d+76)) then
tmp = t_1
else if (z <= 2.55d+23) 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 <= -3.4e+76) {
tmp = t_1;
} else if (z <= 2.55e+23) {
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 <= -3.4e+76: tmp = t_1 elif z <= 2.55e+23: 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 <= -3.4e+76) tmp = t_1; elseif (z <= 2.55e+23) 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 <= -3.4e+76) tmp = t_1; elseif (z <= 2.55e+23) 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, -3.4e+76], t$95$1, If[LessEqual[z, 2.55e+23], 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 -3.4 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+23}:\\
\;\;\;\;\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 < -3.3999999999999997e76 or 2.5500000000000001e23 < z Initial program 43.7%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6481.4
Applied rewrites81.4%
if -3.3999999999999997e76 < z < 2.5500000000000001e23Initial program 85.6%
Final simplification83.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- a t) (- y b))))
(if (<= z -2.75e-61)
t_1
(if (<= z 4.8e-42) (fma (- (/ (- t a) y) (- x)) 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.75e-61) {
tmp = t_1;
} else if (z <= 4.8e-42) {
tmp = fma((((t - a) / y) - -x), 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.75e-61) tmp = t_1; elseif (z <= 4.8e-42) tmp = fma(Float64(Float64(Float64(t - a) / y) - Float64(-x)), 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.75e-61], t$95$1, If[LessEqual[z, 4.8e-42], N[(N[(N[(N[(t - a), $MachinePrecision] / y), $MachinePrecision] - (-x)), $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.75 \cdot 10^{-61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - a}{y} - \left(-x\right), z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.7499999999999998e-61 or 4.80000000000000005e-42 < z Initial program 53.3%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6476.7
Applied rewrites76.7%
if -2.7499999999999998e-61 < z < 4.80000000000000005e-42Initial program 84.8%
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--.f6459.1
Applied rewrites59.1%
Taylor expanded in b around 0
Applied rewrites75.1%
Final simplification76.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a t) (- y b)))) (if (<= z -6e-111) t_1 (if (<= z 4.4e-42) (fma (/ (- a) 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 <= -6e-111) {
tmp = t_1;
} else if (z <= 4.4e-42) {
tmp = fma((-a / 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 <= -6e-111) tmp = t_1; elseif (z <= 4.4e-42) tmp = fma(Float64(Float64(-a) / 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, -6e-111], t$95$1, If[LessEqual[z, 4.4e-42], N[(N[((-a) / 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 -6 \cdot 10^{-111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-a}{y}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.00000000000000016e-111 or 4.4000000000000001e-42 < z Initial program 55.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6473.9
Applied rewrites73.9%
if -6.00000000000000016e-111 < z < 4.4000000000000001e-42Initial program 84.8%
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--.f6461.8
Applied rewrites61.8%
Taylor expanded in a around inf
Applied rewrites69.8%
Final simplification72.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a t) (- y b)))) (if (<= z -1.2e-112) t_1 (if (<= z 4.4e-42) (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 <= -1.2e-112) {
tmp = t_1;
} else if (z <= 4.4e-42) {
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 <= -1.2e-112) tmp = t_1; elseif (z <= 4.4e-42) 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, -1.2e-112], t$95$1, If[LessEqual[z, 4.4e-42], 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 -1.2 \cdot 10^{-112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t}{y}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2e-112 or 4.4000000000000001e-42 < z Initial program 56.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6473.5
Applied rewrites73.5%
if -1.2e-112 < z < 4.4000000000000001e-42Initial program 84.6%
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--.f6461.4
Applied rewrites61.4%
Taylor expanded in t around inf
Applied rewrites69.2%
Final simplification72.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a t) (- y b)))) (if (<= z -7.2e-113) t_1 (if (<= z 7.4e-62) (fma z x 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.2e-113) {
tmp = t_1;
} else if (z <= 7.4e-62) {
tmp = fma(z, x, 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.2e-113) tmp = t_1; elseif (z <= 7.4e-62) tmp = fma(z, x, 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.2e-113], t$95$1, If[LessEqual[z, 7.4e-62], N[(z * x + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a - t}{y - b}\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{-113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{-62}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.1999999999999995e-113 or 7.3999999999999996e-62 < z Initial program 56.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6473.5
Applied rewrites73.5%
if -7.1999999999999995e-113 < z < 7.3999999999999996e-62Initial program 84.6%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6462.6
Applied rewrites62.6%
Taylor expanded in z around 0
Applied rewrites62.6%
Final simplification69.6%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ x (- 1.0 z)))) (if (<= y -5.6e+15) t_1 (if (<= y 3.3e-39) (/ (- 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 <= -5.6e+15) {
tmp = t_1;
} else if (y <= 3.3e-39) {
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 <= (-5.6d+15)) then
tmp = t_1
else if (y <= 3.3d-39) 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 <= -5.6e+15) {
tmp = t_1;
} else if (y <= 3.3e-39) {
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 <= -5.6e+15: tmp = t_1 elif y <= 3.3e-39: 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 <= -5.6e+15) tmp = t_1; elseif (y <= 3.3e-39) 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 <= -5.6e+15) tmp = t_1; elseif (y <= 3.3e-39) 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, -5.6e+15], t$95$1, If[LessEqual[y, 3.3e-39], 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 -5.6 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{-39}:\\
\;\;\;\;\frac{t - a}{b}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.6e15 or 3.29999999999999985e-39 < y Initial program 51.9%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6456.8
Applied rewrites56.8%
if -5.6e15 < y < 3.29999999999999985e-39Initial program 79.1%
Taylor expanded in y around 0
lower-/.f64N/A
lower--.f6455.2
Applied rewrites55.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= z -2.4e+111) t_1 (if (<= z 6.6e-52) (/ x (- 1.0 z)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -2.4e+111) {
tmp = t_1;
} else if (z <= 6.6e-52) {
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 = t / (b - y)
if (z <= (-2.4d+111)) then
tmp = t_1
else if (z <= 6.6d-52) 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 = t / (b - y);
double tmp;
if (z <= -2.4e+111) {
tmp = t_1;
} else if (z <= 6.6e-52) {
tmp = x / (1.0 - z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t / (b - y) tmp = 0 if z <= -2.4e+111: tmp = t_1 elif z <= 6.6e-52: tmp = x / (1.0 - z) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(b - y)) tmp = 0.0 if (z <= -2.4e+111) tmp = t_1; elseif (z <= 6.6e-52) 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 = t / (b - y); tmp = 0.0; if (z <= -2.4e+111) tmp = t_1; elseif (z <= 6.6e-52) 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[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+111], t$95$1, If[LessEqual[z, 6.6e-52], N[(x / N[(1.0 - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+111}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-52}:\\
\;\;\;\;\frac{x}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.40000000000000006e111 or 6.5999999999999999e-52 < z Initial program 48.8%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6480.4
Applied rewrites80.4%
Taylor expanded in a around 0
Applied rewrites49.1%
if -2.40000000000000006e111 < z < 6.5999999999999999e-52Initial program 83.2%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6451.8
Applied rewrites51.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ t (- b y)))) (if (<= z -1.2e-112) t_1 (if (<= z 6.6e-52) (fma z x x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t / (b - y);
double tmp;
if (z <= -1.2e-112) {
tmp = t_1;
} else if (z <= 6.6e-52) {
tmp = fma(z, x, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t / Float64(b - y)) tmp = 0.0 if (z <= -1.2e-112) tmp = t_1; elseif (z <= 6.6e-52) tmp = fma(z, x, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e-112], t$95$1, If[LessEqual[z, 6.6e-52], N[(z * x + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{-112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.2e-112 or 6.5999999999999999e-52 < z Initial program 56.1%
Taylor expanded in z around inf
lower-/.f64N/A
lower--.f64N/A
lower--.f6473.5
Applied rewrites73.5%
Taylor expanded in a around 0
Applied rewrites43.7%
if -1.2e-112 < z < 6.5999999999999999e-52Initial program 84.6%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6462.6
Applied rewrites62.6%
Taylor expanded in z around 0
Applied rewrites62.6%
(FPCore (x y z t a b) :precision binary64 (if (<= z -5.5e+19) (/ x (- z)) (if (<= z 2e-42) (fma z x x) (/ (- a) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5.5e+19) {
tmp = x / -z;
} else if (z <= 2e-42) {
tmp = fma(z, x, x);
} else {
tmp = -a / b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5.5e+19) tmp = Float64(x / Float64(-z)); elseif (z <= 2e-42) tmp = fma(z, x, x); else tmp = Float64(Float64(-a) / b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5.5e+19], N[(x / (-z)), $MachinePrecision], If[LessEqual[z, 2e-42], N[(z * x + x), $MachinePrecision], N[((-a) / b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+19}:\\
\;\;\;\;\frac{x}{-z}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-42}:\\
\;\;\;\;\mathsf{fma}\left(z, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-a}{b}\\
\end{array}
\end{array}
if z < -5.5e19Initial program 40.5%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6428.5
Applied rewrites28.5%
Taylor expanded in z around inf
Applied rewrites28.5%
if -5.5e19 < z < 2.00000000000000008e-42Initial program 84.3%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6453.8
Applied rewrites53.8%
Taylor expanded in z around 0
Applied rewrites53.8%
if 2.00000000000000008e-42 < z Initial program 60.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--.f6428.6
Applied rewrites28.6%
Taylor expanded in b around inf
Applied rewrites18.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- a) b))) (if (<= z -1.16e-15) t_1 (if (<= z 2e-42) (/ x 1.0) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -a / b;
double tmp;
if (z <= -1.16e-15) {
tmp = t_1;
} else if (z <= 2e-42) {
tmp = x / 1.0;
} 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 / b
if (z <= (-1.16d-15)) then
tmp = t_1
else if (z <= 2d-42) then
tmp = x / 1.0d0
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 / b;
double tmp;
if (z <= -1.16e-15) {
tmp = t_1;
} else if (z <= 2e-42) {
tmp = x / 1.0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = -a / b tmp = 0 if z <= -1.16e-15: tmp = t_1 elif z <= 2e-42: tmp = x / 1.0 else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) / b) tmp = 0.0 if (z <= -1.16e-15) tmp = t_1; elseif (z <= 2e-42) tmp = Float64(x / 1.0); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = -a / b; tmp = 0.0; if (z <= -1.16e-15) tmp = t_1; elseif (z <= 2e-42) tmp = x / 1.0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[((-a) / b), $MachinePrecision]}, If[LessEqual[z, -1.16e-15], t$95$1, If[LessEqual[z, 2e-42], N[(x / 1.0), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-a}{b}\\
\mathbf{if}\;z \leq -1.16 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-42}:\\
\;\;\;\;\frac{x}{1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1599999999999999e-15 or 2.00000000000000008e-42 < z Initial program 52.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--.f6426.8
Applied rewrites26.8%
Taylor expanded in b around inf
Applied rewrites21.4%
if -1.1599999999999999e-15 < z < 2.00000000000000008e-42Initial program 84.5%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6455.3
Applied rewrites55.3%
Taylor expanded in z around 0
Applied rewrites55.3%
(FPCore (x y z t a b) :precision binary64 (fma (fma z x x) z x))
double code(double x, double y, double z, double t, double a, double b) {
return fma(fma(z, x, x), z, x);
}
function code(x, y, z, t, a, b) return fma(fma(z, x, x), z, x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(z * x + x), $MachinePrecision] * z + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(z, x, x\right), z, x\right)
\end{array}
Initial program 66.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6435.5
Applied rewrites35.5%
Taylor expanded in z around 0
Applied rewrites26.3%
(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.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6435.5
Applied rewrites35.5%
Taylor expanded in z around 0
Applied rewrites25.6%
(FPCore (x y z t a b) :precision binary64 (* x z))
double code(double x, double y, double z, double t, double a, double b) {
return x * 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 * z
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * z;
}
def code(x, y, z, t, a, b): return x * z
function code(x, y, z, t, a, b) return Float64(x * z) end
function tmp = code(x, y, z, t, a, b) tmp = x * z; end
code[x_, y_, z_, t_, a_, b_] := N[(x * z), $MachinePrecision]
\begin{array}{l}
\\
x \cdot z
\end{array}
Initial program 66.1%
Taylor expanded in y around inf
lower-/.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f6435.5
Applied rewrites35.5%
Taylor expanded in z around 0
Applied rewrites25.6%
Taylor expanded in z around inf
Applied rewrites3.4%
Final simplification3.4%
(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 2024270
(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)))))