
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) y)) (t_2 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+292) (* x t_2) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+292) {
tmp = x * t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 1e+292) {
tmp = x * t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * y t_2 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 1e+292: tmp = x * t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * y) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+292) tmp = Float64(x * t_2); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * y; t_2 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 1e+292) tmp = x * t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+292], N[(x * t$95$2), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot y\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+292}:\\
\;\;\;\;x \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 1e292 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 63.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1e292Initial program 97.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x y) z)) (t_2 (* (- (/ y z) t) x)))
(if (<= y -4e+61)
t_1
(if (<= y -2.4e-143)
t_2
(if (<= y 3.8e-185)
(/ (* x t) (- z 1.0))
(if (<= y 1.18e-20) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * y) / z;
double t_2 = ((y / z) - t) * x;
double tmp;
if (y <= -4e+61) {
tmp = t_1;
} else if (y <= -2.4e-143) {
tmp = t_2;
} else if (y <= 3.8e-185) {
tmp = (x * t) / (z - 1.0);
} else if (y <= 1.18e-20) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * y) / z
t_2 = ((y / z) - t) * x
if (y <= (-4d+61)) then
tmp = t_1
else if (y <= (-2.4d-143)) then
tmp = t_2
else if (y <= 3.8d-185) then
tmp = (x * t) / (z - 1.0d0)
else if (y <= 1.18d-20) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * y) / z;
double t_2 = ((y / z) - t) * x;
double tmp;
if (y <= -4e+61) {
tmp = t_1;
} else if (y <= -2.4e-143) {
tmp = t_2;
} else if (y <= 3.8e-185) {
tmp = (x * t) / (z - 1.0);
} else if (y <= 1.18e-20) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * y) / z t_2 = ((y / z) - t) * x tmp = 0 if y <= -4e+61: tmp = t_1 elif y <= -2.4e-143: tmp = t_2 elif y <= 3.8e-185: tmp = (x * t) / (z - 1.0) elif y <= 1.18e-20: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * y) / z) t_2 = Float64(Float64(Float64(y / z) - t) * x) tmp = 0.0 if (y <= -4e+61) tmp = t_1; elseif (y <= -2.4e-143) tmp = t_2; elseif (y <= 3.8e-185) tmp = Float64(Float64(x * t) / Float64(z - 1.0)); elseif (y <= 1.18e-20) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * y) / z; t_2 = ((y / z) - t) * x; tmp = 0.0; if (y <= -4e+61) tmp = t_1; elseif (y <= -2.4e-143) tmp = t_2; elseif (y <= 3.8e-185) tmp = (x * t) / (z - 1.0); elseif (y <= 1.18e-20) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -4e+61], t$95$1, If[LessEqual[y, -2.4e-143], t$95$2, If[LessEqual[y, 3.8e-185], N[(N[(x * t), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.18e-20], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{z}\\
t_2 := \left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{if}\;y \leq -4 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-143}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{-185}:\\
\;\;\;\;\frac{x \cdot t}{z - 1}\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{-20}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.9999999999999998e61 or 1.1800000000000001e-20 < y Initial program 88.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
if -3.9999999999999998e61 < y < -2.3999999999999999e-143 or 3.7999999999999999e-185 < y < 1.1800000000000001e-20Initial program 98.6%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6469.4
Applied rewrites69.4%
Taylor expanded in t around inf
Applied rewrites29.3%
Taylor expanded in t around 0
Applied rewrites73.6%
if -2.3999999999999999e-143 < y < 3.7999999999999999e-185Initial program 93.9%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6475.8
Applied rewrites75.8%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (* x y) z)) (t_2 (* (- (/ y z) t) x)))
(if (<= y -4e+61)
t_1
(if (<= y -2.1e-179)
t_2
(if (<= y 5.6e-226) (* (/ t z) x) (if (<= y 1.18e-20) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * y) / z;
double t_2 = ((y / z) - t) * x;
double tmp;
if (y <= -4e+61) {
tmp = t_1;
} else if (y <= -2.1e-179) {
tmp = t_2;
} else if (y <= 5.6e-226) {
tmp = (t / z) * x;
} else if (y <= 1.18e-20) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * y) / z
t_2 = ((y / z) - t) * x
if (y <= (-4d+61)) then
tmp = t_1
else if (y <= (-2.1d-179)) then
tmp = t_2
else if (y <= 5.6d-226) then
tmp = (t / z) * x
else if (y <= 1.18d-20) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * y) / z;
double t_2 = ((y / z) - t) * x;
double tmp;
if (y <= -4e+61) {
tmp = t_1;
} else if (y <= -2.1e-179) {
tmp = t_2;
} else if (y <= 5.6e-226) {
tmp = (t / z) * x;
} else if (y <= 1.18e-20) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * y) / z t_2 = ((y / z) - t) * x tmp = 0 if y <= -4e+61: tmp = t_1 elif y <= -2.1e-179: tmp = t_2 elif y <= 5.6e-226: tmp = (t / z) * x elif y <= 1.18e-20: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * y) / z) t_2 = Float64(Float64(Float64(y / z) - t) * x) tmp = 0.0 if (y <= -4e+61) tmp = t_1; elseif (y <= -2.1e-179) tmp = t_2; elseif (y <= 5.6e-226) tmp = Float64(Float64(t / z) * x); elseif (y <= 1.18e-20) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * y) / z; t_2 = ((y / z) - t) * x; tmp = 0.0; if (y <= -4e+61) tmp = t_1; elseif (y <= -2.1e-179) tmp = t_2; elseif (y <= 5.6e-226) tmp = (t / z) * x; elseif (y <= 1.18e-20) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -4e+61], t$95$1, If[LessEqual[y, -2.1e-179], t$95$2, If[LessEqual[y, 5.6e-226], N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 1.18e-20], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{z}\\
t_2 := \left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{if}\;y \leq -4 \cdot 10^{+61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.1 \cdot 10^{-179}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-226}:\\
\;\;\;\;\frac{t}{z} \cdot x\\
\mathbf{elif}\;y \leq 1.18 \cdot 10^{-20}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.9999999999999998e61 or 1.1800000000000001e-20 < y Initial program 88.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
if -3.9999999999999998e61 < y < -2.0999999999999999e-179 or 5.60000000000000016e-226 < y < 1.1800000000000001e-20Initial program 98.8%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
Taylor expanded in t around inf
Applied rewrites31.9%
Taylor expanded in t around 0
Applied rewrites71.2%
if -2.0999999999999999e-179 < y < 5.60000000000000016e-226Initial program 92.0%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-addN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6461.6
Applied rewrites61.6%
Taylor expanded in z around inf
lower-/.f64N/A
lower-+.f6475.2
Applied rewrites75.2%
Taylor expanded in t around inf
Applied rewrites69.1%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -6.5e-29) t_1 (if (<= z 1.0) (/ (* (- y (* t z)) x) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -6.5e-29) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = ((y - (t * z)) * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) / z) * x
if (z <= (-6.5d-29)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = ((y - (t * z)) * x) / z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -6.5e-29) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = ((y - (t * z)) * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -6.5e-29: tmp = t_1 elif z <= 1.0: tmp = ((y - (t * z)) * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -6.5e-29) tmp = t_1; elseif (z <= 1.0) tmp = Float64(Float64(Float64(y - Float64(t * z)) * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((t + y) / z) * x; tmp = 0.0; if (z <= -6.5e-29) tmp = t_1; elseif (z <= 1.0) tmp = ((y - (t * z)) * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -6.5e-29], t$95$1, If[LessEqual[z, 1.0], N[(N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{\left(y - t \cdot z\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.5e-29 or 1 < z Initial program 96.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6496.2
Applied rewrites96.2%
if -6.5e-29 < z < 1Initial program 88.6%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6496.3
Applied rewrites96.3%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -75000000.0) t_1 (if (<= z 1.0) (* (- (/ y z) t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -75000000.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = ((y / z) - t) * x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = ((t + y) / z) * x
if (z <= (-75000000.0d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = ((y / z) - t) * x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -75000000.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = ((y / z) - t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -75000000.0: tmp = t_1 elif z <= 1.0: tmp = ((y / z) - t) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -75000000.0) tmp = t_1; elseif (z <= 1.0) tmp = Float64(Float64(Float64(y / z) - t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((t + y) / z) * x; tmp = 0.0; if (z <= -75000000.0) tmp = t_1; elseif (z <= 1.0) tmp = ((y / z) - t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -75000000.0], t$95$1, If[LessEqual[z, 1.0], N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -75000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.5e7 or 1 < z Initial program 96.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6496.1
Applied rewrites96.1%
if -7.5e7 < z < 1Initial program 89.1%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6496.4
Applied rewrites96.4%
Taylor expanded in t around inf
Applied rewrites26.2%
Taylor expanded in t around 0
Applied rewrites88.6%
Final simplification92.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ t z) x))) (if (<= t -4.8e+84) t_1 (if (<= t 6.8e+111) (/ (* x y) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t / z) * x;
double tmp;
if (t <= -4.8e+84) {
tmp = t_1;
} else if (t <= 6.8e+111) {
tmp = (x * y) / z;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (t / z) * x
if (t <= (-4.8d+84)) then
tmp = t_1
else if (t <= 6.8d+111) then
tmp = (x * y) / z
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (t / z) * x;
double tmp;
if (t <= -4.8e+84) {
tmp = t_1;
} else if (t <= 6.8e+111) {
tmp = (x * y) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t / z) * x tmp = 0 if t <= -4.8e+84: tmp = t_1 elif t <= 6.8e+111: tmp = (x * y) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t / z) * x) tmp = 0.0 if (t <= -4.8e+84) tmp = t_1; elseif (t <= 6.8e+111) tmp = Float64(Float64(x * y) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t / z) * x; tmp = 0.0; if (t <= -4.8e+84) tmp = t_1; elseif (t <= 6.8e+111) tmp = (x * y) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -4.8e+84], t$95$1, If[LessEqual[t, 6.8e+111], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{z} \cdot x\\
\mathbf{if}\;t \leq -4.8 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{+111}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -4.7999999999999999e84 or 6.8000000000000003e111 < t Initial program 92.1%
lift--.f64N/A
sub-negN/A
lift-/.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
frac-addN/A
lower-/.f64N/A
lower-fma.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6455.4
Applied rewrites55.4%
Taylor expanded in z around inf
lower-/.f64N/A
lower-+.f6464.7
Applied rewrites64.7%
Taylor expanded in t around inf
Applied rewrites58.3%
if -4.7999999999999999e84 < t < 6.8000000000000003e111Initial program 92.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.7
Applied rewrites82.7%
Final simplification74.5%
(FPCore (x y z t) :precision binary64 (/ (* x y) z))
double code(double x, double y, double z, double t) {
return (x * y) / z;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * y) / z
end function
public static double code(double x, double y, double z, double t) {
return (x * y) / z;
}
def code(x, y, z, t): return (x * y) / z
function code(x, y, z, t) return Float64(Float64(x * y) / z) end
function tmp = code(x, y, z, t) tmp = (x * y) / z; end
code[x_, y_, z_, t_] := N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y}{z}
\end{array}
Initial program 92.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.0
Applied rewrites65.0%
Final simplification65.0%
(FPCore (x y z t) :precision binary64 (* (/ x z) y))
double code(double x, double y, double z, double t) {
return (x / z) * y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x / z) * y
end function
public static double code(double x, double y, double z, double t) {
return (x / z) * y;
}
def code(x, y, z, t): return (x / z) * y
function code(x, y, z, t) return Float64(Float64(x / z) * y) end
function tmp = code(x, y, z, t) tmp = (x / z) * y; end
code[x_, y_, z_, t_] := N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z} \cdot y
\end{array}
Initial program 92.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6465.0
Applied rewrites65.0%
Applied rewrites60.8%
(FPCore (x y z t) :precision binary64 (* (- t) x))
double code(double x, double y, double z, double t) {
return -t * x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t * x
end function
public static double code(double x, double y, double z, double t) {
return -t * x;
}
def code(x, y, z, t): return -t * x
function code(x, y, z, t) return Float64(Float64(-t) * x) end
function tmp = code(x, y, z, t) tmp = -t * x; end
code[x_, y_, z_, t_] := N[((-t) * x), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) \cdot x
\end{array}
Initial program 92.5%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6467.3
Applied rewrites67.3%
Taylor expanded in t around inf
Applied rewrites20.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * 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 t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024249
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))