
(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 12 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(Float64(y * 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[(N[(y * x), $MachinePrecision] / z), $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 \cdot 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 57.9%
Taylor expanded in y around inf 99.9%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 97.1%
Final simplification97.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= t -1.85e+216)
t_1
(if (<= t 5.4e+67) (/ x (/ z y)) (if (<= t 2.7e+270) t_1 (* x (- t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -1.85e+216) {
tmp = t_1;
} else if (t <= 5.4e+67) {
tmp = x / (z / y);
} else if (t <= 2.7e+270) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (t <= (-1.85d+216)) then
tmp = t_1
else if (t <= 5.4d+67) then
tmp = x / (z / y)
else if (t <= 2.7d+270) then
tmp = t_1
else
tmp = x * -t
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.85e+216) {
tmp = t_1;
} else if (t <= 5.4e+67) {
tmp = x / (z / y);
} else if (t <= 2.7e+270) {
tmp = t_1;
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -1.85e+216: tmp = t_1 elif t <= 5.4e+67: tmp = x / (z / y) elif t <= 2.7e+270: tmp = t_1 else: tmp = x * -t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -1.85e+216) tmp = t_1; elseif (t <= 5.4e+67) tmp = Float64(x / Float64(z / y)); elseif (t <= 2.7e+270) tmp = t_1; else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -1.85e+216) tmp = t_1; elseif (t <= 5.4e+67) tmp = x / (z / y); elseif (t <= 2.7e+270) tmp = t_1; else tmp = x * -t; 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.85e+216], t$95$1, If[LessEqual[t, 5.4e+67], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e+270], t$95$1, N[(x * (-t)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -1.85 \cdot 10^{+216}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+67}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+270}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -1.8499999999999999e216 or 5.3999999999999998e67 < t < 2.6999999999999999e270Initial program 95.6%
clear-num95.6%
associate-/r/95.6%
Applied egg-rr95.6%
Taylor expanded in z around inf 59.0%
associate-/l*70.3%
neg-mul-170.3%
sub-neg70.3%
remove-double-neg70.3%
Simplified70.3%
Taylor expanded in y around 0 55.9%
if -1.8499999999999999e216 < t < 5.3999999999999998e67Initial program 95.0%
Taylor expanded in y around inf 73.3%
associate-*r/76.3%
Simplified76.3%
clear-num76.2%
un-div-inv76.6%
Applied egg-rr76.6%
if 2.6999999999999999e270 < t Initial program 99.8%
Taylor expanded in z around 0 77.2%
Taylor expanded in y around 0 77.2%
associate-*r*77.2%
neg-mul-177.2%
Simplified77.2%
Final simplification71.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= t -4.6e+216)
t_1
(if (<= t 5.4e+67) (* (/ y z) x) (if (<= t 3e+273) t_1 (* x (- t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -4.6e+216) {
tmp = t_1;
} else if (t <= 5.4e+67) {
tmp = (y / z) * x;
} else if (t <= 3e+273) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (t <= (-4.6d+216)) then
tmp = t_1
else if (t <= 5.4d+67) then
tmp = (y / z) * x
else if (t <= 3d+273) then
tmp = t_1
else
tmp = x * -t
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 <= -4.6e+216) {
tmp = t_1;
} else if (t <= 5.4e+67) {
tmp = (y / z) * x;
} else if (t <= 3e+273) {
tmp = t_1;
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -4.6e+216: tmp = t_1 elif t <= 5.4e+67: tmp = (y / z) * x elif t <= 3e+273: tmp = t_1 else: tmp = x * -t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -4.6e+216) tmp = t_1; elseif (t <= 5.4e+67) tmp = Float64(Float64(y / z) * x); elseif (t <= 3e+273) tmp = t_1; else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -4.6e+216) tmp = t_1; elseif (t <= 5.4e+67) tmp = (y / z) * x; elseif (t <= 3e+273) tmp = t_1; else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -4.6e+216], t$95$1, If[LessEqual[t, 5.4e+67], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 3e+273], t$95$1, N[(x * (-t)), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -4.6 \cdot 10^{+216}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+67}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+273}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -4.59999999999999991e216 or 5.3999999999999998e67 < t < 3e273Initial program 95.6%
clear-num95.6%
associate-/r/95.6%
Applied egg-rr95.6%
Taylor expanded in z around inf 59.0%
associate-/l*70.3%
neg-mul-170.3%
sub-neg70.3%
remove-double-neg70.3%
Simplified70.3%
Taylor expanded in y around 0 55.9%
if -4.59999999999999991e216 < t < 5.3999999999999998e67Initial program 95.0%
Taylor expanded in y around inf 73.3%
associate-*r/76.3%
Simplified76.3%
if 3e273 < t Initial program 99.8%
Taylor expanded in z around 0 77.2%
Taylor expanded in y around 0 77.2%
associate-*r*77.2%
neg-mul-177.2%
Simplified77.2%
Final simplification71.1%
(FPCore (x y z t) :precision binary64 (if (<= z -1.15) (* x (/ (+ y t) z)) (if (<= z 1.0) (* (/ x z) (- y (* z t))) (/ x (/ z (+ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.15) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = (x / z) * (y - (z * t));
} else {
tmp = x / (z / (y + 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.15d0)) then
tmp = x * ((y + t) / z)
else if (z <= 1.0d0) then
tmp = (x / z) * (y - (z * t))
else
tmp = x / (z / (y + t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.15) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = (x / z) * (y - (z * t));
} else {
tmp = x / (z / (y + t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.15: tmp = x * ((y + t) / z) elif z <= 1.0: tmp = (x / z) * (y - (z * t)) else: tmp = x / (z / (y + t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.15) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 1.0) tmp = Float64(Float64(x / z) * Float64(y - Float64(z * t))); else tmp = Float64(x / Float64(z / Float64(y + t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.15) tmp = x * ((y + t) / z); elseif (z <= 1.0) tmp = (x / z) * (y - (z * t)); else tmp = x / (z / (y + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.15], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[(x / z), $MachinePrecision] * N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z} \cdot \left(y - z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -1.1499999999999999Initial program 98.1%
Taylor expanded in z around inf 85.4%
associate-/l*97.0%
neg-mul-197.0%
sub-neg97.0%
remove-double-neg97.0%
neg-mul-197.0%
neg-mul-197.0%
distribute-lft-in97.0%
neg-mul-197.0%
sub-neg97.0%
*-commutative97.0%
associate-*l/97.0%
*-commutative97.0%
associate-*r/97.0%
sub-neg97.0%
neg-mul-197.0%
distribute-lft-in97.0%
neg-mul-197.0%
remove-double-neg97.0%
neg-mul-197.0%
remove-double-neg97.0%
+-commutative97.0%
Simplified97.0%
if -1.1499999999999999 < z < 1Initial program 93.6%
Taylor expanded in z around 0 92.2%
mul-1-neg92.2%
unsub-neg92.2%
Simplified92.2%
clear-num92.1%
un-div-inv92.6%
*-commutative92.6%
Applied egg-rr92.6%
associate-/r/92.8%
Simplified92.8%
if 1 < z Initial program 96.7%
clear-num96.7%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in z around inf 85.2%
associate-/l*96.7%
neg-mul-196.7%
sub-neg96.7%
remove-double-neg96.7%
Simplified96.7%
clear-num96.7%
un-div-inv96.7%
Applied egg-rr96.7%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.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 <= -1.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 <= (-1.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 <= -1.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 <= -1.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 <= -1.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 <= -1.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, -1.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 -1 \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 < -1 or 1 < z Initial program 97.3%
Taylor expanded in z around inf 85.3%
associate-/l*96.8%
neg-mul-196.8%
sub-neg96.8%
remove-double-neg96.8%
neg-mul-196.8%
neg-mul-196.8%
distribute-lft-in96.8%
neg-mul-196.8%
sub-neg96.8%
*-commutative96.8%
associate-*l/96.8%
*-commutative96.8%
associate-*r/96.8%
sub-neg96.8%
neg-mul-196.8%
distribute-lft-in96.8%
neg-mul-196.8%
remove-double-neg96.8%
neg-mul-196.8%
remove-double-neg96.8%
+-commutative96.8%
Simplified96.8%
if -1 < z < 1Initial program 93.6%
Taylor expanded in z around 0 92.2%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.12e+117) (not (<= t 6.6e+66))) (* t (/ x (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.12e+117) || !(t <= 6.6e+66)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x / (z / y);
}
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.12d+117)) .or. (.not. (t <= 6.6d+66))) then
tmp = t * (x / (z + (-1.0d0)))
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.12e+117) || !(t <= 6.6e+66)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.12e+117) or not (t <= 6.6e+66): tmp = t * (x / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.12e+117) || !(t <= 6.6e+66)) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.12e+117) || ~((t <= 6.6e+66))) tmp = t * (x / (z + -1.0)); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.12e+117], N[Not[LessEqual[t, 6.6e+66]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{+117} \lor \neg \left(t \leq 6.6 \cdot 10^{+66}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -1.12000000000000002e117 or 6.6000000000000003e66 < t Initial program 96.2%
Taylor expanded in y around 0 66.9%
mul-1-neg66.9%
associate-/l*68.2%
distribute-rgt-neg-in68.2%
distribute-neg-frac268.2%
neg-sub068.2%
associate--r-68.2%
metadata-eval68.2%
Simplified68.2%
if -1.12000000000000002e117 < t < 6.6000000000000003e66Initial program 94.9%
Taylor expanded in y around inf 79.2%
associate-*r/82.9%
Simplified82.9%
clear-num82.8%
un-div-inv83.0%
Applied egg-rr83.0%
Final simplification77.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (/ (+ y t) z)) (if (<= z 1.0) (* x (- (/ y z) t)) (/ x (/ z (+ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + 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)) then
tmp = x * ((y + t) / z)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = x / (z / (y + 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) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * ((y + t) / z) elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = x / (z / (y + t)) 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 <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / Float64(y + t))); 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 <= 1.0) tmp = x * ((y / z) - t); else tmp = x / (z / (y + t)); 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, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -1Initial program 98.1%
Taylor expanded in z around inf 85.4%
associate-/l*97.0%
neg-mul-197.0%
sub-neg97.0%
remove-double-neg97.0%
neg-mul-197.0%
neg-mul-197.0%
distribute-lft-in97.0%
neg-mul-197.0%
sub-neg97.0%
*-commutative97.0%
associate-*l/97.0%
*-commutative97.0%
associate-*r/97.0%
sub-neg97.0%
neg-mul-197.0%
distribute-lft-in97.0%
neg-mul-197.0%
remove-double-neg97.0%
neg-mul-197.0%
remove-double-neg97.0%
+-commutative97.0%
Simplified97.0%
if -1 < z < 1Initial program 93.6%
Taylor expanded in z around 0 92.2%
if 1 < z Initial program 96.7%
clear-num96.7%
associate-/r/96.6%
Applied egg-rr96.6%
Taylor expanded in z around inf 85.2%
associate-/l*96.7%
neg-mul-196.7%
sub-neg96.7%
remove-double-neg96.7%
Simplified96.7%
clear-num96.7%
un-div-inv96.7%
Applied egg-rr96.7%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1500.0) (/ x (/ z y)) (if (<= z 3.8e+95) (* x (- (/ y z) t)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1500.0) {
tmp = x / (z / y);
} else if (z <= 3.8e+95) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (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 <= (-1500.0d0)) then
tmp = x / (z / y)
else if (z <= 3.8d+95) then
tmp = x * ((y / z) - t)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1500.0) {
tmp = x / (z / y);
} else if (z <= 3.8e+95) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1500.0: tmp = x / (z / y) elif z <= 3.8e+95: tmp = x * ((y / z) - t) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1500.0) tmp = Float64(x / Float64(z / y)); elseif (z <= 3.8e+95) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1500.0) tmp = x / (z / y); elseif (z <= 3.8e+95) tmp = x * ((y / z) - t); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1500.0], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.8e+95], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1500:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+95}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if z < -1500Initial program 98.1%
Taylor expanded in y around inf 65.9%
associate-*r/69.1%
Simplified69.1%
clear-num69.1%
un-div-inv69.2%
Applied egg-rr69.2%
if -1500 < z < 3.7999999999999999e95Initial program 94.3%
Taylor expanded in z around 0 87.8%
if 3.7999999999999999e95 < z Initial program 95.6%
clear-num95.6%
associate-/r/95.5%
Applied egg-rr95.5%
Taylor expanded in z around inf 81.9%
associate-/l*95.6%
neg-mul-195.6%
sub-neg95.6%
remove-double-neg95.6%
Simplified95.6%
clear-num95.6%
un-div-inv95.7%
Applied egg-rr95.7%
Taylor expanded in y around 0 61.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.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 <= 1.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 <= 1.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 <= 1.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 <= 1.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 <= 1.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, 1.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 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 97.3%
clear-num97.3%
associate-/r/97.3%
Applied egg-rr97.3%
Taylor expanded in z around inf 85.3%
associate-/l*96.8%
neg-mul-196.8%
sub-neg96.8%
remove-double-neg96.8%
Simplified96.8%
Taylor expanded in y around 0 52.4%
if -1 < z < 1Initial program 93.6%
Taylor expanded in z around 0 92.2%
Taylor expanded in y around 0 38.2%
associate-*r*38.2%
neg-mul-138.2%
Simplified38.2%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.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 <= (-1.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 <= -1.0) || !(z <= 1.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 <= 1.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 <= 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 <= -1.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, -1.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 -1 \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 < -1 or 1 < z Initial program 97.3%
clear-num97.3%
associate-/r/97.3%
Applied egg-rr97.3%
Taylor expanded in z around inf 85.3%
associate-/l*96.8%
neg-mul-196.8%
sub-neg96.8%
remove-double-neg96.8%
Simplified96.8%
Taylor expanded in y around 0 44.6%
associate-/l*46.2%
Simplified46.2%
if -1 < z < 1Initial program 93.6%
Taylor expanded in z around 0 92.2%
Taylor expanded in y around 0 38.2%
associate-*r*38.2%
neg-mul-138.2%
Simplified38.2%
Final simplification42.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 95.4%
Taylor expanded in z around 0 66.0%
Taylor expanded in y around 0 24.5%
associate-*r*24.5%
neg-mul-124.5%
Simplified24.5%
Final simplification24.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 95.4%
Taylor expanded in z around 0 66.0%
Taylor expanded in y around 0 24.5%
associate-*r*24.5%
neg-mul-124.5%
Simplified24.5%
add-sqr-sqrt12.2%
sqrt-unprod12.8%
sqr-neg12.8%
sqrt-unprod3.0%
add-sqr-sqrt6.3%
pow16.3%
Applied egg-rr6.3%
unpow16.3%
Simplified6.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 2024135
(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)))))