
(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 11 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 (/ x z)) (* 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 * (x / z);
} 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 * (x / z);
} 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 * (x / z) 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(x / z)); 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 * (x / z); 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[(x / z), $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:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\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 64.8%
Taylor expanded in y around inf
lower-/.f6464.8
Simplified64.8%
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6499.7
Applied egg-rr99.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-/.f6499.9
Applied egg-rr99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 97.5%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (<= z -0.75) (* x (/ (+ y t) z)) (if (<= z 1.0) (* x (- (/ y z) (fma z t t))) (/ x (/ z (+ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.75) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - fma(z, t, t));
} else {
tmp = x / (z / (y + t));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -0.75) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - fma(z, t, t))); else tmp = Float64(x / Float64(z / Float64(y + t))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.75], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - N[(z * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, t, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -0.75Initial program 98.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6497.9
Simplified97.9%
if -0.75 < z < 1Initial program 93.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.5
Simplified92.5%
if 1 < z Initial program 97.9%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6497.1
Simplified97.1%
lift-+.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6497.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.2
Applied egg-rr97.2%
Final simplification94.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ y t) z)))) (if (<= z -0.75) t_1 (if (<= z 1.0) (* x (- (/ y z) (fma z t t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + t) / z);
double tmp;
if (z <= -0.75) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * ((y / z) - fma(z, t, 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 <= -0.75) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - fma(z, t, t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.75], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - N[(z * t + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \mathsf{fma}\left(z, t, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.75 or 1 < z Initial program 98.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6497.5
Simplified97.5%
if -0.75 < z < 1Initial program 93.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.5
Simplified92.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ y t) z)))) (if (<= z -1.0) t_1 (if (<= z 1.0) (* x (fma t -1.0 (/ y z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + t) / z);
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * fma(t, -1.0, (y / 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 <= -1.0) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * fma(t, -1.0, Float64(y / z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(t * -1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \mathsf{fma}\left(t, -1, \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 98.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6497.5
Simplified97.5%
if -1 < z < 1Initial program 93.2%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
div-invN/A
lower-fma.f64N/A
lower-/.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6493.3
Applied egg-rr93.3%
Taylor expanded in z around 0
Simplified92.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ y t) z)))) (if (<= z -1.1e-99) t_1 (if (<= z 2.5e-61) (* y (/ x z)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + t) / z);
double tmp;
if (z <= -1.1e-99) {
tmp = t_1;
} else if (z <= 2.5e-61) {
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 * ((y + t) / z)
if (z <= (-1.1d-99)) then
tmp = t_1
else if (z <= 2.5d-61) 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 * ((y + t) / z);
double tmp;
if (z <= -1.1e-99) {
tmp = t_1;
} else if (z <= 2.5e-61) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + t) / z) tmp = 0 if z <= -1.1e-99: tmp = t_1 elif z <= 2.5e-61: tmp = y * (x / 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 <= -1.1e-99) tmp = t_1; elseif (z <= 2.5e-61) tmp = Float64(y * Float64(x / 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 <= -1.1e-99) tmp = t_1; elseif (z <= 2.5e-61) 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[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.1e-99], t$95$1, If[LessEqual[z, 2.5e-61], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{-99}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-61}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.10000000000000002e-99 or 2.4999999999999999e-61 < z Initial program 98.5%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6490.2
Simplified90.2%
if -1.10000000000000002e-99 < z < 2.4999999999999999e-61Initial program 90.8%
Taylor expanded in y around inf
lower-/.f6470.7
Simplified70.7%
lift-/.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6477.1
Applied egg-rr77.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.1
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-/.f6477.2
Applied egg-rr77.2%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t (+ z -1.0))))) (if (<= t -1.02e+21) t_1 (if (<= t 1.8e+165) (* (/ y z) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -1.02e+21) {
tmp = t_1;
} else if (t <= 1.8e+165) {
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 + (-1.0d0)))
if (t <= (-1.02d+21)) then
tmp = t_1
else if (t <= 1.8d+165) 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 + -1.0));
double tmp;
if (t <= -1.02e+21) {
tmp = t_1;
} else if (t <= 1.8e+165) {
tmp = (y / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -1.02e+21: tmp = t_1 elif t <= 1.8e+165: tmp = (y / z) * x 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 <= -1.02e+21) tmp = t_1; elseif (t <= 1.8e+165) 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 + -1.0)); tmp = 0.0; if (t <= -1.02e+21) tmp = t_1; elseif (t <= 1.8e+165) 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 / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.02e+21], t$95$1, If[LessEqual[t, 1.8e+165], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -1.02 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{+165}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.02e21 or 1.7999999999999999e165 < t Initial program 95.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.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
lower-+.f6478.9
Simplified78.9%
if -1.02e21 < t < 1.7999999999999999e165Initial program 95.6%
Taylor expanded in y around inf
lower-/.f6481.4
Simplified81.4%
Final simplification80.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= t -1.5e+148) t_1 (if (<= t 3e+165) (* (/ 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 <= -1.5e+148) {
tmp = t_1;
} else if (t <= 3e+165) {
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 <= (-1.5d+148)) then
tmp = t_1
else if (t <= 3d+165) 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 <= -1.5e+148) {
tmp = t_1;
} else if (t <= 3e+165) {
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 <= -1.5e+148: tmp = t_1 elif t <= 3e+165: 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 <= -1.5e+148) tmp = t_1; elseif (t <= 3e+165) 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 <= -1.5e+148) tmp = t_1; elseif (t <= 3e+165) 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, -1.5e+148], t$95$1, If[LessEqual[t, 3e+165], 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 -1.5 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+165}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.50000000000000007e148 or 2.9999999999999999e165 < t Initial program 95.3%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6467.6
Simplified67.6%
Taylor expanded in y around 0
lower-/.f6459.6
Simplified59.6%
if -1.50000000000000007e148 < t < 2.9999999999999999e165Initial program 95.5%
Taylor expanded in y around inf
lower-/.f6478.1
Simplified78.1%
Final simplification73.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= z -0.75) t_1 (if (<= z 1.0) (* x (* t (- -1.0 z))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -0.75) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * (t * (-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) :: tmp
t_1 = x * (t / z)
if (z <= (-0.75d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = x * (t * ((-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 * (t / z);
double tmp;
if (z <= -0.75) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = x * (t * (-1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -0.75: tmp = t_1 elif z <= 1.0: tmp = x * (t * (-1.0 - z)) 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.75) tmp = t_1; elseif (z <= 1.0) tmp = Float64(x * Float64(t * Float64(-1.0 - 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 (z <= -0.75) tmp = t_1; elseif (z <= 1.0) tmp = x * (t * (-1.0 - 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[z, -0.75], t$95$1, If[LessEqual[z, 1.0], N[(x * N[(t * N[(-1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(t \cdot \left(-1 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.75 or 1 < z Initial program 98.1%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower-+.f6497.5
Simplified97.5%
Taylor expanded in y around 0
lower-/.f6458.4
Simplified58.4%
if -0.75 < z < 1Initial program 93.2%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6492.5
Simplified92.5%
Taylor expanded in y around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-rgt-neg-inN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
sub-negN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f6435.1
Simplified35.1%
(FPCore (x y z t) :precision binary64 (if (<= z -4e+36) (* z (* t (- x))) (* x (* t (- -1.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+36) {
tmp = z * (t * -x);
} else {
tmp = x * (t * (-1.0 - z));
}
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) :: tmp
if (z <= (-4d+36)) then
tmp = z * (t * -x)
else
tmp = x * (t * ((-1.0d0) - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4e+36) {
tmp = z * (t * -x);
} else {
tmp = x * (t * (-1.0 - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4e+36: tmp = z * (t * -x) else: tmp = x * (t * (-1.0 - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4e+36) tmp = Float64(z * Float64(t * Float64(-x))); else tmp = Float64(x * Float64(t * Float64(-1.0 - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4e+36) tmp = z * (t * -x); else tmp = x * (t * (-1.0 - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4e+36], N[(z * N[(t * (-x)), $MachinePrecision]), $MachinePrecision], N[(x * N[(t * N[(-1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+36}:\\
\;\;\;\;z \cdot \left(t \cdot \left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t \cdot \left(-1 - z\right)\right)\\
\end{array}
\end{array}
if z < -4.00000000000000017e36Initial program 98.1%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f645.6
Simplified5.6%
Taylor expanded in z around inf
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6413.3
Simplified13.3%
if -4.00000000000000017e36 < z Initial program 94.7%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6468.9
Simplified68.9%
Taylor expanded in y around 0
mul-1-negN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
*-rgt-identityN/A
distribute-lft-inN/A
distribute-rgt-neg-inN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
sub-negN/A
lower-*.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f6426.2
Simplified26.2%
(FPCore (x y z t) :precision binary64 (* z (* t (- x))))
double code(double x, double y, double z, double t) {
return z * (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 = z * (t * -x)
end function
public static double code(double x, double y, double z, double t) {
return z * (t * -x);
}
def code(x, y, z, t): return z * (t * -x)
function code(x, y, z, t) return Float64(z * Float64(t * Float64(-x))) end
function tmp = code(x, y, z, t) tmp = z * (t * -x); end
code[x_, y_, z_, t_] := N[(z * N[(t * (-x)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(t \cdot \left(-x\right)\right)
\end{array}
Initial program 95.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6455.8
Simplified55.8%
Taylor expanded in z around inf
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6410.6
Simplified10.6%
(FPCore (x y z t) :precision binary64 (* x (* z (- t))))
double code(double x, double y, double z, double t) {
return x * (z * -t);
}
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 * -t)
end function
public static double code(double x, double y, double z, double t) {
return x * (z * -t);
}
def code(x, y, z, t): return x * (z * -t)
function code(x, y, z, t) return Float64(x * Float64(z * Float64(-t))) end
function tmp = code(x, y, z, t) tmp = x * (z * -t); end
code[x_, y_, z_, t_] := N[(x * N[(z * (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(z \cdot \left(-t\right)\right)
\end{array}
Initial program 95.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f6455.8
Simplified55.8%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f646.6
Simplified6.6%
(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 2024207
(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)))))