
(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 10 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 5e+306) (* 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 <= 5e+306) {
tmp = t_1 * x;
} else {
tmp = (y * 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) :: t_1
real(8) :: tmp
t_1 = (y / z) + (t / (z + (-1.0d0)))
if (t_1 <= 5d+306) then
tmp = t_1 * x
else
tmp = (y * x) / z
end if
code = tmp
end function
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 <= 5e+306) {
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 <= 5e+306: 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 <= 5e+306) 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 <= 5e+306) 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, 5e+306], 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 5 \cdot 10^{+306}:\\
\;\;\;\;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))) < 4.99999999999999993e306Initial program 96.2%
if 4.99999999999999993e306 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 73.2%
Taylor expanded in y around inf 99.9%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(if (<= t -1.06e+82)
(* t (- x))
(if (<= t 9.8e-290)
(* (/ y z) x)
(if (<= t 1.3e+148) (* y (/ x z)) (* x (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.06e+82) {
tmp = t * -x;
} else if (t <= 9.8e-290) {
tmp = (y / z) * x;
} else if (t <= 1.3e+148) {
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 (t <= (-1.06d+82)) then
tmp = t * -x
else if (t <= 9.8d-290) then
tmp = (y / z) * x
else if (t <= 1.3d+148) 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 (t <= -1.06e+82) {
tmp = t * -x;
} else if (t <= 9.8e-290) {
tmp = (y / z) * x;
} else if (t <= 1.3e+148) {
tmp = y * (x / z);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.06e+82: tmp = t * -x elif t <= 9.8e-290: tmp = (y / z) * x elif t <= 1.3e+148: tmp = y * (x / z) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.06e+82) tmp = Float64(t * Float64(-x)); elseif (t <= 9.8e-290) tmp = Float64(Float64(y / z) * x); elseif (t <= 1.3e+148) 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 (t <= -1.06e+82) tmp = t * -x; elseif (t <= 9.8e-290) tmp = (y / z) * x; elseif (t <= 1.3e+148) tmp = y * (x / z); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.06e+82], N[(t * (-x)), $MachinePrecision], If[LessEqual[t, 9.8e-290], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 1.3e+148], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.06 \cdot 10^{+82}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{elif}\;t \leq 9.8 \cdot 10^{-290}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+148}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -1.06000000000000006e82Initial program 97.9%
Taylor expanded in y around 0 79.9%
mul-1-neg79.9%
associate-/l*71.5%
distribute-rgt-neg-in71.5%
distribute-neg-frac271.5%
neg-sub071.5%
associate--r-71.5%
metadata-eval71.5%
Simplified71.5%
Taylor expanded in z around 0 53.2%
neg-mul-153.2%
distribute-rgt-neg-in53.2%
Simplified53.2%
if -1.06000000000000006e82 < t < 9.8000000000000002e-290Initial program 97.4%
Taylor expanded in y around inf 79.3%
associate-*r/88.9%
Simplified88.9%
if 9.8000000000000002e-290 < t < 1.3e148Initial program 88.6%
Taylor expanded in t around -inf 79.1%
mul-1-neg79.1%
*-commutative79.1%
distribute-rgt-neg-in79.1%
+-commutative79.1%
mul-1-neg79.1%
unsub-neg79.1%
associate-/l*78.6%
Simplified78.6%
Taylor expanded in z around 0 58.3%
mul-1-neg58.3%
*-commutative58.3%
associate-*r/57.0%
*-commutative57.0%
distribute-rgt-neg-in57.0%
*-commutative57.0%
Simplified57.0%
pow157.0%
*-commutative57.0%
add-sqr-sqrt0.0%
sqrt-unprod12.2%
sqr-neg12.2%
sqrt-unprod12.1%
add-sqr-sqrt12.1%
associate-*l/12.1%
times-frac11.9%
add-sqr-sqrt6.8%
sqrt-unprod31.6%
sqr-neg31.6%
sqrt-unprod30.6%
add-sqr-sqrt58.2%
Applied egg-rr58.2%
unpow158.2%
associate-*r*61.9%
Simplified61.9%
Taylor expanded in t around 0 73.4%
if 1.3e148 < t Initial program 94.3%
Taylor expanded in z around inf 61.9%
associate-/l*68.5%
sub-neg68.5%
remove-double-neg68.5%
neg-mul-168.5%
distribute-rgt-neg-in68.5%
distribute-lft-in68.5%
neg-mul-168.5%
sub-neg68.5%
*-commutative68.5%
associate-*l/68.5%
*-commutative68.5%
associate-*r/68.5%
sub-neg68.5%
neg-mul-168.5%
distribute-lft-in68.5%
neg-mul-168.5%
remove-double-neg68.5%
neg-mul-168.5%
remove-double-neg68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in t around inf 61.3%
Final simplification71.6%
(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 95.8%
Taylor expanded in z around inf 85.1%
associate-/l*94.3%
sub-neg94.3%
remove-double-neg94.3%
neg-mul-194.3%
distribute-rgt-neg-in94.3%
distribute-lft-in94.3%
neg-mul-194.3%
sub-neg94.3%
*-commutative94.3%
associate-*l/94.3%
*-commutative94.3%
associate-*r/94.3%
sub-neg94.3%
neg-mul-194.3%
distribute-lft-in94.3%
neg-mul-194.3%
remove-double-neg94.3%
neg-mul-194.3%
remove-double-neg94.3%
+-commutative94.3%
Simplified94.3%
if -1 < z < 1Initial program 92.9%
Taylor expanded in z around 0 92.2%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1e+78) (not (<= t 3e+31))) (* t (/ x (+ z -1.0))) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+78) || !(t <= 3e+31)) {
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 <= (-1d+78)) .or. (.not. (t <= 3d+31))) 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 <= -1e+78) || !(t <= 3e+31)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1e+78) or not (t <= 3e+31): tmp = t * (x / (z + -1.0)) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1e+78) || !(t <= 3e+31)) 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 <= -1e+78) || ~((t <= 3e+31))) 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, -1e+78], N[Not[LessEqual[t, 3e+31]], $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 -1 \cdot 10^{+78} \lor \neg \left(t \leq 3 \cdot 10^{+31}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.00000000000000001e78 or 2.99999999999999989e31 < t Initial program 95.9%
Taylor expanded in y around 0 72.5%
mul-1-neg72.5%
associate-/l*67.4%
distribute-rgt-neg-in67.4%
distribute-neg-frac267.4%
neg-sub067.4%
associate--r-67.4%
metadata-eval67.4%
Simplified67.4%
if -1.00000000000000001e78 < t < 2.99999999999999989e31Initial program 92.9%
Taylor expanded in y around inf 79.6%
associate-*r/82.4%
Simplified82.4%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (<= z -5.8e+86) (* x (/ t z)) (if (<= z 2.5e+44) (* x (- (/ y z) t)) (/ (* t x) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.8e+86) {
tmp = x * (t / z);
} else if (z <= 2.5e+44) {
tmp = x * ((y / z) - t);
} 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 (z <= (-5.8d+86)) then
tmp = x * (t / z)
else if (z <= 2.5d+44) then
tmp = x * ((y / z) - t)
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 (z <= -5.8e+86) {
tmp = x * (t / z);
} else if (z <= 2.5e+44) {
tmp = x * ((y / z) - t);
} else {
tmp = (t * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.8e+86: tmp = x * (t / z) elif z <= 2.5e+44: tmp = x * ((y / z) - t) else: tmp = (t * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.8e+86) tmp = Float64(x * Float64(t / z)); elseif (z <= 2.5e+44) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(t * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.8e+86) tmp = x * (t / z); elseif (z <= 2.5e+44) tmp = x * ((y / z) - t); else tmp = (t * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.8e+86], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.5e+44], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.8 \cdot 10^{+86}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{+44}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\end{array}
\end{array}
if z < -5.79999999999999981e86Initial program 98.0%
Taylor expanded in z around inf 81.3%
associate-/l*98.0%
sub-neg98.0%
remove-double-neg98.0%
neg-mul-198.0%
distribute-rgt-neg-in98.0%
distribute-lft-in98.0%
neg-mul-198.0%
sub-neg98.0%
*-commutative98.0%
associate-*l/98.0%
*-commutative98.0%
associate-*r/98.0%
sub-neg98.0%
neg-mul-198.0%
distribute-lft-in98.0%
neg-mul-198.0%
remove-double-neg98.0%
neg-mul-198.0%
remove-double-neg98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in t around inf 62.7%
if -5.79999999999999981e86 < z < 2.4999999999999998e44Initial program 93.8%
Taylor expanded in z around 0 87.9%
if 2.4999999999999998e44 < z Initial program 92.0%
Taylor expanded in y around 0 64.6%
mul-1-neg64.6%
associate-/l*54.0%
distribute-rgt-neg-in54.0%
distribute-neg-frac254.0%
neg-sub054.0%
associate--r-54.0%
metadata-eval54.0%
Simplified54.0%
Taylor expanded in z around inf 64.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.00079) (not (<= z 1.0))) (* x (/ t z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.00079) || !(z <= 1.0)) {
tmp = x * (t / z);
} 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 <= (-0.00079d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / z)
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 <= -0.00079) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.00079) or not (z <= 1.0): tmp = x * (t / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.00079) || !(z <= 1.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.00079) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.00079], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00079 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -7.90000000000000012e-4 or 1 < z Initial program 95.9%
Taylor expanded in z around inf 85.3%
associate-/l*94.4%
sub-neg94.4%
remove-double-neg94.4%
neg-mul-194.4%
distribute-rgt-neg-in94.4%
distribute-lft-in94.4%
neg-mul-194.4%
sub-neg94.4%
*-commutative94.4%
associate-*l/94.4%
*-commutative94.4%
associate-*r/94.4%
sub-neg94.4%
neg-mul-194.4%
distribute-lft-in94.4%
neg-mul-194.4%
remove-double-neg94.4%
neg-mul-194.4%
remove-double-neg94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in t around inf 59.0%
if -7.90000000000000012e-4 < z < 1Initial program 92.8%
Taylor expanded in y around 0 42.5%
mul-1-neg42.5%
associate-/l*42.5%
distribute-rgt-neg-in42.5%
distribute-neg-frac242.5%
neg-sub042.5%
associate--r-42.5%
metadata-eval42.5%
Simplified42.5%
Taylor expanded in z around 0 41.9%
neg-mul-141.9%
distribute-rgt-neg-in41.9%
Simplified41.9%
Final simplification50.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.00079) (not (<= z 1.0))) (* t (/ x z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.00079) || !(z <= 1.0)) {
tmp = t * (x / z);
} 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 <= (-0.00079d0)) .or. (.not. (z <= 1.0d0))) then
tmp = t * (x / z)
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 <= -0.00079) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.00079) or not (z <= 1.0): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.00079) || !(z <= 1.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.00079) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.00079], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00079 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -7.90000000000000012e-4 or 1 < z Initial program 95.9%
Taylor expanded in y around 0 56.4%
mul-1-neg56.4%
associate-/l*51.4%
distribute-rgt-neg-in51.4%
distribute-neg-frac251.4%
neg-sub051.4%
associate--r-51.4%
metadata-eval51.4%
Simplified51.4%
Taylor expanded in z around inf 49.9%
if -7.90000000000000012e-4 < z < 1Initial program 92.8%
Taylor expanded in y around 0 42.5%
mul-1-neg42.5%
associate-/l*42.5%
distribute-rgt-neg-in42.5%
distribute-neg-frac242.5%
neg-sub042.5%
associate--r-42.5%
metadata-eval42.5%
Simplified42.5%
Taylor expanded in z around 0 41.9%
neg-mul-141.9%
distribute-rgt-neg-in41.9%
Simplified41.9%
Final simplification45.7%
(FPCore (x y z t) :precision binary64 (if (<= t -6.5e+82) (* t (- x)) (if (<= t 9e+147) (* (/ y z) x) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6.5e+82) {
tmp = t * -x;
} else if (t <= 9e+147) {
tmp = (y / z) * x;
} 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 (t <= (-6.5d+82)) then
tmp = t * -x
else if (t <= 9d+147) then
tmp = (y / z) * x
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 (t <= -6.5e+82) {
tmp = t * -x;
} else if (t <= 9e+147) {
tmp = (y / z) * x;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6.5e+82: tmp = t * -x elif t <= 9e+147: tmp = (y / z) * x else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6.5e+82) tmp = Float64(t * Float64(-x)); elseif (t <= 9e+147) tmp = Float64(Float64(y / z) * x); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6.5e+82) tmp = t * -x; elseif (t <= 9e+147) tmp = (y / z) * x; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6.5e+82], N[(t * (-x)), $MachinePrecision], If[LessEqual[t, 9e+147], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.5 \cdot 10^{+82}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{elif}\;t \leq 9 \cdot 10^{+147}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -6.5000000000000003e82Initial program 97.9%
Taylor expanded in y around 0 79.9%
mul-1-neg79.9%
associate-/l*71.5%
distribute-rgt-neg-in71.5%
distribute-neg-frac271.5%
neg-sub071.5%
associate--r-71.5%
metadata-eval71.5%
Simplified71.5%
Taylor expanded in z around 0 53.2%
neg-mul-153.2%
distribute-rgt-neg-in53.2%
Simplified53.2%
if -6.5000000000000003e82 < t < 9.00000000000000016e147Initial program 93.1%
Taylor expanded in y around inf 75.1%
associate-*r/78.2%
Simplified78.2%
if 9.00000000000000016e147 < t Initial program 94.3%
Taylor expanded in z around inf 61.9%
associate-/l*68.5%
sub-neg68.5%
remove-double-neg68.5%
neg-mul-168.5%
distribute-rgt-neg-in68.5%
distribute-lft-in68.5%
neg-mul-168.5%
sub-neg68.5%
*-commutative68.5%
associate-*l/68.5%
*-commutative68.5%
associate-*r/68.5%
sub-neg68.5%
neg-mul-168.5%
distribute-lft-in68.5%
neg-mul-168.5%
remove-double-neg68.5%
neg-mul-168.5%
remove-double-neg68.5%
+-commutative68.5%
Simplified68.5%
Taylor expanded in t around inf 61.3%
Final simplification69.8%
(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 * Float64(-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 \left(-x\right)
\end{array}
Initial program 94.3%
Taylor expanded in y around 0 49.2%
mul-1-neg49.2%
associate-/l*46.8%
distribute-rgt-neg-in46.8%
distribute-neg-frac246.8%
neg-sub046.8%
associate--r-46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in z around 0 28.5%
neg-mul-128.5%
distribute-rgt-neg-in28.5%
Simplified28.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.3%
Taylor expanded in y around 0 49.2%
mul-1-neg49.2%
associate-/l*46.8%
distribute-rgt-neg-in46.8%
distribute-neg-frac246.8%
neg-sub046.8%
associate--r-46.8%
metadata-eval46.8%
Simplified46.8%
Taylor expanded in z around 0 28.5%
neg-mul-128.5%
distribute-rgt-neg-in28.5%
Simplified28.5%
neg-sub028.5%
sub-neg28.5%
add-sqr-sqrt17.1%
sqrt-unprod22.8%
sqr-neg22.8%
sqrt-unprod4.5%
add-sqr-sqrt11.2%
Applied egg-rr11.2%
+-lft-identity11.2%
Simplified11.2%
(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 2024170
(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)))))