
(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 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -5e+156)
(* y (/ (/ z (+ x 1.0)) t_1))
(if (<= t_2 4e+277)
t_2
(+ (/ x (+ x 1.0)) (/ (+ (/ y (+ x 1.0)) (/ (/ x z) (- -1.0 x))) t))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+156) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 4e+277) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0d0)
if (t_2 <= (-5d+156)) then
tmp = y * ((z / (x + 1.0d0)) / t_1)
else if (t_2 <= 4d+277) then
tmp = t_2
else
tmp = (x / (x + 1.0d0)) + (((y / (x + 1.0d0)) + ((x / z) / ((-1.0d0) - x))) / t)
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 - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+156) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 4e+277) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -5e+156: tmp = y * ((z / (x + 1.0)) / t_1) elif t_2 <= 4e+277: tmp = t_2 else: tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -5e+156) tmp = Float64(y * Float64(Float64(z / Float64(x + 1.0)) / t_1)); elseif (t_2 <= 4e+277) tmp = t_2; else tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(Float64(x / z) / Float64(-1.0 - x))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -5e+156) tmp = y * ((z / (x + 1.0)) / t_1); elseif (t_2 <= 4e+277) tmp = t_2; else tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t); 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[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+156], N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+277], t$95$2, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x / z), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+156}:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+277}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1} + \frac{\frac{x}{z}}{-1 - x}}{t}\\
\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))) < -4.99999999999999992e156Initial program 57.8%
*-commutative57.8%
Simplified57.8%
Taylor expanded in y around inf 57.1%
associate-/l*80.4%
associate-/r*95.9%
+-commutative95.9%
Simplified95.9%
if -4.99999999999999992e156 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.00000000000000001e277Initial program 99.3%
if 4.00000000000000001e277 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 27.6%
*-commutative27.6%
Simplified27.6%
Taylor expanded in t around -inf 96.8%
+-commutative96.8%
mul-1-neg96.8%
unsub-neg96.8%
+-commutative96.8%
Simplified96.8%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -5e+156)
(* y (/ (/ z (+ x 1.0)) t_1))
(if (<= t_2 4e+277) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+156) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 4e+277) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0d0)
if (t_2 <= (-5d+156)) then
tmp = y * ((z / (x + 1.0d0)) / t_1)
else if (t_2 <= 4d+277) then
tmp = t_2
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 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -5e+156) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 4e+277) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -5e+156: tmp = y * ((z / (x + 1.0)) / t_1) elif t_2 <= 4e+277: tmp = t_2 else: tmp = (x + (y / t)) / (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(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -5e+156) tmp = Float64(y * Float64(Float64(z / Float64(x + 1.0)) / t_1)); elseif (t_2 <= 4e+277) tmp = t_2; 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 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -5e+156) tmp = y * ((z / (x + 1.0)) / t_1); elseif (t_2 <= 4e+277) tmp = t_2; else tmp = (x + (y / t)) / (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[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+156], N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+277], t$95$2, N[(N[(x + N[(y / t), $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{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+156}:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+277}:\\
\;\;\;\;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))) < -4.99999999999999992e156Initial program 57.8%
*-commutative57.8%
Simplified57.8%
Taylor expanded in y around inf 57.1%
associate-/l*80.4%
associate-/r*95.9%
+-commutative95.9%
Simplified95.9%
if -4.99999999999999992e156 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 4.00000000000000001e277Initial program 99.3%
if 4.00000000000000001e277 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 27.6%
*-commutative27.6%
Simplified27.6%
Taylor expanded in z around inf 96.6%
+-commutative96.6%
+-commutative96.6%
Simplified96.6%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= z -5.5e-102)
t_1
(if (<= z 5e-293)
(/ (- (/ x (- (* z t) x)) x) (- -1.0 x))
(if (<= z 4e-132) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (z <= -5.5e-102) {
tmp = t_1;
} else if (z <= 5e-293) {
tmp = ((x / ((z * t) - x)) - x) / (-1.0 - x);
} else if (z <= 4e-132) {
tmp = (1.0 + (x - (y * (z / x)))) / (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 / t)) / (x + 1.0d0)
if (z <= (-5.5d-102)) then
tmp = t_1
else if (z <= 5d-293) then
tmp = ((x / ((z * t) - x)) - x) / ((-1.0d0) - x)
else if (z <= 4d-132) then
tmp = (1.0d0 + (x - (y * (z / x)))) / (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 / t)) / (x + 1.0);
double tmp;
if (z <= -5.5e-102) {
tmp = t_1;
} else if (z <= 5e-293) {
tmp = ((x / ((z * t) - x)) - x) / (-1.0 - x);
} else if (z <= 4e-132) {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if z <= -5.5e-102: tmp = t_1 elif z <= 5e-293: tmp = ((x / ((z * t) - x)) - x) / (-1.0 - x) elif z <= 4e-132: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (z <= -5.5e-102) tmp = t_1; elseif (z <= 5e-293) tmp = Float64(Float64(Float64(x / Float64(Float64(z * t) - x)) - x) / Float64(-1.0 - x)); elseif (z <= 4e-132) tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(z / x)))) / Float64(x + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (z <= -5.5e-102) tmp = t_1; elseif (z <= 5e-293) tmp = ((x / ((z * t) - x)) - x) / (-1.0 - x); elseif (z <= 4e-132) tmp = (1.0 + (x - (y * (z / x)))) / (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[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e-102], t$95$1, If[LessEqual[z, 5e-293], N[(N[(N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e-132], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $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}{t}}{x + 1}\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-293}:\\
\;\;\;\;\frac{\frac{x}{z \cdot t - x} - x}{-1 - x}\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-132}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4999999999999997e-102 or 3.9999999999999999e-132 < z Initial program 81.6%
*-commutative81.6%
Simplified81.6%
Taylor expanded in z around inf 85.8%
+-commutative85.8%
+-commutative85.8%
Simplified85.8%
if -5.4999999999999997e-102 < z < 5.0000000000000003e-293Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 87.1%
+-commutative87.1%
Simplified87.1%
if 5.0000000000000003e-293 < z < 3.9999999999999999e-132Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 86.6%
mul-1-neg86.6%
unsub-neg86.6%
associate-/l*86.6%
+-commutative86.6%
Simplified86.6%
Final simplification86.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.35e-87) (not (<= z 4e-132))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (* y (/ z x)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.35e-87) || !(z <= 4e-132)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (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-87)) .or. (.not. (z <= 4d-132))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (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-87) || !(z <= 4e-132)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.35e-87) or not (z <= 4e-132): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.35e-87) || !(z <= 4e-132)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y * Float64(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-87) || ~((z <= 4e-132))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y * (z / x)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.35e-87], N[Not[LessEqual[z, 4e-132]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-87} \lor \neg \left(z \leq 4 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - y \cdot \frac{z}{x}\right)}{x + 1}\\
\end{array}
\end{array}
if z < -1.34999999999999992e-87 or 3.9999999999999999e-132 < z Initial program 81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in z around inf 86.1%
+-commutative86.1%
+-commutative86.1%
Simplified86.1%
if -1.34999999999999992e-87 < z < 3.9999999999999999e-132Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 77.3%
mul-1-neg77.3%
unsub-neg77.3%
associate-/l*77.3%
+-commutative77.3%
Simplified77.3%
Final simplification83.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.9e-233) (not (<= z 2.8e-132))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.9e-233) || !(z <= 2.8e-132)) {
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 <= (-6.9d-233)) .or. (.not. (z <= 2.8d-132))) 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 <= -6.9e-233) || !(z <= 2.8e-132)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.9e-233) or not (z <= 2.8e-132): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.9e-233) || !(z <= 2.8e-132)) 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 <= -6.9e-233) || ~((z <= 2.8e-132))) 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, -6.9e-233], N[Not[LessEqual[z, 2.8e-132]], $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 -6.9 \cdot 10^{-233} \lor \neg \left(z \leq 2.8 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -6.8999999999999997e-233 or 2.80000000000000002e-132 < z Initial program 83.5%
*-commutative83.5%
Simplified83.5%
Taylor expanded in z around inf 82.5%
+-commutative82.5%
+-commutative82.5%
Simplified82.5%
if -6.8999999999999997e-233 < z < 2.80000000000000002e-132Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 71.0%
Final simplification80.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -8.5e-13) (not (<= x 3.6e-22))) (/ x (+ x 1.0)) (* y (/ z (- (* z t) x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -8.5e-13) || !(x <= 3.6e-22)) {
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 <= (-8.5d-13)) .or. (.not. (x <= 3.6d-22))) 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 <= -8.5e-13) || !(x <= 3.6e-22)) {
tmp = x / (x + 1.0);
} else {
tmp = y * (z / ((z * t) - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -8.5e-13) or not (x <= 3.6e-22): 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 <= -8.5e-13) || !(x <= 3.6e-22)) 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 <= -8.5e-13) || ~((x <= 3.6e-22))) 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, -8.5e-13], N[Not[LessEqual[x, 3.6e-22]], $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 -8.5 \cdot 10^{-13} \lor \neg \left(x \leq 3.6 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\end{array}
\end{array}
if x < -8.5000000000000001e-13 or 3.5999999999999998e-22 < x Initial program 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in t around inf 78.4%
+-commutative78.4%
Simplified78.4%
if -8.5000000000000001e-13 < x < 3.5999999999999998e-22Initial program 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in y around inf 53.1%
associate-/l*57.5%
associate-/r*57.5%
+-commutative57.5%
Simplified57.5%
Taylor expanded in x around 0 57.5%
Final simplification67.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.1e-100) (not (<= x 1.65e-191))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-100) || !(x <= 1.65e-191)) {
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.1d-100)) .or. (.not. (x <= 1.65d-191))) 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.1e-100) || !(x <= 1.65e-191)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.1e-100) or not (x <= 1.65e-191): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.1e-100) || !(x <= 1.65e-191)) 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.1e-100) || ~((x <= 1.65e-191))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.1e-100], N[Not[LessEqual[x, 1.65e-191]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-100} \lor \neg \left(x \leq 1.65 \cdot 10^{-191}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -2.10000000000000009e-100 or 1.64999999999999991e-191 < x Initial program 85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in t around inf 66.6%
+-commutative66.6%
Simplified66.6%
if -2.10000000000000009e-100 < x < 1.64999999999999991e-191Initial program 89.3%
*-commutative89.3%
Simplified89.3%
Taylor expanded in x around 0 66.4%
Final simplification66.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.2e-63) 1.0 (if (<= x 2.1e-104) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.2e-63) {
tmp = 1.0;
} else if (x <= 2.1e-104) {
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.2d-63)) then
tmp = 1.0d0
else if (x <= 2.1d-104) 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.2e-63) {
tmp = 1.0;
} else if (x <= 2.1e-104) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.2e-63: tmp = 1.0 elif x <= 2.1e-104: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.2e-63) tmp = 1.0; elseif (x <= 2.1e-104) 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.2e-63) tmp = 1.0; elseif (x <= 2.1e-104) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.2e-63], 1.0, If[LessEqual[x, 2.1e-104], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{-63}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-104}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.2e-63 or 2.09999999999999999e-104 < x Initial program 84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in x around inf 69.2%
if -2.2e-63 < x < 2.09999999999999999e-104Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in x around 0 58.0%
(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 86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in x around inf 45.7%
(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 2024144
(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)))