
(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 (+ x 1.0))) (t_2 (- x (* z t))))
(if (<= (/ (- x (/ (- (* y z) x) t_2)) (+ x 1.0)) INFINITY)
(+ (fma y (/ (/ z (+ x 1.0)) (- (* z t) x)) t_1) (/ t_1 t_2))
(/ (+ x (/ y t)) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double t_1 = x / (x + 1.0);
double t_2 = x - (z * t);
double tmp;
if (((x - (((y * z) - x) / t_2)) / (x + 1.0)) <= ((double) INFINITY)) {
tmp = fma(y, ((z / (x + 1.0)) / ((z * t) - x)), t_1) + (t_1 / t_2);
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(x / Float64(x + 1.0)) t_2 = Float64(x - Float64(z * t)) tmp = 0.0 if (Float64(Float64(x - Float64(Float64(Float64(y * z) - x) / t_2)) / Float64(x + 1.0)) <= Inf) tmp = Float64(fma(y, Float64(Float64(z / Float64(x + 1.0)) / Float64(Float64(z * t) - x)), t_1) + Float64(t_1 / t_2)); else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(x - N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{x + 1}\\
t_2 := x - z \cdot t\\
\mathbf{if}\;\frac{x - \frac{y \cdot z - x}{t\_2}}{x + 1} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{z}{x + 1}}{z \cdot t - x}, t\_1\right) + \frac{t\_1}{t\_2}\\
\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 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around 0 92.3%
+-commutative92.3%
associate-/l*97.1%
fma-define97.1%
associate-/r*99.1%
+-commutative99.1%
+-commutative99.1%
associate-/r*99.1%
+-commutative99.1%
Simplified99.1%
if +inf.0 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 0.0%
*-commutative0.0%
Simplified0.0%
Taylor expanded in z around inf 100.0%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ (- (* y z) x) (- x (* z t)))) (+ x 1.0))))
(if (<= t_1 -1e+114)
(* y (/ (/ z (+ x 1.0)) (- (* z t) x)))
(if (<= t_1 5e+304) 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) / (x - (z * t)))) / (x + 1.0);
double tmp;
if (t_1 <= -1e+114) {
tmp = y * ((z / (x + 1.0)) / ((z * t) - x));
} else if (t_1 <= 5e+304) {
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) / (x - (z * t)))) / (x + 1.0d0)
if (t_1 <= (-1d+114)) then
tmp = y * ((z / (x + 1.0d0)) / ((z * t) - x))
else if (t_1 <= 5d+304) 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) / (x - (z * t)))) / (x + 1.0);
double tmp;
if (t_1 <= -1e+114) {
tmp = y * ((z / (x + 1.0)) / ((z * t) - x));
} else if (t_1 <= 5e+304) {
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) / (x - (z * t)))) / (x + 1.0) tmp = 0 if t_1 <= -1e+114: tmp = y * ((z / (x + 1.0)) / ((z * t) - x)) elif t_1 <= 5e+304: 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(x - Float64(z * t)))) / Float64(x + 1.0)) tmp = 0.0 if (t_1 <= -1e+114) tmp = Float64(y * Float64(Float64(z / Float64(x + 1.0)) / Float64(Float64(z * t) - x))); elseif (t_1 <= 5e+304) 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) / (x - (z * t)))) / (x + 1.0); tmp = 0.0; if (t_1 <= -1e+114) tmp = y * ((z / (x + 1.0)) / ((z * t) - x)); elseif (t_1 <= 5e+304) 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[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+114], N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+304], 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}{x - z \cdot t}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+114}:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{z \cdot t - x}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;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))) < -1e114Initial program 58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in y around inf 58.4%
associate-/l*81.4%
associate-/r*90.7%
+-commutative90.7%
Simplified90.7%
if -1e114 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.9999999999999997e304Initial program 98.9%
if 4.9999999999999997e304 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 28.1%
*-commutative28.1%
Simplified28.1%
Taylor expanded in z around inf 84.9%
Final simplification96.8%
(FPCore (x y z t)
:precision binary64
(if (<= x -7e-103)
1.0
(if (<= x 1.32e-157)
(/ y t)
(if (<= x 1.55e-105)
(* x (+ 1.0 (/ -1.0 (* z t))))
(if (<= x 1.8e-84) (/ (* y z) (- x)) 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -7e-103) {
tmp = 1.0;
} else if (x <= 1.32e-157) {
tmp = y / t;
} else if (x <= 1.55e-105) {
tmp = x * (1.0 + (-1.0 / (z * t)));
} else if (x <= 1.8e-84) {
tmp = (y * z) / -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 <= (-7d-103)) then
tmp = 1.0d0
else if (x <= 1.32d-157) then
tmp = y / t
else if (x <= 1.55d-105) then
tmp = x * (1.0d0 + ((-1.0d0) / (z * t)))
else if (x <= 1.8d-84) then
tmp = (y * z) / -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 <= -7e-103) {
tmp = 1.0;
} else if (x <= 1.32e-157) {
tmp = y / t;
} else if (x <= 1.55e-105) {
tmp = x * (1.0 + (-1.0 / (z * t)));
} else if (x <= 1.8e-84) {
tmp = (y * z) / -x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -7e-103: tmp = 1.0 elif x <= 1.32e-157: tmp = y / t elif x <= 1.55e-105: tmp = x * (1.0 + (-1.0 / (z * t))) elif x <= 1.8e-84: tmp = (y * z) / -x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -7e-103) tmp = 1.0; elseif (x <= 1.32e-157) tmp = Float64(y / t); elseif (x <= 1.55e-105) tmp = Float64(x * Float64(1.0 + Float64(-1.0 / Float64(z * t)))); elseif (x <= 1.8e-84) tmp = Float64(Float64(y * z) / Float64(-x)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -7e-103) tmp = 1.0; elseif (x <= 1.32e-157) tmp = y / t; elseif (x <= 1.55e-105) tmp = x * (1.0 + (-1.0 / (z * t))); elseif (x <= 1.8e-84) tmp = (y * z) / -x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -7e-103], 1.0, If[LessEqual[x, 1.32e-157], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.55e-105], N[(x * N[(1.0 + N[(-1.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-84], N[(N[(y * z), $MachinePrecision] / (-x)), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-103}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{-157}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-105}:\\
\;\;\;\;x \cdot \left(1 + \frac{-1}{z \cdot t}\right)\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-84}:\\
\;\;\;\;\frac{y \cdot z}{-x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.00000000000000032e-103 or 1.80000000000000002e-84 < x Initial program 87.8%
*-commutative87.8%
Simplified87.8%
Taylor expanded in z around inf 63.0%
Taylor expanded in x around inf 74.5%
if -7.00000000000000032e-103 < x < 1.3200000000000001e-157Initial program 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in z around inf 77.4%
Taylor expanded in x around 0 58.7%
if 1.3200000000000001e-157 < x < 1.55000000000000007e-105Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 62.0%
+-commutative62.0%
Simplified62.0%
Taylor expanded in x around 0 60.9%
if 1.55000000000000007e-105 < x < 1.80000000000000002e-84Initial program 75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in t around 0 75.9%
associate-+r+75.9%
mul-1-neg75.9%
unsub-neg75.9%
+-commutative75.9%
associate-/l*75.5%
+-commutative75.5%
Simplified75.5%
Taylor expanded in x around 0 75.9%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.85e-52) (not (<= z 3.7e-16))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ -1.0 (+ (/ (* z t) x) -1.0))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.85e-52) || !(z <= 3.7e-16)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (-1.0 / (((z * t) / x) + -1.0))) / (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.85d-52)) .or. (.not. (z <= 3.7d-16))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + ((-1.0d0) / (((z * t) / x) + (-1.0d0)))) / (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.85e-52) || !(z <= 3.7e-16)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (-1.0 / (((z * t) / x) + -1.0))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.85e-52) or not (z <= 3.7e-16): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (-1.0 / (((z * t) / x) + -1.0))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.85e-52) || !(z <= 3.7e-16)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(-1.0 / Float64(Float64(Float64(z * t) / x) + -1.0))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.85e-52) || ~((z <= 3.7e-16))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (-1.0 / (((z * t) / x) + -1.0))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.85e-52], N[Not[LessEqual[z, 3.7e-16]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(-1.0 / N[(N[(N[(z * t), $MachinePrecision] / x), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-52} \lor \neg \left(z \leq 3.7 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{-1}{\frac{z \cdot t}{x} + -1}}{x + 1}\\
\end{array}
\end{array}
if z < -1.8499999999999999e-52 or 3.7e-16 < z Initial program 78.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in z around inf 84.2%
if -1.8499999999999999e-52 < z < 3.7e-16Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 81.2%
+-commutative81.2%
Simplified81.2%
clear-num81.2%
inv-pow81.2%
div-sub81.2%
*-commutative81.2%
un-div-inv81.2%
rgt-mult-inverse81.2%
Applied egg-rr81.2%
unpow-181.2%
sub-neg81.2%
metadata-eval81.2%
Simplified81.2%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.22e-51) (not (<= z 3.1e-16))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- x (/ x (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.22e-51) || !(z <= 3.1e-16)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - 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 <= (-1.22d-51)) .or. (.not. (z <= 3.1d-16))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x - (x / ((z * t) - 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 <= -1.22e-51) || !(z <= 3.1e-16)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.22e-51) or not (z <= 3.1e-16): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.22e-51) || !(z <= 3.1e-16)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.22e-51) || ~((z <= 3.1e-16))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.22e-51], N[Not[LessEqual[z, 3.1e-16]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.22 \cdot 10^{-51} \lor \neg \left(z \leq 3.1 \cdot 10^{-16}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -1.21999999999999998e-51 or 3.1000000000000001e-16 < z Initial program 78.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in z around inf 84.2%
if -1.21999999999999998e-51 < z < 3.1000000000000001e-16Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 81.2%
+-commutative81.2%
Simplified81.2%
Final simplification82.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.4e-53) (not (<= z 8.4e-72))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.4e-53) || !(z <= 8.4e-72)) {
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 ((z <= (-7.4d-53)) .or. (.not. (z <= 8.4d-72))) 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 ((z <= -7.4e-53) || !(z <= 8.4e-72)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.4e-53) or not (z <= 8.4e-72): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.4e-53) || !(z <= 8.4e-72)) 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 ((z <= -7.4e-53) || ~((z <= 8.4e-72))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.4e-53], N[Not[LessEqual[z, 8.4e-72]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-53} \lor \neg \left(z \leq 8.4 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -7.39999999999999965e-53 or 8.4e-72 < z Initial program 80.3%
*-commutative80.3%
Simplified80.3%
Taylor expanded in z around inf 81.3%
if -7.39999999999999965e-53 < z < 8.4e-72Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 49.7%
Taylor expanded in x around inf 69.6%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (<= x -1.95e-103) 1.0 (if (<= x 4.6e-90) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.95e-103) {
tmp = 1.0;
} else if (x <= 4.6e-90) {
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.95d-103)) then
tmp = 1.0d0
else if (x <= 4.6d-90) 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.95e-103) {
tmp = 1.0;
} else if (x <= 4.6e-90) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.95e-103: tmp = 1.0 elif x <= 4.6e-90: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.95e-103) tmp = 1.0; elseif (x <= 4.6e-90) 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.95e-103) tmp = 1.0; elseif (x <= 4.6e-90) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.95e-103], 1.0, If[LessEqual[x, 4.6e-90], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.95 \cdot 10^{-103}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-90}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.9500000000000001e-103 or 4.5999999999999996e-90 < x Initial program 88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in z around inf 62.3%
Taylor expanded in x around inf 73.7%
if -1.9500000000000001e-103 < x < 4.5999999999999996e-90Initial program 89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in z around inf 78.4%
Taylor expanded in x around 0 55.4%
Final simplification67.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.65e-110) 1.0 (if (<= x 1.05e-101) x 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.65e-110) {
tmp = 1.0;
} else if (x <= 1.05e-101) {
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.65d-110)) then
tmp = 1.0d0
else if (x <= 1.05d-101) 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.65e-110) {
tmp = 1.0;
} else if (x <= 1.05e-101) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.65e-110: tmp = 1.0 elif x <= 1.05e-101: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.65e-110) tmp = 1.0; elseif (x <= 1.05e-101) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.65e-110) tmp = 1.0; elseif (x <= 1.05e-101) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.65e-110], 1.0, If[LessEqual[x, 1.05e-101], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.65 \cdot 10^{-110}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-101}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.65e-110 or 1.05000000000000008e-101 < x Initial program 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in z around inf 62.7%
Taylor expanded in x around inf 72.8%
if -1.65e-110 < x < 1.05000000000000008e-101Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in t around inf 26.3%
+-commutative26.3%
Simplified26.3%
Taylor expanded in x around 0 26.3%
Final simplification56.3%
(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.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in z around inf 68.1%
Taylor expanded in x around inf 51.9%
Final simplification51.9%
(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 2024115
(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)))