
(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 (/ 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 47.0%
Taylor expanded in y around inf 99.8%
*-commutative99.8%
associate-/l*99.7%
Applied egg-rr99.7%
clear-num99.6%
un-div-inv99.8%
Applied egg-rr99.8%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 99.0%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (/ (+ y t) z)) (if (<= z 0.006) (* x (- (/ y z) t)) (* x (+ (/ y z) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 0.006) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y / z) + (t / 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 <= (-1.0d0)) then
tmp = x * ((y + t) / z)
else if (z <= 0.006d0) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y / z) + (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 0.006) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y / z) + (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * ((y + t) / z) elif z <= 0.006: tmp = x * ((y / z) - t) else: tmp = x * ((y / z) + (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 0.006) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y / z) + Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * ((y + t) / z); elseif (z <= 0.006) tmp = x * ((y / z) - t); else tmp = x * ((y / z) + (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.006], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 0.006:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -1Initial program 98.5%
Taylor expanded in z around inf 87.8%
associate-/l*97.8%
cancel-sign-sub-inv97.8%
metadata-eval97.8%
*-lft-identity97.8%
+-commutative97.8%
Simplified97.8%
if -1 < z < 0.0060000000000000001Initial program 92.0%
Taylor expanded in z around 0 92.0%
if 0.0060000000000000001 < z Initial program 99.7%
Taylor expanded in z around inf 99.6%
associate-*r/99.6%
neg-mul-199.6%
Simplified99.6%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.006))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 0.006)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
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 <= (-1.0d0)) .or. (.not. (z <= 0.006d0))) then
tmp = x * ((y + t) / z)
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 0.006)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 0.006): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.006)) tmp = Float64(x * Float64(Float64(y + t) / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 0.006))) tmp = x * ((y + t) / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.006]], $MachinePrecision]], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.006\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 0.0060000000000000001 < z Initial program 99.0%
Taylor expanded in z around inf 86.1%
associate-/l*98.6%
cancel-sign-sub-inv98.6%
metadata-eval98.6%
*-lft-identity98.6%
+-commutative98.6%
Simplified98.6%
if -1 < z < 0.0060000000000000001Initial program 92.0%
Taylor expanded in z around 0 92.0%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (<= y -1.9e-123) (* y (/ x z)) (if (<= y 0.112) (* t (/ x (+ z -1.0))) (/ y (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e-123) {
tmp = y * (x / z);
} else if (y <= 0.112) {
tmp = t * (x / (z + -1.0));
} else {
tmp = y / (z / x);
}
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 (y <= (-1.9d-123)) then
tmp = y * (x / z)
else if (y <= 0.112d0) then
tmp = t * (x / (z + (-1.0d0)))
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e-123) {
tmp = y * (x / z);
} else if (y <= 0.112) {
tmp = t * (x / (z + -1.0));
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.9e-123: tmp = y * (x / z) elif y <= 0.112: tmp = t * (x / (z + -1.0)) else: tmp = y / (z / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.9e-123) tmp = Float64(y * Float64(x / z)); elseif (y <= 0.112) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.9e-123) tmp = y * (x / z); elseif (y <= 0.112) tmp = t * (x / (z + -1.0)); else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.9e-123], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.112], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-123}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 0.112:\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < -1.89999999999999998e-123Initial program 93.4%
Taylor expanded in y around inf 78.1%
*-commutative78.1%
associate-/l*79.3%
Applied egg-rr79.3%
if -1.89999999999999998e-123 < y < 0.112000000000000002Initial program 98.8%
Taylor expanded in y around 0 79.8%
mul-1-neg79.8%
associate-/l*77.1%
distribute-rgt-neg-in77.1%
distribute-neg-frac277.1%
neg-sub077.1%
associate--r-77.1%
metadata-eval77.1%
Simplified77.1%
if 0.112000000000000002 < y Initial program 94.5%
Taylor expanded in y around inf 78.1%
*-commutative78.1%
associate-/l*80.6%
Applied egg-rr80.6%
clear-num80.5%
un-div-inv80.8%
Applied egg-rr80.8%
Final simplification78.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.8e-123) (not (<= y 0.112))) (* y (/ x z)) (* x (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e-123) || !(y <= 0.112)) {
tmp = y * (x / z);
} else {
tmp = x * (t / 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 ((y <= (-1.8d-123)) .or. (.not. (y <= 0.112d0))) then
tmp = y * (x / z)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.8e-123) || !(y <= 0.112)) {
tmp = y * (x / z);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.8e-123) or not (y <= 0.112): tmp = y * (x / z) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.8e-123) || !(y <= 0.112)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.8e-123) || ~((y <= 0.112))) tmp = y * (x / z); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.8e-123], N[Not[LessEqual[y, 0.112]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-123} \lor \neg \left(y \leq 0.112\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -1.7999999999999998e-123 or 0.112000000000000002 < y Initial program 93.9%
Taylor expanded in y around inf 78.1%
*-commutative78.1%
associate-/l*79.9%
Applied egg-rr79.9%
if -1.7999999999999998e-123 < y < 0.112000000000000002Initial program 98.8%
Taylor expanded in z around inf 61.1%
associate-/l*63.9%
cancel-sign-sub-inv63.9%
metadata-eval63.9%
*-lft-identity63.9%
+-commutative63.9%
Simplified63.9%
Taylor expanded in t around inf 58.2%
Final simplification71.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.15e+246) (not (<= t 7e+241))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.15e+246) || !(t <= 7e+241)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
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 ((t <= (-2.15d+246)) .or. (.not. (t <= 7d+241))) then
tmp = x * (t / z)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.15e+246) || !(t <= 7e+241)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.15e+246) or not (t <= 7e+241): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.15e+246) || !(t <= 7e+241)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.15e+246) || ~((t <= 7e+241))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.15e+246], N[Not[LessEqual[t, 7e+241]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{+246} \lor \neg \left(t \leq 7 \cdot 10^{+241}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -2.15000000000000014e246 or 7e241 < t Initial program 97.3%
Taylor expanded in z around inf 54.1%
associate-/l*65.8%
cancel-sign-sub-inv65.8%
metadata-eval65.8%
*-lft-identity65.8%
+-commutative65.8%
Simplified65.8%
Taylor expanded in t around inf 64.3%
if -2.15000000000000014e246 < t < 7e241Initial program 95.5%
Taylor expanded in y around inf 68.2%
associate-*r/71.9%
Simplified71.9%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 850.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 850.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
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 <= (-1.0d0)) .or. (.not. (z <= 850.0d0))) then
tmp = x * (t / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 850.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 850.0): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 850.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 850.0))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 850.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 850\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 850 < z Initial program 99.0%
Taylor expanded in z around inf 85.9%
associate-/l*98.6%
cancel-sign-sub-inv98.6%
metadata-eval98.6%
*-lft-identity98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in t around inf 58.9%
if -1 < z < 850Initial program 92.2%
Taylor expanded in y around 0 34.5%
mul-1-neg34.5%
associate-/l*34.5%
distribute-rgt-neg-in34.5%
distribute-neg-frac234.5%
neg-sub034.5%
associate--r-34.5%
metadata-eval34.5%
Simplified34.5%
Taylor expanded in z around 0 34.6%
neg-mul-134.6%
Simplified34.6%
Final simplification47.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 850.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 850.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
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 <= (-1.0d0)) .or. (.not. (z <= 850.0d0))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 850.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 850.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 850.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 850.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 850.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 850\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 850 < z Initial program 99.0%
Taylor expanded in y around 0 54.3%
mul-1-neg54.3%
associate-/l*53.1%
distribute-rgt-neg-in53.1%
distribute-neg-frac253.1%
neg-sub053.1%
associate--r-53.1%
metadata-eval53.1%
Simplified53.1%
Taylor expanded in z around inf 52.6%
if -1 < z < 850Initial program 92.2%
Taylor expanded in y around 0 34.5%
mul-1-neg34.5%
associate-/l*34.5%
distribute-rgt-neg-in34.5%
distribute-neg-frac234.5%
neg-sub034.5%
associate--r-34.5%
metadata-eval34.5%
Simplified34.5%
Taylor expanded in z around 0 34.6%
neg-mul-134.6%
Simplified34.6%
Final simplification44.0%
(FPCore (x y z t) :precision binary64 (if (<= y -1.9e-123) (* y (/ x z)) (if (<= y 0.112) (* x (/ t z)) (/ y (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e-123) {
tmp = y * (x / z);
} else if (y <= 0.112) {
tmp = x * (t / z);
} else {
tmp = y / (z / x);
}
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 (y <= (-1.9d-123)) then
tmp = y * (x / z)
else if (y <= 0.112d0) then
tmp = x * (t / z)
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e-123) {
tmp = y * (x / z);
} else if (y <= 0.112) {
tmp = x * (t / z);
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.9e-123: tmp = y * (x / z) elif y <= 0.112: tmp = x * (t / z) else: tmp = y / (z / x) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.9e-123) tmp = Float64(y * Float64(x / z)); elseif (y <= 0.112) tmp = Float64(x * Float64(t / z)); else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.9e-123) tmp = y * (x / z); elseif (y <= 0.112) tmp = x * (t / z); else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.9e-123], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.112], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-123}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 0.112:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if y < -1.89999999999999998e-123Initial program 93.4%
Taylor expanded in y around inf 78.1%
*-commutative78.1%
associate-/l*79.3%
Applied egg-rr79.3%
if -1.89999999999999998e-123 < y < 0.112000000000000002Initial program 98.8%
Taylor expanded in z around inf 61.1%
associate-/l*63.9%
cancel-sign-sub-inv63.9%
metadata-eval63.9%
*-lft-identity63.9%
+-commutative63.9%
Simplified63.9%
Taylor expanded in t around inf 58.2%
if 0.112000000000000002 < y Initial program 94.5%
Taylor expanded in y around inf 78.1%
*-commutative78.1%
associate-/l*80.6%
Applied egg-rr80.6%
clear-num80.5%
un-div-inv80.8%
Applied egg-rr80.8%
(FPCore (x y z t) :precision binary64 (if (<= z 850.0) (* x (- t)) (* t x)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 850.0) {
tmp = x * -t;
} else {
tmp = t * x;
}
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 <= 850.0d0) then
tmp = x * -t
else
tmp = t * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 850.0) {
tmp = x * -t;
} else {
tmp = t * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 850.0: tmp = x * -t else: tmp = t * x return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 850.0) tmp = Float64(x * Float64(-t)); else tmp = Float64(t * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 850.0) tmp = x * -t; else tmp = t * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 850.0], N[(x * (-t)), $MachinePrecision], N[(t * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 850:\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot x\\
\end{array}
\end{array}
if z < 850Initial program 94.6%
Taylor expanded in y around 0 43.4%
mul-1-neg43.4%
associate-/l*42.4%
distribute-rgt-neg-in42.4%
distribute-neg-frac242.4%
neg-sub042.4%
associate--r-42.4%
metadata-eval42.4%
Simplified42.4%
Taylor expanded in z around 0 27.7%
neg-mul-127.7%
Simplified27.7%
if 850 < z Initial program 99.7%
Taylor expanded in y around 0 49.8%
mul-1-neg49.8%
associate-/l*50.3%
distribute-rgt-neg-in50.3%
distribute-neg-frac250.3%
neg-sub050.3%
associate--r-50.3%
metadata-eval50.3%
Simplified50.3%
Taylor expanded in z around 0 6.9%
neg-mul-16.9%
Simplified6.9%
neg-sub06.9%
sub-neg6.9%
add-sqr-sqrt3.3%
sqrt-unprod17.0%
sqr-neg17.0%
sqrt-unprod7.3%
add-sqr-sqrt14.5%
Applied egg-rr14.5%
+-lft-identity14.5%
Simplified14.5%
Final simplification24.7%
(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 * 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 x
\end{array}
Initial program 95.8%
Taylor expanded in y around 0 44.9%
mul-1-neg44.9%
associate-/l*44.2%
distribute-rgt-neg-in44.2%
distribute-neg-frac244.2%
neg-sub044.2%
associate--r-44.2%
metadata-eval44.2%
Simplified44.2%
Taylor expanded in z around 0 22.9%
neg-mul-122.9%
Simplified22.9%
neg-sub022.9%
sub-neg22.9%
add-sqr-sqrt11.0%
sqrt-unprod22.3%
sqr-neg22.3%
sqrt-unprod5.8%
add-sqr-sqrt12.3%
Applied egg-rr12.3%
+-lft-identity12.3%
Simplified12.3%
(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 2024152
(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)))))