
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- (/ (- (* y z) x) (- x (* z t))) x) (- -1.0 x))))
(if (<= t_1 (- INFINITY))
(* (/ y (+ x 1.0)) (/ z (- (* z t) x)))
(if (<= t_1 1e+249) t_1 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (y / (x + 1.0)) * (z / ((z * t) - x));
} else if (t_1 <= 1e+249) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (y / (x + 1.0)) * (z / ((z * t) - x));
} else if (t_1 <= 1e+249) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x) tmp = 0 if t_1 <= -math.inf: tmp = (y / (x + 1.0)) * (z / ((z * t) - x)) elif t_1 <= 1e+249: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(z * t))) - x) / Float64(-1.0 - x)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(y / Float64(x + 1.0)) * Float64(z / Float64(Float64(z * t) - x))); elseif (t_1 <= 1e+249) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((((y * z) - x) / (x - (z * t))) - x) / (-1.0 - x); tmp = 0.0; if (t_1 <= -Inf) tmp = (y / (x + 1.0)) * (z / ((z * t) - x)); elseif (t_1 <= 1e+249) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+249], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{y \cdot z - x}{x - z \cdot t} - x}{-1 - x}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{y}{x + 1} \cdot \frac{z}{z \cdot t - x}\\
\mathbf{elif}\;t\_1 \leq 10^{+249}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -inf.0Initial program 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in y around inf 51.8%
times-frac84.0%
+-commutative84.0%
Simplified84.0%
if -inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 9.9999999999999992e248Initial program 99.1%
if 9.9999999999999992e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in z around inf 95.6%
+-commutative95.6%
+-commutative95.6%
Simplified95.6%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e-137) (not (<= t 4.4e-53))) (+ (/ x (+ x 1.0)) (/ (/ y (+ x 1.0)) t)) (+ 1.0 (* y (/ (/ z x) (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-137) || !(t <= 4.4e-53)) {
tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t);
} else {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.5d-137)) .or. (.not. (t <= 4.4d-53))) then
tmp = (x / (x + 1.0d0)) + ((y / (x + 1.0d0)) / t)
else
tmp = 1.0d0 + (y * ((z / x) / ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e-137) || !(t <= 4.4e-53)) {
tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t);
} else {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e-137) or not (t <= 4.4e-53): tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t) else: tmp = 1.0 + (y * ((z / x) / (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e-137) || !(t <= 4.4e-53)) tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(y / Float64(x + 1.0)) / t)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(z / x) / Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e-137) || ~((t <= 4.4e-53))) tmp = (x / (x + 1.0)) + ((y / (x + 1.0)) / t); else tmp = 1.0 + (y * ((z / x) / (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e-137], N[Not[LessEqual[t, 4.4e-53]], $MachinePrecision]], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-137} \lor \neg \left(t \leq 4.4 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1}}{t}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\end{array}
\end{array}
if t < -2.5e-137 or 4.40000000000000037e-53 < t Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in t around -inf 81.1%
+-commutative81.1%
mul-1-neg81.1%
unsub-neg81.1%
+-commutative81.1%
sub-neg81.1%
mul-1-neg81.1%
distribute-neg-frac281.1%
distribute-neg-in81.1%
metadata-eval81.1%
unsub-neg81.1%
mul-1-neg81.1%
remove-double-neg81.1%
associate-/r*76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in y around inf 88.7%
associate-*r/88.7%
neg-mul-188.7%
+-commutative88.7%
Simplified88.7%
if -2.5e-137 < t < 4.40000000000000037e-53Initial program 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 84.4%
mul-1-neg84.4%
unsub-neg84.4%
associate-/l*87.8%
+-commutative87.8%
Simplified87.8%
clear-num87.8%
inv-pow87.8%
Applied egg-rr87.8%
unpow-187.8%
Simplified87.8%
Taylor expanded in y around 0 84.3%
mul-1-neg84.3%
sub-neg84.3%
associate-/l*87.5%
associate-/r*89.8%
+-commutative89.8%
Simplified89.8%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.6e-139) (not (<= t 4e-53))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* y (/ (/ z x) (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e-139) || !(t <= 4e-53)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (y * ((z / x) / (-1.0 - 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 <= (-5.6d-139)) .or. (.not. (t <= 4d-53))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + (y * ((z / x) / ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.6e-139) || !(t <= 4e-53)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + (y * ((z / x) / (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.6e-139) or not (t <= 4e-53): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + (y * ((z / x) / (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.6e-139) || !(t <= 4e-53)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(y * Float64(Float64(z / x) / Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.6e-139) || ~((t <= 4e-53))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + (y * ((z / x) / (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.6e-139], N[Not[LessEqual[t, 4e-53]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(y * N[(N[(z / x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{-139} \lor \neg \left(t \leq 4 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + y \cdot \frac{\frac{z}{x}}{-1 - x}\\
\end{array}
\end{array}
if t < -5.5999999999999997e-139 or 4.00000000000000012e-53 < t Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in z around inf 88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
if -5.5999999999999997e-139 < t < 4.00000000000000012e-53Initial program 93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t around 0 84.4%
mul-1-neg84.4%
unsub-neg84.4%
associate-/l*87.8%
+-commutative87.8%
Simplified87.8%
clear-num87.8%
inv-pow87.8%
Applied egg-rr87.8%
unpow-187.8%
Simplified87.8%
Taylor expanded in y around 0 84.3%
mul-1-neg84.3%
sub-neg84.3%
associate-/l*87.5%
associate-/r*89.8%
+-commutative89.8%
Simplified89.8%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.3e-137) (not (<= t 7.2e-53))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* y (/ z (* x (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.3e-137) || !(t <= 7.2e-53)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y * (z / (x * (x + 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 ((t <= (-2.3d-137)) .or. (.not. (t <= 7.2d-53))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - (y * (z / (x * (x + 1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.3e-137) || !(t <= 7.2e-53)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - (y * (z / (x * (x + 1.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.3e-137) or not (t <= 7.2e-53): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - (y * (z / (x * (x + 1.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.3e-137) || !(t <= 7.2e-53)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(y * Float64(z / Float64(x * Float64(x + 1.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.3e-137) || ~((t <= 7.2e-53))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - (y * (z / (x * (x + 1.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.3e-137], N[Not[LessEqual[t, 7.2e-53]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(y * N[(z / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-137} \lor \neg \left(t \leq 7.2 \cdot 10^{-53}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - y \cdot \frac{z}{x \cdot \left(x + 1\right)}\\
\end{array}
\end{array}
if t < -2.30000000000000008e-137 or 7.1999999999999998e-53 < t Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in z around inf 88.7%
+-commutative88.7%
+-commutative88.7%
Simplified88.7%
if -2.30000000000000008e-137 < t < 7.1999999999999998e-53Initial program 93.2%
*-commutative93.2%
Simplified93.2%
clear-num93.2%
associate-/r/93.2%
Applied egg-rr93.2%
Taylor expanded in t around 0 84.4%
associate-+r+84.4%
mul-1-neg84.4%
associate-*r/87.8%
sub-neg87.8%
div-sub87.8%
+-commutative87.8%
+-commutative87.8%
*-inverses87.8%
associate-*r/84.4%
associate-/r*84.3%
associate-/l*87.5%
+-commutative87.5%
Simplified87.5%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (<= x -1.8e+38) 1.0 (if (<= x 2.2e+67) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e+38) {
tmp = 1.0;
} else if (x <= 2.2e+67) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 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 (x <= (-1.8d+38)) then
tmp = 1.0d0
else if (x <= 2.2d+67) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e+38) {
tmp = 1.0;
} else if (x <= 2.2e+67) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.8e+38: tmp = 1.0 elif x <= 2.2e+67: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.8e+38) tmp = 1.0; elseif (x <= 2.2e+67) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.8e+38) tmp = 1.0; elseif (x <= 2.2e+67) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.8e+38], 1.0, If[LessEqual[x, 2.2e+67], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+38}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+67}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.79999999999999985e38 or 2.2e67 < x Initial program 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in x around inf 95.6%
if -1.79999999999999985e38 < x < 2.2e67Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in z around inf 69.6%
+-commutative69.6%
+-commutative69.6%
Simplified69.6%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= x -1.45e-132) (/ x (+ x 1.0)) (if (<= x 2.35e-15) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e-132) {
tmp = x / (x + 1.0);
} else if (x <= 2.35e-15) {
tmp = y / t;
} else {
tmp = 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 (x <= (-1.45d-132)) then
tmp = x / (x + 1.0d0)
else if (x <= 2.35d-15) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.45e-132) {
tmp = x / (x + 1.0);
} else if (x <= 2.35e-15) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.45e-132: tmp = x / (x + 1.0) elif x <= 2.35e-15: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.45e-132) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 2.35e-15) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.45e-132) tmp = x / (x + 1.0); elseif (x <= 2.35e-15) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.45e-132], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.35e-15], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-132}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.44999999999999992e-132Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 72.0%
+-commutative72.0%
Simplified72.0%
if -1.44999999999999992e-132 < x < 2.3499999999999999e-15Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in x around 0 49.1%
if 2.3499999999999999e-15 < x Initial program 91.3%
*-commutative91.3%
Simplified91.3%
Taylor expanded in x around inf 92.0%
(FPCore (x y z t) :precision binary64 (if (<= x -0.66) 1.0 (if (<= x 5.2e-15) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.66) {
tmp = 1.0;
} else if (x <= 5.2e-15) {
tmp = y / t;
} else {
tmp = 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 (x <= (-0.66d0)) then
tmp = 1.0d0
else if (x <= 5.2d-15) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -0.66) {
tmp = 1.0;
} else if (x <= 5.2e-15) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -0.66: tmp = 1.0 elif x <= 5.2e-15: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -0.66) tmp = 1.0; elseif (x <= 5.2e-15) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -0.66) tmp = 1.0; elseif (x <= 5.2e-15) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -0.66], 1.0, If[LessEqual[x, 5.2e-15], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.66:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-15}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -0.660000000000000031 or 5.20000000000000009e-15 < x Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in x around inf 89.4%
if -0.660000000000000031 < x < 5.20000000000000009e-15Initial program 92.3%
*-commutative92.3%
Simplified92.3%
Taylor expanded in x around 0 42.8%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in x around inf 53.0%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
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 / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2024165
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))