
(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 10 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 (+ (/ y z) (/ t (+ z -1.0))))) (if (<= t_1 (- INFINITY)) (/ y (/ z x)) (* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y / (z / x);
} else {
tmp = t_1 * x;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y / (z / x);
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= -math.inf: tmp = y / (z / x) else: tmp = t_1 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y / Float64(z / x)); else tmp = Float64(t_1 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); tmp = 0.0; if (t_1 <= -Inf) tmp = y / (z / x); else tmp = t_1 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 68.5%
Taylor expanded in y around inf
/-lowering-/.f6468.5
Simplified68.5%
associate-*r/N/A
/-lowering-/.f64N/A
*-commutativeN/A
*-lowering-*.f6499.9
Applied egg-rr99.9%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64100.0
Applied egg-rr100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 96.9%
Final simplification97.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (+ z -1.0)))))
(if (<= t -3.9e+86)
t_1
(if (<= t -1.1e-237)
(* (/ y z) x)
(if (<= t 5.5e+65) (/ (* y x) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -3.9e+86) {
tmp = t_1;
} else if (t <= -1.1e-237) {
tmp = (y / z) * x;
} else if (t <= 5.5e+65) {
tmp = (y * 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 = x * (t / (z + (-1.0d0)))
if (t <= (-3.9d+86)) then
tmp = t_1
else if (t <= (-1.1d-237)) then
tmp = (y / z) * x
else if (t <= 5.5d+65) then
tmp = (y * 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 = x * (t / (z + -1.0));
double tmp;
if (t <= -3.9e+86) {
tmp = t_1;
} else if (t <= -1.1e-237) {
tmp = (y / z) * x;
} else if (t <= 5.5e+65) {
tmp = (y * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -3.9e+86: tmp = t_1 elif t <= -1.1e-237: tmp = (y / z) * x elif t <= 5.5e+65: tmp = (y * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t <= -3.9e+86) tmp = t_1; elseif (t <= -1.1e-237) tmp = Float64(Float64(y / z) * x); elseif (t <= 5.5e+65) tmp = Float64(Float64(y * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z + -1.0)); tmp = 0.0; if (t <= -3.9e+86) tmp = t_1; elseif (t <= -1.1e-237) tmp = (y / z) * x; elseif (t <= 5.5e+65) tmp = (y * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.9e+86], t$95$1, If[LessEqual[t, -1.1e-237], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 5.5e+65], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -3.9 \cdot 10^{+86}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.1 \cdot 10^{-237}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+65}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -3.9000000000000002e86 or 5.4999999999999996e65 < t Initial program 98.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6477.9
Simplified77.9%
if -3.9000000000000002e86 < t < -1.09999999999999999e-237Initial program 96.9%
Taylor expanded in y around inf
/-lowering-/.f6478.9
Simplified78.9%
if -1.09999999999999999e-237 < t < 5.4999999999999996e65Initial program 90.1%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6481.6
Simplified81.6%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ y t) z)))) (if (<= z -2e-10) t_1 (if (<= z 2.2e-12) (/ (* x (- y (* z t))) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + t) / z);
double tmp;
if (z <= -2e-10) {
tmp = t_1;
} else if (z <= 2.2e-12) {
tmp = (x * (y - (z * t))) / 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 = x * ((y + t) / z)
if (z <= (-2d-10)) then
tmp = t_1
else if (z <= 2.2d-12) then
tmp = (x * (y - (z * t))) / 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 + t) / z);
double tmp;
if (z <= -2e-10) {
tmp = t_1;
} else if (z <= 2.2e-12) {
tmp = (x * (y - (z * t))) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + t) / z) tmp = 0 if z <= -2e-10: tmp = t_1 elif z <= 2.2e-12: tmp = (x * (y - (z * t))) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + t) / z)) tmp = 0.0 if (z <= -2e-10) tmp = t_1; elseif (z <= 2.2e-12) tmp = Float64(Float64(x * Float64(y - Float64(z * t))) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + t) / z); tmp = 0.0; if (z <= -2e-10) tmp = t_1; elseif (z <= 2.2e-12) tmp = (x * (y - (z * t))) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e-10], t$95$1, If[LessEqual[z, 2.2e-12], N[(N[(x * N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -2 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;\frac{x \cdot \left(y - z \cdot t\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.00000000000000007e-10 or 2.19999999999999992e-12 < z Initial program 97.3%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6496.3
Simplified96.3%
if -2.00000000000000007e-10 < z < 2.19999999999999992e-12Initial program 92.8%
Taylor expanded in z around 0
/-lowering-/.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
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f6494.5
Simplified94.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= t -1.05e+134)
t_1
(if (<= t -2e-242)
(* (/ y z) x)
(if (<= t 4.4e+150) (/ (* y x) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -1.05e+134) {
tmp = t_1;
} else if (t <= -2e-242) {
tmp = (y / z) * x;
} else if (t <= 4.4e+150) {
tmp = (y * 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 = x * (t / z)
if (t <= (-1.05d+134)) then
tmp = t_1
else if (t <= (-2d-242)) then
tmp = (y / z) * x
else if (t <= 4.4d+150) then
tmp = (y * 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 = x * (t / z);
double tmp;
if (t <= -1.05e+134) {
tmp = t_1;
} else if (t <= -2e-242) {
tmp = (y / z) * x;
} else if (t <= 4.4e+150) {
tmp = (y * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -1.05e+134: tmp = t_1 elif t <= -2e-242: tmp = (y / z) * x elif t <= 4.4e+150: tmp = (y * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -1.05e+134) tmp = t_1; elseif (t <= -2e-242) tmp = Float64(Float64(y / z) * x); elseif (t <= 4.4e+150) tmp = Float64(Float64(y * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -1.05e+134) tmp = t_1; elseif (t <= -2e-242) tmp = (y / z) * x; elseif (t <= 4.4e+150) tmp = (y * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.05e+134], t$95$1, If[LessEqual[t, -2e-242], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 4.4e+150], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2 \cdot 10^{-242}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{+150}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.05e134 or 4.39999999999999999e150 < t Initial program 98.6%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6465.9
Simplified65.9%
Taylor expanded in y around 0
/-lowering-/.f6456.7
Simplified56.7%
if -1.05e134 < t < -2e-242Initial program 97.2%
Taylor expanded in y around inf
/-lowering-/.f6476.5
Simplified76.5%
if -2e-242 < t < 4.39999999999999999e150Initial program 91.6%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6476.0
Simplified76.0%
Final simplification70.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ y t) z)))) (if (<= z -7.2e+17) t_1 (if (<= z 2.2e-12) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + t) / z);
double tmp;
if (z <= -7.2e+17) {
tmp = t_1;
} else if (z <= 2.2e-12) {
tmp = x * ((y / z) - t);
} 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 = x * ((y + t) / z)
if (z <= (-7.2d+17)) then
tmp = t_1
else if (z <= 2.2d-12) then
tmp = x * ((y / z) - t)
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 + t) / z);
double tmp;
if (z <= -7.2e+17) {
tmp = t_1;
} else if (z <= 2.2e-12) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + t) / z) tmp = 0 if z <= -7.2e+17: tmp = t_1 elif z <= 2.2e-12: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + t) / z)) tmp = 0.0 if (z <= -7.2e+17) tmp = t_1; elseif (z <= 2.2e-12) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + t) / z); tmp = 0.0; if (z <= -7.2e+17) tmp = t_1; elseif (z <= 2.2e-12) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.2e+17], t$95$1, If[LessEqual[z, 2.2e-12], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -7.2 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -7.2e17 or 2.19999999999999992e-12 < z Initial program 97.2%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6496.1
Simplified96.1%
if -7.2e17 < z < 2.19999999999999992e-12Initial program 93.1%
Taylor expanded in z around 0
Simplified93.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= z -2.2e+95) t_1 (if (<= z 1.35e+16) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -2.2e+95) {
tmp = t_1;
} else if (z <= 1.35e+16) {
tmp = x * ((y / z) - t);
} 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 = x * (t / z)
if (z <= (-2.2d+95)) then
tmp = t_1
else if (z <= 1.35d+16) then
tmp = x * ((y / z) - t)
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 * (t / z);
double tmp;
if (z <= -2.2e+95) {
tmp = t_1;
} else if (z <= 1.35e+16) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -2.2e+95: tmp = t_1 elif z <= 1.35e+16: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -2.2e+95) tmp = t_1; elseif (z <= 1.35e+16) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (z <= -2.2e+95) tmp = t_1; elseif (z <= 1.35e+16) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+95], t$95$1, If[LessEqual[z, 1.35e+16], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+16}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1999999999999999e95 or 1.35e16 < z Initial program 96.7%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6496.7
Simplified96.7%
Taylor expanded in y around 0
/-lowering-/.f6461.6
Simplified61.6%
if -2.1999999999999999e95 < z < 1.35e16Initial program 94.0%
Taylor expanded in z around 0
Simplified88.3%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= t -5.2e+134) t_1 (if (<= t 4e+150) (* (/ y z) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -5.2e+134) {
tmp = t_1;
} else if (t <= 4e+150) {
tmp = (y / z) * 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 = x * (t / z)
if (t <= (-5.2d+134)) then
tmp = t_1
else if (t <= 4d+150) then
tmp = (y / z) * 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 = x * (t / z);
double tmp;
if (t <= -5.2e+134) {
tmp = t_1;
} else if (t <= 4e+150) {
tmp = (y / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -5.2e+134: tmp = t_1 elif t <= 4e+150: tmp = (y / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -5.2e+134) tmp = t_1; elseif (t <= 4e+150) tmp = Float64(Float64(y / z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -5.2e+134) tmp = t_1; elseif (t <= 4e+150) tmp = (y / z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.2e+134], t$95$1, If[LessEqual[t, 4e+150], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -5.2 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+150}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.2000000000000003e134 or 3.99999999999999992e150 < t Initial program 98.6%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6465.9
Simplified65.9%
Taylor expanded in y around 0
/-lowering-/.f6456.7
Simplified56.7%
if -5.2000000000000003e134 < t < 3.99999999999999992e150Initial program 93.7%
Taylor expanded in y around inf
/-lowering-/.f6473.7
Simplified73.7%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= z -0.76) t_1 (if (<= z 1.0) (- (* x (fma t z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -0.76) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = -(x * fma(t, z, t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -0.76) tmp = t_1; elseif (z <= 1.0) tmp = Float64(-Float64(x * fma(t, z, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.76], t$95$1, If[LessEqual[z, 1.0], (-N[(x * N[(t * z + t), $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -0.76:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;-x \cdot \mathsf{fma}\left(t, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.76000000000000001 or 1 < z Initial program 97.3%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6496.2
Simplified96.2%
Taylor expanded in y around 0
/-lowering-/.f6458.6
Simplified58.6%
if -0.76000000000000001 < z < 1Initial program 93.0%
sub-negN/A
+-commutativeN/A
distribute-neg-frac2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f6493.0
Applied egg-rr93.0%
Taylor expanded in z around 0
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6493.0
Simplified93.0%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6439.9
Simplified39.9%
Final simplification49.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* t (/ x z)))) (if (<= z -0.76) t_1 (if (<= z 1.0) (- (* x (fma t z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / z);
double tmp;
if (z <= -0.76) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = -(x * fma(t, z, t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(t * Float64(x / z)) tmp = 0.0 if (z <= -0.76) tmp = t_1; elseif (z <= 1.0) tmp = Float64(-Float64(x * fma(t, z, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.76], t$95$1, If[LessEqual[z, 1.0], (-N[(x * N[(t * z + t), $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -0.76:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;-x \cdot \mathsf{fma}\left(t, z, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.76000000000000001 or 1 < z Initial program 97.3%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6496.2
Simplified96.2%
Taylor expanded in y around 0
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f6453.6
Simplified53.6%
if -0.76000000000000001 < z < 1Initial program 93.0%
sub-negN/A
+-commutativeN/A
distribute-neg-frac2N/A
div-invN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f6493.0
Applied egg-rr93.0%
Taylor expanded in z around 0
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f6493.0
Simplified93.0%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
+-commutativeN/A
distribute-lft-inN/A
*-rgt-identityN/A
accelerator-lowering-fma.f6439.9
Simplified39.9%
Final simplification47.0%
(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(t * Float64(-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}
\\
t \cdot \left(-x\right)
\end{array}
Initial program 95.2%
Taylor expanded in z around 0
Simplified62.9%
Taylor expanded in y around 0
mul-1-negN/A
neg-lowering-neg.f6424.7
Simplified24.7%
Final simplification24.7%
(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 2024205
(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)))))