
(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 10 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) (- x (* z t)))) (+ x 1.0))))
(if (<= t_1 -1e+284)
(/ y (* (+ x 1.0) (- t (/ x z))))
(if (<= t_1 2e+248)
(/ (- (/ (- x (* y z)) (fma z t (- x))) x) (- -1.0 x))
(/ (+ 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+284) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 2e+248) {
tmp = (((x - (y * z)) / fma(z, t, -x)) - x) / (-1.0 - x);
} 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+284) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t - Float64(x / z)))); elseif (t_1 <= 2e+248) tmp = Float64(Float64(Float64(Float64(x - Float64(y * z)) / fma(z, t, Float64(-x))) - x) / Float64(-1.0 - x)); 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[(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+284], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+248], N[(N[(N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(z * t + (-x)), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $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 - \frac{y \cdot z - x}{x - z \cdot t}}{x + 1}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+284}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+248}:\\
\;\;\;\;\frac{\frac{x - y \cdot z}{\mathsf{fma}\left(z, t, -x\right)} - x}{-1 - x}\\
\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.00000000000000008e284Initial program 31.4%
*-commutative31.4%
Simplified31.4%
Taylor expanded in z around inf 31.4%
mul-1-neg31.4%
unsub-neg31.4%
Simplified31.4%
Taylor expanded in y around inf 89.1%
*-commutative89.1%
+-commutative89.1%
Simplified89.1%
if -1.00000000000000008e284 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000009e248Initial program 99.0%
*-commutative99.0%
Simplified99.0%
fmm-def99.0%
Applied egg-rr99.0%
if 2.00000000000000009e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 26.1%
*-commutative26.1%
Simplified26.1%
Taylor expanded in z around inf 91.0%
+-commutative91.0%
+-commutative91.0%
Simplified91.0%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ (- (* y z) x) (- x (* z t)))) (+ x 1.0))))
(if (<= t_1 -1e+105)
(/ y (* (+ x 1.0) (- t (/ x z))))
(if (<= t_1 2e+248) 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+105) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 2e+248) {
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+105)) then
tmp = y / ((x + 1.0d0) * (t - (x / z)))
else if (t_1 <= 2d+248) 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+105) {
tmp = y / ((x + 1.0) * (t - (x / z)));
} else if (t_1 <= 2e+248) {
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+105: tmp = y / ((x + 1.0) * (t - (x / z))) elif t_1 <= 2e+248: 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+105) tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(t - Float64(x / z)))); elseif (t_1 <= 2e+248) 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+105) tmp = y / ((x + 1.0) * (t - (x / z))); elseif (t_1 <= 2e+248) 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+105], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+248], 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^{+105}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+248}:\\
\;\;\;\;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))) < -9.9999999999999994e104Initial program 62.4%
*-commutative62.4%
Simplified62.4%
Taylor expanded in z around inf 62.4%
mul-1-neg62.4%
unsub-neg62.4%
Simplified62.4%
Taylor expanded in y around inf 93.9%
*-commutative93.9%
+-commutative93.9%
Simplified93.9%
if -9.9999999999999994e104 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 2.00000000000000009e248Initial program 98.9%
if 2.00000000000000009e248 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 26.1%
*-commutative26.1%
Simplified26.1%
Taylor expanded in z around inf 91.0%
+-commutative91.0%
+-commutative91.0%
Simplified91.0%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (- x (/ 1.0 (/ (- x (* z t)) (* y z)))) (+ x 1.0))))
(if (<= z -1.85e+191)
(/ (+ x (/ y t)) (+ x 1.0))
(if (<= z -1.9e-172)
t_1
(if (<= z 1.28e-107)
(/ (+ x (/ (- x (* y z)) x)) (+ x 1.0))
(if (<= z 5e+192) t_1 (/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x - (1.0 / ((x - (z * t)) / (y * z)))) / (x + 1.0);
double tmp;
if (z <= -1.85e+191) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (z <= -1.9e-172) {
tmp = t_1;
} else if (z <= 1.28e-107) {
tmp = (x + ((x - (y * z)) / x)) / (x + 1.0);
} else if (z <= 5e+192) {
tmp = t_1;
} else {
tmp = (x + ((y - (x / z)) / 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 - (1.0d0 / ((x - (z * t)) / (y * z)))) / (x + 1.0d0)
if (z <= (-1.85d+191)) then
tmp = (x + (y / t)) / (x + 1.0d0)
else if (z <= (-1.9d-172)) then
tmp = t_1
else if (z <= 1.28d-107) then
tmp = (x + ((x - (y * z)) / x)) / (x + 1.0d0)
else if (z <= 5d+192) then
tmp = t_1
else
tmp = (x + ((y - (x / z)) / 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 - (1.0 / ((x - (z * t)) / (y * z)))) / (x + 1.0);
double tmp;
if (z <= -1.85e+191) {
tmp = (x + (y / t)) / (x + 1.0);
} else if (z <= -1.9e-172) {
tmp = t_1;
} else if (z <= 1.28e-107) {
tmp = (x + ((x - (y * z)) / x)) / (x + 1.0);
} else if (z <= 5e+192) {
tmp = t_1;
} else {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - (1.0 / ((x - (z * t)) / (y * z)))) / (x + 1.0) tmp = 0 if z <= -1.85e+191: tmp = (x + (y / t)) / (x + 1.0) elif z <= -1.9e-172: tmp = t_1 elif z <= 1.28e-107: tmp = (x + ((x - (y * z)) / x)) / (x + 1.0) elif z <= 5e+192: tmp = t_1 else: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - Float64(1.0 / Float64(Float64(x - Float64(z * t)) / Float64(y * z)))) / Float64(x + 1.0)) tmp = 0.0 if (z <= -1.85e+191) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); elseif (z <= -1.9e-172) tmp = t_1; elseif (z <= 1.28e-107) tmp = Float64(Float64(x + Float64(Float64(x - Float64(y * z)) / x)) / Float64(x + 1.0)); elseif (z <= 5e+192) tmp = t_1; else tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - (1.0 / ((x - (z * t)) / (y * z)))) / (x + 1.0); tmp = 0.0; if (z <= -1.85e+191) tmp = (x + (y / t)) / (x + 1.0); elseif (z <= -1.9e-172) tmp = t_1; elseif (z <= 1.28e-107) tmp = (x + ((x - (y * z)) / x)) / (x + 1.0); elseif (z <= 5e+192) tmp = t_1; else tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(1.0 / N[(N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.85e+191], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.9e-172], t$95$1, If[LessEqual[z, 1.28e-107], N[(N[(x + N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e+192], t$95$1, N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - \frac{1}{\frac{x - z \cdot t}{y \cdot z}}}{x + 1}\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+191}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.28 \cdot 10^{-107}:\\
\;\;\;\;\frac{x + \frac{x - y \cdot z}{x}}{x + 1}\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+192}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\end{array}
\end{array}
if z < -1.85000000000000009e191Initial program 56.1%
*-commutative56.1%
Simplified56.1%
Taylor expanded in z around inf 85.8%
+-commutative85.8%
+-commutative85.8%
Simplified85.8%
if -1.85000000000000009e191 < z < -1.89999999999999993e-172 or 1.28e-107 < z < 5.00000000000000033e192Initial program 95.3%
*-commutative95.3%
Simplified95.3%
clear-num95.3%
inv-pow95.3%
Applied egg-rr95.3%
unpow-195.3%
div-sub93.7%
*-commutative93.7%
div-sub95.3%
Simplified95.3%
Taylor expanded in y around inf 90.7%
if -1.89999999999999993e-172 < z < 1.28e-107Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 85.1%
associate-*r/85.1%
neg-mul-185.1%
Simplified85.1%
if 5.00000000000000033e192 < z Initial program 59.6%
*-commutative59.6%
Simplified59.6%
Taylor expanded in t around -inf 91.9%
mul-1-neg91.9%
unsub-neg91.9%
cancel-sign-sub-inv91.9%
metadata-eval91.9%
*-lft-identity91.9%
+-commutative91.9%
mul-1-neg91.9%
unsub-neg91.9%
Simplified91.9%
Final simplification88.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.35e-118) (not (<= z 1.3e-78))) (/ (+ x (/ y t)) (+ 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 <= -1.35e-118) || !(z <= 1.3e-78)) {
tmp = (x + (y / t)) / (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 <= (-1.35d-118)) .or. (.not. (z <= 1.3d-78))) then
tmp = (x + (y / t)) / (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 <= -1.35e-118) || !(z <= 1.3e-78)) {
tmp = (x + (y / t)) / (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 <= -1.35e-118) or not (z <= 1.3e-78): tmp = (x + (y / t)) / (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 <= -1.35e-118) || !(z <= 1.3e-78)) tmp = Float64(Float64(x + Float64(y / t)) / 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 <= -1.35e-118) || ~((z <= 1.3e-78))) tmp = (x + (y / t)) / (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, -1.35e-118], N[Not[LessEqual[z, 1.3e-78]], $MachinePrecision]], N[(N[(x + N[(y / t), $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 -1.35 \cdot 10^{-118} \lor \neg \left(z \leq 1.3 \cdot 10^{-78}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{x - y \cdot z}{x}}{x + 1}\\
\end{array}
\end{array}
if z < -1.34999999999999997e-118 or 1.3000000000000001e-78 < z Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in z around inf 84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
if -1.34999999999999997e-118 < z < 1.3000000000000001e-78Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 85.0%
associate-*r/85.0%
neg-mul-185.0%
Simplified85.0%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e-120) (not (<= z 6.9e-79))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ (- x (* y (/ z x))) 1.0) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-120) || !(z <= 6.9e-79)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y * (z / 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 <= (-8.5d-120)) .or. (.not. (z <= 6.9d-79))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = ((x - (y * (z / 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 <= -8.5e-120) || !(z <= 6.9e-79)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e-120) or not (z <= 6.9e-79): tmp = (x + (y / t)) / (x + 1.0) else: tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e-120) || !(z <= 6.9e-79)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x - Float64(y * Float64(z / x))) + 1.0) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.5e-120) || ~((z <= 6.9e-79))) tmp = (x + (y / t)) / (x + 1.0); else tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e-120], N[Not[LessEqual[z, 6.9e-79]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-120} \lor \neg \left(z \leq 6.9 \cdot 10^{-79}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y \cdot \frac{z}{x}\right) + 1}{x + 1}\\
\end{array}
\end{array}
if z < -8.50000000000000059e-120 or 6.9000000000000001e-79 < z Initial program 82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in z around inf 84.3%
+-commutative84.3%
+-commutative84.3%
Simplified84.3%
if -8.50000000000000059e-120 < z < 6.9000000000000001e-79Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 85.0%
mul-1-neg85.0%
unsub-neg85.0%
associate-/l*85.0%
+-commutative85.0%
Simplified85.0%
Final simplification84.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.25e-137) (not (<= z 8e-80))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.25e-137) || !(z <= 8e-80)) {
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 <= (-4.25d-137)) .or. (.not. (z <= 8d-80))) 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 <= -4.25e-137) || !(z <= 8e-80)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.25e-137) or not (z <= 8e-80): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.25e-137) || !(z <= 8e-80)) 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 <= -4.25e-137) || ~((z <= 8e-80))) 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, -4.25e-137], N[Not[LessEqual[z, 8e-80]], $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 -4.25 \cdot 10^{-137} \lor \neg \left(z \leq 8 \cdot 10^{-80}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -4.2500000000000001e-137 or 7.99999999999999969e-80 < z Initial program 82.7%
*-commutative82.7%
Simplified82.7%
Taylor expanded in z around inf 83.0%
+-commutative83.0%
+-commutative83.0%
Simplified83.0%
if -4.2500000000000001e-137 < z < 7.99999999999999969e-80Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 73.1%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2e-64) (not (<= x 2.45e-86))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2e-64) || !(x <= 2.45e-86)) {
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 <= (-2d-64)) .or. (.not. (x <= 2.45d-86))) 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 <= -2e-64) || !(x <= 2.45e-86)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2e-64) or not (x <= 2.45e-86): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2e-64) || !(x <= 2.45e-86)) 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 <= -2e-64) || ~((x <= 2.45e-86))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2e-64], N[Not[LessEqual[x, 2.45e-86]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{-64} \lor \neg \left(x \leq 2.45 \cdot 10^{-86}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -1.99999999999999993e-64 or 2.44999999999999986e-86 < x Initial program 87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in t around inf 76.4%
+-commutative76.4%
Simplified76.4%
if -1.99999999999999993e-64 < x < 2.44999999999999986e-86Initial program 89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in x around 0 57.1%
Final simplification69.3%
(FPCore (x y z t) :precision binary64 (if (<= x -2.9e-33) 1.0 (if (<= x 4.1e-79) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.9e-33) {
tmp = 1.0;
} else if (x <= 4.1e-79) {
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 <= (-2.9d-33)) then
tmp = 1.0d0
else if (x <= 4.1d-79) 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 <= -2.9e-33) {
tmp = 1.0;
} else if (x <= 4.1e-79) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.9e-33: tmp = 1.0 elif x <= 4.1e-79: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.9e-33) tmp = 1.0; elseif (x <= 4.1e-79) 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 <= -2.9e-33) tmp = 1.0; elseif (x <= 4.1e-79) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.9e-33], 1.0, If[LessEqual[x, 4.1e-79], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-33}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-79}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.90000000000000003e-33 or 4.09999999999999994e-79 < x Initial program 87.6%
*-commutative87.6%
Simplified87.6%
Taylor expanded in x around inf 77.3%
if -2.90000000000000003e-33 < x < 4.09999999999999994e-79Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in x around 0 55.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 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in x around inf 51.5%
(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.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in x around inf 51.5%
add-sqr-sqrt28.7%
sqrt-unprod16.9%
sqr-neg16.9%
sqrt-unprod1.5%
add-sqr-sqrt2.8%
distribute-lft-neg-in2.8%
distribute-rgt-in2.8%
*-un-lft-identity2.8%
lft-mult-inverse2.8%
distribute-neg-in2.8%
add-sqr-sqrt1.5%
sqrt-unprod14.4%
sqr-neg14.4%
sqrt-unprod25.5%
add-sqr-sqrt45.3%
sub-neg45.3%
Applied egg-rr45.3%
Taylor expanded in x around 0 2.8%
(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 2024163
(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)))