
(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 11 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 (- (* z t) x)) (t_2 (/ (+ x (/ (- (* y z) x) t_1)) (+ x 1.0))))
(if (or (<= t_2 -1e+99) (not (<= t_2 1e+161)))
(/ (+ x (/ y (- t (/ x z)))) (+ x 1.0))
(/ (+ x (- (/ (* y z) t_1) (/ x t_1))) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if ((t_2 <= -1e+99) || !(t_2 <= 1e+161)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((y * z) / t_1) - (x / t_1))) / (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0d0)
if ((t_2 <= (-1d+99)) .or. (.not. (t_2 <= 1d+161))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x + (((y * z) / t_1) - (x / t_1))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0);
double tmp;
if ((t_2 <= -1e+99) || !(t_2 <= 1e+161)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + (((y * z) / t_1) - (x / t_1))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0) tmp = 0 if (t_2 <= -1e+99) or not (t_2 <= 1e+161): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x + (((y * z) / t_1) - (x / t_1))) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if ((t_2 <= -1e+99) || !(t_2 <= 1e+161)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(y * z) / t_1) - Float64(x / t_1))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x + (((y * z) - x) / t_1)) / (x + 1.0); tmp = 0.0; if ((t_2 <= -1e+99) || ~((t_2 <= 1e+161))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x + (((y * z) / t_1) - (x / t_1))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -1e+99], N[Not[LessEqual[t$95$2, 1e+161]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] / t$95$1), $MachinePrecision] - N[(x / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x + \frac{y \cdot z - x}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+99} \lor \neg \left(t\_2 \leq 10^{+161}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(\frac{y \cdot z}{t\_1} - \frac{x}{t\_1}\right)}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -9.9999999999999997e98 or 1e161 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 44.3%
*-commutative44.3%
Simplified44.3%
Taylor expanded in y around inf 44.3%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in t around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
Simplified99.8%
if -9.9999999999999997e98 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1e161Initial program 99.9%
*-commutative99.9%
Simplified99.9%
div-sub99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (or (<= t_1 -1e+99) (not (<= t_1 1e+161)))
(/ (+ x (/ y (- t (/ x z)))) (+ x 1.0))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if ((t_1 <= -1e+99) || !(t_1 <= 1e+161)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} 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) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if ((t_1 <= (-1d+99)) .or. (.not. (t_1 <= 1d+161))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
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) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if ((t_1 <= -1e+99) || !(t_1 <= 1e+161)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if (t_1 <= -1e+99) or not (t_1 <= 1e+161): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if ((t_1 <= -1e+99) || !(t_1 <= 1e+161)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if ((t_1 <= -1e+99) || ~((t_1 <= 1e+161))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+99], N[Not[LessEqual[t$95$1, 1e+161]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+99} \lor \neg \left(t\_1 \leq 10^{+161}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -9.9999999999999997e98 or 1e161 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 44.3%
*-commutative44.3%
Simplified44.3%
Taylor expanded in y around inf 44.3%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in t around 0 99.8%
mul-1-neg99.8%
unsub-neg99.8%
Simplified99.8%
if -9.9999999999999997e98 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 1e161Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.1e-109) (not (<= z 1.3e-125))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (+ x (/ (- x (* y z)) x)) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.1e-109) || !(z <= 1.3e-125)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + ((x - (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 ((z <= (-3.1d-109)) .or. (.not. (z <= 1.3d-125))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = (x + ((x - (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 ((z <= -3.1e-109) || !(z <= 1.3e-125)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = (x + ((x - (y * z)) / x)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.1e-109) or not (z <= 1.3e-125): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = (x + ((x - (y * z)) / x)) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.1e-109) || !(z <= 1.3e-125)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(x - Float64(y * z)) / x)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.1e-109) || ~((z <= 1.3e-125))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = (x + ((x - (y * z)) / x)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.1e-109], N[Not[LessEqual[z, 1.3e-125]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.1 \cdot 10^{-109} \lor \neg \left(z \leq 1.3 \cdot 10^{-125}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x - y \cdot z}{x}}{x + 1}\\
\end{array}
\end{array}
if z < -3.1e-109 or 1.30000000000000003e-125 < z Initial program 83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in y around inf 79.9%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in t around 0 96.0%
mul-1-neg96.0%
unsub-neg96.0%
Simplified96.0%
if -3.1e-109 < z < 1.30000000000000003e-125Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 90.3%
fma-neg90.3%
associate-*r/90.3%
neg-mul-190.3%
neg-sub090.3%
fma-def90.3%
+-commutative90.3%
associate--r+90.3%
neg-sub090.3%
remove-double-neg90.3%
*-commutative90.3%
Simplified90.3%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.45e-110) (not (<= z 1.2e-125))) (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)) (/ (- (+ x 1.0) (/ y (/ x z))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-110) || !(z <= 1.2e-125)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y / (x / z))) / (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 ((z <= (-1.45d-110)) .or. (.not. (z <= 1.2d-125))) then
tmp = (x + (y / (t - (x / z)))) / (x + 1.0d0)
else
tmp = ((x + 1.0d0) - (y / (x / z))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.45e-110) || !(z <= 1.2e-125)) {
tmp = (x + (y / (t - (x / z)))) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.45e-110) or not (z <= 1.2e-125): tmp = (x + (y / (t - (x / z)))) / (x + 1.0) else: tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.45e-110) || !(z <= 1.2e-125)) tmp = Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x + 1.0) - Float64(y / Float64(x / z))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.45e-110) || ~((z <= 1.2e-125))) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); else tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.45e-110], N[Not[LessEqual[z, 1.2e-125]], $MachinePrecision]], N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-110} \lor \neg \left(z \leq 1.2 \cdot 10^{-125}\right):\\
\;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - \frac{y}{\frac{x}{z}}}{x + 1}\\
\end{array}
\end{array}
if z < -1.4500000000000001e-110 or 1.2000000000000001e-125 < z Initial program 83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in y around inf 79.9%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in t around 0 96.0%
mul-1-neg96.0%
unsub-neg96.0%
Simplified96.0%
if -1.4500000000000001e-110 < z < 1.2000000000000001e-125Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 90.3%
associate-+r+90.3%
mul-1-neg90.3%
unsub-neg90.3%
+-commutative90.3%
associate-/l*90.3%
+-commutative90.3%
Simplified90.3%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (<= x -1500000000.0) 1.0 (if (<= x 16500000000000.0) (+ (/ x (+ x 1.0)) (/ y (* t (+ x 1.0)))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1500000000.0) {
tmp = 1.0;
} else if (x <= 16500000000000.0) {
tmp = (x / (x + 1.0)) + (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 <= (-1500000000.0d0)) then
tmp = 1.0d0
else if (x <= 16500000000000.0d0) then
tmp = (x / (x + 1.0d0)) + (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 <= -1500000000.0) {
tmp = 1.0;
} else if (x <= 16500000000000.0) {
tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0)));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1500000000.0: tmp = 1.0 elif x <= 16500000000000.0: tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0))) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1500000000.0) tmp = 1.0; elseif (x <= 16500000000000.0) tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(y / Float64(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 <= -1500000000.0) tmp = 1.0; elseif (x <= 16500000000000.0) tmp = (x / (x + 1.0)) + (y / (t * (x + 1.0))); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1500000000.0], 1.0, If[LessEqual[x, 16500000000000.0], N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1500000000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 16500000000000:\\
\;\;\;\;\frac{x}{x + 1} + \frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.5e9 or 1.65e13 < x Initial program 88.7%
*-commutative88.7%
Simplified88.7%
div-sub88.7%
Applied egg-rr88.7%
Taylor expanded in x around inf 95.5%
if -1.5e9 < x < 1.65e13Initial program 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in y around inf 67.2%
associate-/l*74.3%
Simplified74.3%
Taylor expanded in t around inf 66.4%
+-commutative66.4%
+-commutative66.4%
Simplified66.4%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.35e-39) (not (<= x 2.9e-16))) (/ x (+ x 1.0)) (* y (/ z (- (* z t) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.35e-39) || !(x <= 2.9e-16)) {
tmp = x / (x + 1.0);
} else {
tmp = y * (z / ((z * 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 ((x <= (-2.35d-39)) .or. (.not. (x <= 2.9d-16))) then
tmp = x / (x + 1.0d0)
else
tmp = y * (z / ((z * t) - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.35e-39) || !(x <= 2.9e-16)) {
tmp = x / (x + 1.0);
} else {
tmp = y * (z / ((z * t) - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.35e-39) or not (x <= 2.9e-16): tmp = x / (x + 1.0) else: tmp = y * (z / ((z * t) - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.35e-39) || !(x <= 2.9e-16)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y * Float64(z / Float64(Float64(z * t) - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.35e-39) || ~((x <= 2.9e-16))) tmp = x / (x + 1.0); else tmp = y * (z / ((z * t) - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.35e-39], N[Not[LessEqual[x, 2.9e-16]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-39} \lor \neg \left(x \leq 2.9 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\end{array}
\end{array}
if x < -2.3500000000000001e-39 or 2.8999999999999998e-16 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in t around inf 89.7%
+-commutative89.7%
Simplified89.7%
if -2.3500000000000001e-39 < x < 2.8999999999999998e-16Initial program 89.2%
*-commutative89.2%
Simplified89.2%
div-sub89.2%
Applied egg-rr89.2%
Taylor expanded in y around inf 53.1%
times-frac59.7%
+-commutative59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in x around 0 59.7%
Final simplification77.9%
(FPCore (x y z t) :precision binary64 (if (<= x -45000000.0) 1.0 (if (<= x 25000000000000.0) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -45000000.0) {
tmp = 1.0;
} else if (x <= 25000000000000.0) {
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 <= (-45000000.0d0)) then
tmp = 1.0d0
else if (x <= 25000000000000.0d0) 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 <= -45000000.0) {
tmp = 1.0;
} else if (x <= 25000000000000.0) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -45000000.0: tmp = 1.0 elif x <= 25000000000000.0: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -45000000.0) tmp = 1.0; elseif (x <= 25000000000000.0) 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 <= -45000000.0) tmp = 1.0; elseif (x <= 25000000000000.0) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -45000000.0], 1.0, If[LessEqual[x, 25000000000000.0], 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 -45000000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 25000000000000:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.5e7 or 2.5e13 < x Initial program 88.7%
*-commutative88.7%
Simplified88.7%
div-sub88.7%
Applied egg-rr88.7%
Taylor expanded in x around inf 95.5%
if -4.5e7 < x < 2.5e13Initial program 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in z around inf 66.4%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.2e-49) (not (<= x 2.45e-32))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-49) || !(x <= 2.45e-32)) {
tmp = x / (x + 1.0);
} else {
tmp = 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 ((x <= (-2.2d-49)) .or. (.not. (x <= 2.45d-32))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.2e-49) || !(x <= 2.45e-32)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.2e-49) or not (x <= 2.45e-32): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.2e-49) || !(x <= 2.45e-32)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.2e-49) || ~((x <= 2.45e-32))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.2e-49], N[Not[LessEqual[x, 2.45e-32]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-49} \lor \neg \left(x \leq 2.45 \cdot 10^{-32}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -2.1999999999999999e-49 or 2.4499999999999999e-32 < x Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in t around inf 89.2%
+-commutative89.2%
Simplified89.2%
if -2.1999999999999999e-49 < x < 2.4499999999999999e-32Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in z around inf 67.3%
Taylor expanded in x around 0 53.6%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (<= x -4.3e-32) 1.0 (if (<= x 4.5e-33) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.3e-32) {
tmp = 1.0;
} else if (x <= 4.5e-33) {
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 <= (-4.3d-32)) then
tmp = 1.0d0
else if (x <= 4.5d-33) 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 <= -4.3e-32) {
tmp = 1.0;
} else if (x <= 4.5e-33) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.3e-32: tmp = 1.0 elif x <= 4.5e-33: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.3e-32) tmp = 1.0; elseif (x <= 4.5e-33) 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 <= -4.3e-32) tmp = 1.0; elseif (x <= 4.5e-33) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.3e-32], 1.0, If[LessEqual[x, 4.5e-33], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-32}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.2999999999999999e-32 or 4.49999999999999991e-33 < x Initial program 88.4%
*-commutative88.4%
Simplified88.4%
div-sub88.4%
Applied egg-rr88.4%
Taylor expanded in x around inf 87.6%
if -4.2999999999999999e-32 < x < 4.49999999999999991e-33Initial program 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in z around inf 67.2%
Taylor expanded in x around 0 52.1%
Final simplification73.3%
(FPCore (x y z t) :precision binary64 (/ (+ x (/ y (- t (/ x z)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (y / (t - (x / z)))) / (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 + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (y / (t - (x / z)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (y / (t - (x / z)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(y / Float64(t - Float64(x / z)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (y / (t - (x / z)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}
\end{array}
Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in y around inf 77.8%
associate-/l*86.6%
Simplified86.6%
Taylor expanded in t around 0 88.9%
mul-1-neg88.9%
unsub-neg88.9%
Simplified88.9%
Final simplification88.9%
(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 88.8%
*-commutative88.8%
Simplified88.8%
div-sub88.8%
Applied egg-rr88.8%
Taylor expanded in x around inf 58.6%
Final simplification58.6%
(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 2024031
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))