
(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 (+ (/ y z) (/ t (+ z -1.0)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e+296)))
(* 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)) || !(t_1 <= 4e+296)) {
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) || !(t_1 <= 4e+296)) {
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) or not (t_1 <= 4e+296): 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)) || !(t_1 <= 4e+296)) 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) || ~((t_1 <= 4e+296))) 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e+296]], $MachinePrecision]], 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 \lor \neg \left(t\_1 \leq 4 \cdot 10^{+296}\right):\\
\;\;\;\;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.0 or 3.99999999999999993e296 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 63.7%
Taylor expanded in z around 0 63.7%
Taylor expanded in y around inf 95.1%
+-commutative95.1%
mul-1-neg95.1%
unsub-neg95.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 3.99999999999999993e296Initial program 98.7%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -165000.0) (not (<= z 1.0))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -165000.0) || !(z <= 1.0)) {
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 <= (-165000.0d0)) .or. (.not. (z <= 1.0d0))) 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 <= -165000.0) || !(z <= 1.0)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -165000.0) or not (z <= 1.0): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -165000.0) || !(z <= 1.0)) 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 <= -165000.0) || ~((z <= 1.0))) 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, -165000.0], N[Not[LessEqual[z, 1.0]], $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 -165000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -165000 or 1 < z Initial program 97.9%
Taylor expanded in z around inf 81.5%
associate-/l*96.5%
cancel-sign-sub-inv96.5%
metadata-eval96.5%
*-lft-identity96.5%
+-commutative96.5%
Simplified96.5%
if -165000 < z < 1Initial program 87.9%
Taylor expanded in z around 0 86.8%
Final simplification91.7%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3.9e-46) (not (<= y 5.2e-110))) (* y (/ x z)) (* t (/ x (+ z -1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.9e-46) || !(y <= 5.2e-110)) {
tmp = y * (x / z);
} else {
tmp = t * (x / (z + -1.0));
}
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 <= (-3.9d-46)) .or. (.not. (y <= 5.2d-110))) then
tmp = y * (x / z)
else
tmp = t * (x / (z + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3.9e-46) || !(y <= 5.2e-110)) {
tmp = y * (x / z);
} else {
tmp = t * (x / (z + -1.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3.9e-46) or not (y <= 5.2e-110): tmp = y * (x / z) else: tmp = t * (x / (z + -1.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3.9e-46) || !(y <= 5.2e-110)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t * Float64(x / Float64(z + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3.9e-46) || ~((y <= 5.2e-110))) tmp = y * (x / z); else tmp = t * (x / (z + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3.9e-46], N[Not[LessEqual[y, 5.2e-110]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-46} \lor \neg \left(y \leq 5.2 \cdot 10^{-110}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\end{array}
\end{array}
if y < -3.9000000000000003e-46 or 5.19999999999999979e-110 < y Initial program 90.4%
Taylor expanded in z around 0 67.6%
Taylor expanded in y around inf 71.0%
+-commutative71.0%
mul-1-neg71.0%
unsub-neg71.0%
associate-/l*72.2%
Simplified72.2%
Taylor expanded in z around 0 78.9%
if -3.9000000000000003e-46 < y < 5.19999999999999979e-110Initial program 97.4%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
associate-/l*70.6%
distribute-rgt-neg-in70.6%
distribute-neg-frac270.6%
neg-sub070.6%
associate--r-70.6%
metadata-eval70.6%
Simplified70.6%
Final simplification75.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.2e-10) (not (<= y 1.55e-109))) (* y (/ x z)) (/ (* t x) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e-10) || !(y <= 1.55e-109)) {
tmp = y * (x / z);
} else {
tmp = (t * x) / 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.2d-10)) .or. (.not. (y <= 1.55d-109))) then
tmp = y * (x / z)
else
tmp = (t * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.2e-10) || !(y <= 1.55e-109)) {
tmp = y * (x / z);
} else {
tmp = (t * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.2e-10) or not (y <= 1.55e-109): tmp = y * (x / z) else: tmp = (t * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.2e-10) || !(y <= 1.55e-109)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(t * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.2e-10) || ~((y <= 1.55e-109))) tmp = y * (x / z); else tmp = (t * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.2e-10], N[Not[LessEqual[y, 1.55e-109]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-10} \lor \neg \left(y \leq 1.55 \cdot 10^{-109}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\end{array}
\end{array}
if y < -1.2e-10 or 1.55e-109 < y Initial program 90.1%
Taylor expanded in z around 0 67.8%
Taylor expanded in y around inf 71.3%
+-commutative71.3%
mul-1-neg71.3%
unsub-neg71.3%
associate-/l*72.5%
Simplified72.5%
Taylor expanded in z around 0 80.0%
if -1.2e-10 < y < 1.55e-109Initial program 97.5%
add-cube-cbrt95.9%
pow395.9%
Applied egg-rr95.9%
Taylor expanded in z around inf 56.6%
cancel-sign-sub-inv56.6%
metadata-eval56.6%
*-lft-identity56.6%
Simplified56.6%
Taylor expanded in y around 0 50.6%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.5e-45) (not (<= y 1.4e-110))) (* y (/ x z)) (* t (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e-45) || !(y <= 1.4e-110)) {
tmp = y * (x / z);
} else {
tmp = t * (x / 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 <= (-2.5d-45)) .or. (.not. (y <= 1.4d-110))) then
tmp = y * (x / z)
else
tmp = t * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.5e-45) || !(y <= 1.4e-110)) {
tmp = y * (x / z);
} else {
tmp = t * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.5e-45) or not (y <= 1.4e-110): tmp = y * (x / z) else: tmp = t * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.5e-45) || !(y <= 1.4e-110)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.5e-45) || ~((y <= 1.4e-110))) tmp = y * (x / z); else tmp = t * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.5e-45], N[Not[LessEqual[y, 1.4e-110]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{-45} \lor \neg \left(y \leq 1.4 \cdot 10^{-110}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -2.49999999999999988e-45 or 1.4e-110 < y Initial program 90.4%
Taylor expanded in z around 0 67.6%
Taylor expanded in y around inf 71.0%
+-commutative71.0%
mul-1-neg71.0%
unsub-neg71.0%
associate-/l*72.2%
Simplified72.2%
Taylor expanded in z around 0 78.9%
if -2.49999999999999988e-45 < y < 1.4e-110Initial program 97.4%
Taylor expanded in y around 0 72.3%
mul-1-neg72.3%
associate-/l*70.6%
distribute-rgt-neg-in70.6%
distribute-neg-frac270.6%
neg-sub070.6%
associate--r-70.6%
metadata-eval70.6%
Simplified70.6%
Taylor expanded in z around inf 47.6%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.35e+178) (not (<= t 1.85e+54))) (* t (/ x z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.35e+178) || !(t <= 1.85e+54)) {
tmp = t * (x / 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 <= (-1.35d+178)) .or. (.not. (t <= 1.85d+54))) then
tmp = t * (x / 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 <= -1.35e+178) || !(t <= 1.85e+54)) {
tmp = t * (x / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.35e+178) or not (t <= 1.85e+54): tmp = t * (x / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.35e+178) || !(t <= 1.85e+54)) tmp = Float64(t * Float64(x / 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 <= -1.35e+178) || ~((t <= 1.85e+54))) tmp = t * (x / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.35e+178], N[Not[LessEqual[t, 1.85e+54]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+178} \lor \neg \left(t \leq 1.85 \cdot 10^{+54}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.35000000000000009e178 or 1.8500000000000001e54 < t Initial program 93.1%
Taylor expanded in y around 0 63.8%
mul-1-neg63.8%
associate-/l*63.6%
distribute-rgt-neg-in63.6%
distribute-neg-frac263.6%
neg-sub063.6%
associate--r-63.6%
metadata-eval63.6%
Simplified63.6%
Taylor expanded in z around inf 43.4%
if -1.35000000000000009e178 < t < 1.8500000000000001e54Initial program 92.9%
Taylor expanded in y around inf 75.8%
associate-*r/78.0%
Simplified78.0%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -165000.0) (not (<= z 1.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -165000.0) || !(z <= 1.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 <= (-165000.0d0)) .or. (.not. (z <= 1.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 <= -165000.0) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -165000.0) or not (z <= 1.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -165000.0) || !(z <= 1.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 <= -165000.0) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -165000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -165000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -165000 or 1 < z Initial program 97.9%
Taylor expanded in y around 0 53.0%
mul-1-neg53.0%
associate-/l*51.1%
distribute-rgt-neg-in51.1%
distribute-neg-frac251.1%
neg-sub051.1%
associate--r-51.1%
metadata-eval51.1%
Simplified51.1%
Taylor expanded in z around inf 50.0%
if -165000 < z < 1Initial program 87.9%
Taylor expanded in z around 0 86.8%
Taylor expanded in y around 0 25.7%
associate-*r*25.7%
neg-mul-125.7%
Simplified25.7%
Final simplification38.0%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -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 * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 92.9%
Taylor expanded in z around 0 62.4%
Taylor expanded in y around 0 19.4%
associate-*r*19.4%
neg-mul-119.4%
Simplified19.4%
Final simplification19.4%
(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 92.9%
Taylor expanded in z around 0 62.4%
Taylor expanded in y around 0 19.4%
associate-*r*19.4%
neg-mul-119.4%
Simplified19.4%
*-commutative19.4%
add-sqr-sqrt9.2%
sqrt-unprod12.3%
sqr-neg12.3%
sqrt-unprod3.3%
add-sqr-sqrt7.8%
pow17.8%
Applied egg-rr7.8%
unpow17.8%
Simplified7.8%
Final simplification7.8%
(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 2024185
(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)))))