
(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 (<= t_1 (- INFINITY))
(* y (/ x z))
(if (<= t_1 4e+296) (* t_1 x) (/ (* y x) z)))))
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 if (t_1 <= 4e+296) {
tmp = t_1 * x;
} else {
tmp = (y * x) / z;
}
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 if (t_1 <= 4e+296) {
tmp = t_1 * x;
} else {
tmp = (y * x) / z;
}
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) elif t_1 <= 4e+296: tmp = t_1 * x else: tmp = (y * x) / z 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)); elseif (t_1 <= 4e+296) tmp = Float64(t_1 * x); else tmp = Float64(Float64(y * x) / z); 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); elseif (t_1 <= 4e+296) tmp = t_1 * x; else tmp = (y * x) / z; 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], If[LessEqual[t$95$1, 4e+296], N[(t$95$1 * x), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $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{elif}\;t\_1 \leq 4 \cdot 10^{+296}:\\
\;\;\;\;t\_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 64.5%
Taylor expanded in y around inf 99.9%
clear-num99.8%
inv-pow99.8%
Applied egg-rr99.8%
unpow-199.8%
associate-/r*99.8%
Simplified99.8%
associate-/r/99.8%
clear-num99.9%
Applied egg-rr99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 3.99999999999999993e296Initial program 98.4%
if 3.99999999999999993e296 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 73.7%
Taylor expanded in y around inf 99.9%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1400.0) (not (<= z 0.0004))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1400.0) || !(z <= 0.0004)) {
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 <= (-1400.0d0)) .or. (.not. (z <= 0.0004d0))) 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 <= -1400.0) || !(z <= 0.0004)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1400.0) or not (z <= 0.0004): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1400.0) || !(z <= 0.0004)) 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 <= -1400.0) || ~((z <= 0.0004))) 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, -1400.0], N[Not[LessEqual[z, 0.0004]], $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 -1400 \lor \neg \left(z \leq 0.0004\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1400 or 4.00000000000000019e-4 < z Initial program 97.3%
Taylor expanded in z around inf 81.7%
associate-/l*95.3%
cancel-sign-sub-inv95.3%
metadata-eval95.3%
*-lft-identity95.3%
+-commutative95.3%
Simplified95.3%
if -1400 < z < 4.00000000000000019e-4Initial program 92.0%
Taylor expanded in z around 0 91.2%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.25e+134) (not (<= t 5e+80))) (* x (/ t (+ z -1.0))) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.25e+134) || !(t <= 5e+80)) {
tmp = x * (t / (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 ((t <= (-1.25d+134)) .or. (.not. (t <= 5d+80))) then
tmp = x * (t / (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 ((t <= -1.25e+134) || !(t <= 5e+80)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.25e+134) or not (t <= 5e+80): tmp = x * (t / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.25e+134) || !(t <= 5e+80)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); 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.25e+134) || ~((t <= 5e+80))) tmp = x * (t / (z + -1.0)); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.25e+134], N[Not[LessEqual[t, 5e+80]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+134} \lor \neg \left(t \leq 5 \cdot 10^{+80}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.24999999999999995e134 or 4.99999999999999961e80 < t Initial program 95.9%
Taylor expanded in y around 0 85.2%
mul-1-neg85.2%
distribute-neg-frac285.2%
neg-sub085.2%
associate--r-85.2%
metadata-eval85.2%
Simplified85.2%
if -1.24999999999999995e134 < t < 4.99999999999999961e80Initial program 94.0%
Taylor expanded in y around inf 78.9%
associate-*r/80.2%
Simplified80.2%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.4e+134) (not (<= t 1.45e+84))) (* t (/ x (+ z -1.0))) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.4e+134) || !(t <= 1.45e+84)) {
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 ((t <= (-6.4d+134)) .or. (.not. (t <= 1.45d+84))) 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 ((t <= -6.4e+134) || !(t <= 1.45e+84)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.4e+134) or not (t <= 1.45e+84): tmp = t * (x / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.4e+134) || !(t <= 1.45e+84)) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.4e+134) || ~((t <= 1.45e+84))) tmp = t * (x / (z + -1.0)); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.4e+134], N[Not[LessEqual[t, 1.45e+84]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.4 \cdot 10^{+134} \lor \neg \left(t \leq 1.45 \cdot 10^{+84}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -6.4000000000000001e134 or 1.44999999999999994e84 < t Initial program 95.9%
Taylor expanded in y around 0 69.9%
mul-1-neg69.9%
associate-/l*74.8%
distribute-rgt-neg-in74.8%
distribute-neg-frac274.8%
neg-sub074.8%
associate--r-74.8%
metadata-eval74.8%
Simplified74.8%
if -6.4000000000000001e134 < t < 1.44999999999999994e84Initial program 94.0%
Taylor expanded in y around inf 78.9%
associate-*r/80.2%
Simplified80.2%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e+136) (not (<= t 5.5e+150))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+136) || !(t <= 5.5e+150)) {
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 <= (-3d+136)) .or. (.not. (t <= 5.5d+150))) 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 <= -3e+136) || !(t <= 5.5e+150)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3e+136) or not (t <= 5.5e+150): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e+136) || !(t <= 5.5e+150)) 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 <= -3e+136) || ~((t <= 5.5e+150))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e+136], N[Not[LessEqual[t, 5.5e+150]], $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 -3 \cdot 10^{+136} \lor \neg \left(t \leq 5.5 \cdot 10^{+150}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -2.99999999999999979e136 or 5.50000000000000017e150 < t Initial program 98.2%
Taylor expanded in y around 0 90.5%
mul-1-neg90.5%
distribute-neg-frac290.5%
neg-sub090.5%
associate--r-90.5%
metadata-eval90.5%
Simplified90.5%
Taylor expanded in z around inf 62.6%
if -2.99999999999999979e136 < t < 5.50000000000000017e150Initial program 93.4%
Taylor expanded in y around inf 76.4%
associate-*r/77.1%
Simplified77.1%
Final simplification73.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1400.0) (not (<= z 170000.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1400.0) || !(z <= 170000.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 <= (-1400.0d0)) .or. (.not. (z <= 170000.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 <= -1400.0) || !(z <= 170000.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1400.0) or not (z <= 170000.0): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1400.0) || !(z <= 170000.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 <= -1400.0) || ~((z <= 170000.0))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1400.0], N[Not[LessEqual[z, 170000.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1400 \lor \neg \left(z \leq 170000\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1400 or 1.7e5 < z Initial program 97.2%
Taylor expanded in y around 0 54.1%
mul-1-neg54.1%
distribute-neg-frac254.1%
neg-sub054.1%
associate--r-54.1%
metadata-eval54.1%
Simplified54.1%
Taylor expanded in z around inf 53.0%
if -1400 < z < 1.7e5Initial program 92.3%
Taylor expanded in y around 0 35.1%
mul-1-neg35.1%
distribute-neg-frac235.1%
neg-sub035.1%
associate--r-35.1%
metadata-eval35.1%
Simplified35.1%
Taylor expanded in z around 0 33.6%
*-commutative33.6%
neg-mul-133.6%
distribute-rgt-neg-in33.6%
Simplified33.6%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1400.0) (not (<= z 42000.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1400.0) || !(z <= 42000.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 <= (-1400.0d0)) .or. (.not. (z <= 42000.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 <= -1400.0) || !(z <= 42000.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1400.0) or not (z <= 42000.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1400.0) || !(z <= 42000.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 <= -1400.0) || ~((z <= 42000.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1400.0], N[Not[LessEqual[z, 42000.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1400 \lor \neg \left(z \leq 42000\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1400 or 42000 < z Initial program 97.2%
Taylor expanded in y around 0 54.1%
mul-1-neg54.1%
distribute-neg-frac254.1%
neg-sub054.1%
associate--r-54.1%
metadata-eval54.1%
Simplified54.1%
Taylor expanded in z around inf 44.5%
associate-/l*47.5%
Simplified47.5%
if -1400 < z < 42000Initial program 92.3%
Taylor expanded in y around 0 35.1%
mul-1-neg35.1%
distribute-neg-frac235.1%
neg-sub035.1%
associate--r-35.1%
metadata-eval35.1%
Simplified35.1%
Taylor expanded in z around 0 33.6%
*-commutative33.6%
neg-mul-133.6%
distribute-rgt-neg-in33.6%
Simplified33.6%
Final simplification40.1%
(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 94.6%
Taylor expanded in y around 0 43.9%
mul-1-neg43.9%
distribute-neg-frac243.9%
neg-sub043.9%
associate--r-43.9%
metadata-eval43.9%
Simplified43.9%
Taylor expanded in z around 0 22.5%
*-commutative22.5%
neg-mul-122.5%
distribute-rgt-neg-in22.5%
Simplified22.5%
(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 94.6%
Taylor expanded in y around 0 43.9%
mul-1-neg43.9%
distribute-neg-frac243.9%
neg-sub043.9%
associate--r-43.9%
metadata-eval43.9%
Simplified43.9%
Taylor expanded in z around 0 22.5%
*-commutative22.5%
neg-mul-122.5%
distribute-rgt-neg-in22.5%
Simplified22.5%
neg-sub022.5%
sub-neg22.5%
add-sqr-sqrt12.4%
sqrt-unprod14.3%
sqr-neg14.3%
sqrt-unprod3.2%
add-sqr-sqrt8.6%
Applied egg-rr8.6%
+-lft-identity8.6%
Simplified8.6%
Final simplification8.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 2024146
(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)))))