
(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 9 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 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0)))) (if (<= t_1 2e+247) t_1 (/ (+ x (/ y t)) (+ x 1.0)))))
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 <= 2e+247) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (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) :: tmp
t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= 2d+247) then
tmp = t_1
else
tmp = (x + (y / t)) / (x + 1.0d0)
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 <= 2e+247) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
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 <= 2e+247: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) 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 <= 2e+247) 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if (t_1 <= 2e+247) 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[(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[LessEqual[t$95$1, 2e+247], 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{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+247}:\\
\;\;\;\;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))) < 1.9999999999999999e247Initial program 96.8%
if 1.9999999999999999e247 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 31.3%
*-commutative31.3%
Simplified31.3%
Taylor expanded in z around inf 90.3%
Final simplification96.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -1.04e-29)
t_1
(if (<= x 1.35e-148)
(/ y t)
(if (<= x 1.8e-58)
(- 1.0 (/ (* y z) x))
(if (<= x 1.8e-31) (/ y (* t (+ x 1.0))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.04e-29) {
tmp = t_1;
} else if (x <= 1.35e-148) {
tmp = y / t;
} else if (x <= 1.8e-58) {
tmp = 1.0 - ((y * z) / x);
} else if (x <= 1.8e-31) {
tmp = y / (t * (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 / (x + 1.0d0)
if (x <= (-1.04d-29)) then
tmp = t_1
else if (x <= 1.35d-148) then
tmp = y / t
else if (x <= 1.8d-58) then
tmp = 1.0d0 - ((y * z) / x)
else if (x <= 1.8d-31) then
tmp = y / (t * (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 / (x + 1.0);
double tmp;
if (x <= -1.04e-29) {
tmp = t_1;
} else if (x <= 1.35e-148) {
tmp = y / t;
} else if (x <= 1.8e-58) {
tmp = 1.0 - ((y * z) / x);
} else if (x <= 1.8e-31) {
tmp = y / (t * (x + 1.0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -1.04e-29: tmp = t_1 elif x <= 1.35e-148: tmp = y / t elif x <= 1.8e-58: tmp = 1.0 - ((y * z) / x) elif x <= 1.8e-31: tmp = y / (t * (x + 1.0)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -1.04e-29) tmp = t_1; elseif (x <= 1.35e-148) tmp = Float64(y / t); elseif (x <= 1.8e-58) tmp = Float64(1.0 - Float64(Float64(y * z) / x)); elseif (x <= 1.8e-31) tmp = Float64(y / Float64(t * Float64(x + 1.0))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -1.04e-29) tmp = t_1; elseif (x <= 1.35e-148) tmp = y / t; elseif (x <= 1.8e-58) tmp = 1.0 - ((y * z) / x); elseif (x <= 1.8e-31) tmp = y / (t * (x + 1.0)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.04e-29], t$95$1, If[LessEqual[x, 1.35e-148], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.8e-58], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-31], N[(y / N[(t * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -1.04 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-148}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-58}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-31}:\\
\;\;\;\;\frac{y}{t \cdot \left(x + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.03999999999999995e-29 or 1.80000000000000002e-31 < x Initial program 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in t around inf 89.5%
+-commutative89.5%
Simplified89.5%
if -1.03999999999999995e-29 < x < 1.34999999999999994e-148Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in x around 0 62.9%
if 1.34999999999999994e-148 < x < 1.80000000000000005e-58Initial program 99.7%
*-commutative99.7%
Simplified99.7%
clear-num99.7%
*-un-lft-identity99.7%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 51.4%
associate-+r+51.4%
+-commutative51.4%
mul-1-neg51.4%
associate-*r/51.4%
sub-neg51.4%
+-commutative51.4%
div-sub51.4%
*-inverses51.4%
associate-/l*51.4%
+-commutative51.4%
Simplified51.4%
Taylor expanded in x around 0 51.4%
if 1.80000000000000005e-58 < x < 1.80000000000000002e-31Initial program 77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in z around inf 75.0%
Taylor expanded in y around inf 63.8%
Final simplification75.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ x (+ x 1.0))))
(if (<= x -1.14e-29)
t_1
(if (<= x 1.1e-148)
(/ y t)
(if (<= x 1.3e-58)
(- 1.0 (/ (* y z) x))
(if (<= x 2.5e-31) (/ y t) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double tmp;
if (x <= -1.14e-29) {
tmp = t_1;
} else if (x <= 1.1e-148) {
tmp = y / t;
} else if (x <= 1.3e-58) {
tmp = 1.0 - ((y * z) / x);
} else if (x <= 2.5e-31) {
tmp = y / t;
} 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 / (x + 1.0d0)
if (x <= (-1.14d-29)) then
tmp = t_1
else if (x <= 1.1d-148) then
tmp = y / t
else if (x <= 1.3d-58) then
tmp = 1.0d0 - ((y * z) / x)
else if (x <= 2.5d-31) then
tmp = y / t
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 / (x + 1.0);
double tmp;
if (x <= -1.14e-29) {
tmp = t_1;
} else if (x <= 1.1e-148) {
tmp = y / t;
} else if (x <= 1.3e-58) {
tmp = 1.0 - ((y * z) / x);
} else if (x <= 2.5e-31) {
tmp = y / t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x / (x + 1.0) tmp = 0 if x <= -1.14e-29: tmp = t_1 elif x <= 1.1e-148: tmp = y / t elif x <= 1.3e-58: tmp = 1.0 - ((y * z) / x) elif x <= 2.5e-31: tmp = y / t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -1.14e-29) tmp = t_1; elseif (x <= 1.1e-148) tmp = Float64(y / t); elseif (x <= 1.3e-58) tmp = Float64(1.0 - Float64(Float64(y * z) / x)); elseif (x <= 2.5e-31) tmp = Float64(y / t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x / (x + 1.0); tmp = 0.0; if (x <= -1.14e-29) tmp = t_1; elseif (x <= 1.1e-148) tmp = y / t; elseif (x <= 1.3e-58) tmp = 1.0 - ((y * z) / x); elseif (x <= 2.5e-31) tmp = y / t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.14e-29], t$95$1, If[LessEqual[x, 1.1e-148], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.3e-58], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.5e-31], N[(y / t), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -1.14 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-148}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-58}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-31}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.13999999999999995e-29 or 2.5e-31 < x Initial program 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in t around inf 89.5%
+-commutative89.5%
Simplified89.5%
if -1.13999999999999995e-29 < x < 1.10000000000000009e-148 or 1.30000000000000003e-58 < x < 2.5e-31Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in x around 0 63.0%
if 1.10000000000000009e-148 < x < 1.30000000000000003e-58Initial program 99.7%
*-commutative99.7%
Simplified99.7%
clear-num99.7%
*-un-lft-identity99.7%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 51.4%
associate-+r+51.4%
+-commutative51.4%
mul-1-neg51.4%
associate-*r/51.4%
sub-neg51.4%
+-commutative51.4%
div-sub51.4%
*-inverses51.4%
associate-/l*51.4%
+-commutative51.4%
Simplified51.4%
Taylor expanded in x around 0 51.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.5e-105) (not (<= t 5.2e-76))) (/ (+ 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 <= -1.5e-105) || !(t <= 5.2e-76)) {
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 <= (-1.5d-105)) .or. (.not. (t <= 5.2d-76))) 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 <= -1.5e-105) || !(t <= 5.2e-76)) {
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 <= -1.5e-105) or not (t <= 5.2e-76): 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 <= -1.5e-105) || !(t <= 5.2e-76)) 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 <= -1.5e-105) || ~((t <= 5.2e-76))) 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, -1.5e-105], N[Not[LessEqual[t, 5.2e-76]], $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 -1.5 \cdot 10^{-105} \lor \neg \left(t \leq 5.2 \cdot 10^{-76}\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 < -1.5e-105 or 5.1999999999999999e-76 < t Initial program 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in z around inf 91.7%
if -1.5e-105 < t < 5.1999999999999999e-76Initial program 94.1%
*-commutative94.1%
Simplified94.1%
clear-num94.1%
*-un-lft-identity94.1%
associate-/r*94.1%
Applied egg-rr94.1%
Taylor expanded in t around 0 74.2%
associate-+r+74.2%
+-commutative74.2%
mul-1-neg74.2%
associate-*r/77.1%
sub-neg77.1%
+-commutative77.1%
div-sub77.1%
*-inverses77.1%
associate-/l*77.6%
+-commutative77.6%
Simplified77.6%
Final simplification86.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.2e-177) (not (<= z 9e-87))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (/ (* y z) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e-177) || !(z <= 9e-87)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((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 ((z <= (-3.2d-177)) .or. (.not. (z <= 9d-87))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y * z) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e-177) || !(z <= 9e-87)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y * z) / x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.2e-177) or not (z <= 9e-87): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y * z) / x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.2e-177) || !(z <= 9e-87)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y * z) / x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.2e-177) || ~((z <= 9e-87))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y * z) / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.2e-177], N[Not[LessEqual[z, 9e-87]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-177} \lor \neg \left(z \leq 9 \cdot 10^{-87}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y \cdot z}{x}\\
\end{array}
\end{array}
if z < -3.1999999999999998e-177 or 8.99999999999999915e-87 < z Initial program 87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in z around inf 87.0%
if -3.1999999999999998e-177 < z < 8.99999999999999915e-87Initial program 99.8%
*-commutative99.8%
Simplified99.8%
clear-num99.7%
*-un-lft-identity99.7%
associate-/r*99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 81.3%
associate-+r+81.3%
+-commutative81.3%
mul-1-neg81.3%
associate-*r/81.4%
sub-neg81.4%
+-commutative81.4%
div-sub81.4%
*-inverses81.4%
associate-/l*81.4%
+-commutative81.4%
Simplified81.4%
Taylor expanded in x around 0 79.7%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.2e-29) (not (<= x 1.6e-31))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.2e-29) || !(x <= 1.6e-31)) {
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 <= (-4.2d-29)) .or. (.not. (x <= 1.6d-31))) 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 <= -4.2e-29) || !(x <= 1.6e-31)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.2e-29) or not (x <= 1.6e-31): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.2e-29) || !(x <= 1.6e-31)) 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 <= -4.2e-29) || ~((x <= 1.6e-31))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.2e-29], N[Not[LessEqual[x, 1.6e-31]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{-29} \lor \neg \left(x \leq 1.6 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -4.19999999999999979e-29 or 1.60000000000000009e-31 < x Initial program 92.6%
*-commutative92.6%
Simplified92.6%
Taylor expanded in t around inf 89.5%
+-commutative89.5%
Simplified89.5%
if -4.19999999999999979e-29 < x < 1.60000000000000009e-31Initial program 90.8%
*-commutative90.8%
Simplified90.8%
Taylor expanded in x around 0 56.8%
Final simplification73.6%
(FPCore (x y z t) :precision binary64 (if (<= x -3.35e-18) 1.0 (if (<= x 1.65e-31) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.35e-18) {
tmp = 1.0;
} else if (x <= 1.65e-31) {
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 <= (-3.35d-18)) then
tmp = 1.0d0
else if (x <= 1.65d-31) 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 <= -3.35e-18) {
tmp = 1.0;
} else if (x <= 1.65e-31) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.35e-18: tmp = 1.0 elif x <= 1.65e-31: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.35e-18) tmp = 1.0; elseif (x <= 1.65e-31) 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 <= -3.35e-18) tmp = 1.0; elseif (x <= 1.65e-31) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.35e-18], 1.0, If[LessEqual[x, 1.65e-31], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.35 \cdot 10^{-18}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-31}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.3499999999999999e-18 or 1.65e-31 < x Initial program 92.5%
*-commutative92.5%
Simplified92.5%
Taylor expanded in x around inf 87.7%
if -3.3499999999999999e-18 < x < 1.65e-31Initial program 90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in x around 0 55.9%
(FPCore (x y z t) :precision binary64 (if (<= x -1.15e-14) 1.0 (if (<= x 7.4e-10) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.15e-14) {
tmp = 1.0;
} else if (x <= 7.4e-10) {
tmp = x;
} 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.15d-14)) then
tmp = 1.0d0
else if (x <= 7.4d-10) then
tmp = x
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.15e-14) {
tmp = 1.0;
} else if (x <= 7.4e-10) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.15e-14: tmp = 1.0 elif x <= 7.4e-10: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.15e-14) tmp = 1.0; elseif (x <= 7.4e-10) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.15e-14) tmp = 1.0; elseif (x <= 7.4e-10) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.15e-14], 1.0, If[LessEqual[x, 7.4e-10], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-14}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-10}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.14999999999999999e-14 or 7.4000000000000003e-10 < x Initial program 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in x around inf 90.9%
if -1.14999999999999999e-14 < x < 7.4000000000000003e-10Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in t around inf 25.8%
+-commutative25.8%
Simplified25.8%
Taylor expanded in x around 0 25.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 49.5%
(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 2024097
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))