
(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 (if (or (<= z -4.8e+173) (not (<= z 1.15e+177))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (/ (- (* z y) x) (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+173) || !(z <= 1.15e+177)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((z * y) - 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 <= (-4.8d+173)) .or. (.not. (z <= 1.15d+177))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (((z * y) - 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 <= -4.8e+173) || !(z <= 1.15e+177)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+173) or not (z <= 1.15e+177): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+173) || !(z <= 1.15e+177)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - 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 <= -4.8e+173) || ~((z <= 1.15e+177))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (((z * y) - x) / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+173], N[Not[LessEqual[z, 1.15e+177]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / 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 -4.8 \cdot 10^{+173} \lor \neg \left(z \leq 1.15 \cdot 10^{+177}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -4.7999999999999998e173 or 1.15e177 < z Initial program 57.0%
*-commutative57.0%
Simplified57.0%
Taylor expanded in z around inf 96.5%
if -4.7999999999999998e173 < z < 1.15e177Initial program 96.5%
Final simplification96.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -5.5e-8)
1.0
(if (<= x -5.2e-93)
(/ 1.0 (/ 1.0 x))
(if (<= x -6.8e-110) 1.0 (if (<= x 9e-63) (/ y t) 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5.5e-8) {
tmp = 1.0;
} else if (x <= -5.2e-93) {
tmp = 1.0 / (1.0 / x);
} else if (x <= -6.8e-110) {
tmp = 1.0;
} else if (x <= 9e-63) {
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 <= (-5.5d-8)) then
tmp = 1.0d0
else if (x <= (-5.2d-93)) then
tmp = 1.0d0 / (1.0d0 / x)
else if (x <= (-6.8d-110)) then
tmp = 1.0d0
else if (x <= 9d-63) 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 <= -5.5e-8) {
tmp = 1.0;
} else if (x <= -5.2e-93) {
tmp = 1.0 / (1.0 / x);
} else if (x <= -6.8e-110) {
tmp = 1.0;
} else if (x <= 9e-63) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5.5e-8: tmp = 1.0 elif x <= -5.2e-93: tmp = 1.0 / (1.0 / x) elif x <= -6.8e-110: tmp = 1.0 elif x <= 9e-63: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5.5e-8) tmp = 1.0; elseif (x <= -5.2e-93) tmp = Float64(1.0 / Float64(1.0 / x)); elseif (x <= -6.8e-110) tmp = 1.0; elseif (x <= 9e-63) 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 <= -5.5e-8) tmp = 1.0; elseif (x <= -5.2e-93) tmp = 1.0 / (1.0 / x); elseif (x <= -6.8e-110) tmp = 1.0; elseif (x <= 9e-63) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5.5e-8], 1.0, If[LessEqual[x, -5.2e-93], N[(1.0 / N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.8e-110], 1.0, If[LessEqual[x, 9e-63], N[(y / t), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-8}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-93}:\\
\;\;\;\;\frac{1}{\frac{1}{x}}\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-110}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.5000000000000003e-8 or -5.1999999999999997e-93 < x < -6.8000000000000002e-110 or 8.9999999999999999e-63 < x Initial program 89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in z around inf 67.0%
+-commutative67.0%
div-inv67.0%
fma-define67.0%
Applied egg-rr67.0%
Taylor expanded in x around inf 83.0%
if -5.5000000000000003e-8 < x < -5.1999999999999997e-93Initial program 99.8%
*-commutative99.8%
Simplified99.8%
clear-num99.6%
inv-pow99.6%
fma-neg99.6%
Applied egg-rr99.6%
unpow-199.6%
fma-neg99.6%
*-commutative99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 51.0%
Taylor expanded in x around 0 47.0%
if -6.8000000000000002e-110 < x < 8.9999999999999999e-63Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 75.8%
+-commutative75.8%
div-inv75.6%
fma-define75.7%
Applied egg-rr75.7%
Taylor expanded in x around 0 61.3%
Final simplification71.0%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.5e-110)
(/ (- x (/ x (- (* z t) x))) (+ x 1.0))
(if (<= x 6.8e-41)
(/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))
(- 1.0 (* (/ y (+ x 1.0)) (/ z x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.5e-110) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if (x <= 6.8e-41) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (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 (x <= (-3.5d-110)) then
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
else if (x <= 6.8d-41) then
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y / (x + 1.0d0)) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.5e-110) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if (x <= 6.8e-41) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.5e-110: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) elif x <= 6.8e-41: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) else: tmp = 1.0 - ((y / (x + 1.0)) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.5e-110) tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); elseif (x <= 6.8e-41) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / Float64(x + 1.0)) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.5e-110) tmp = (x - (x / ((z * t) - x))) / (x + 1.0); elseif (x <= 6.8e-41) tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); else tmp = 1.0 - ((y / (x + 1.0)) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.5e-110], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.8e-41], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-110}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-41}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x + 1} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if x < -3.49999999999999974e-110Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in y around 0 83.0%
+-commutative83.0%
Simplified83.0%
if -3.49999999999999974e-110 < x < 6.7999999999999997e-41Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 83.1%
Taylor expanded in x around 0 83.1%
sub-neg83.1%
distribute-lft-in83.1%
*-rgt-identity83.1%
distribute-rgt-neg-out83.1%
associate-*r/83.1%
*-rgt-identity83.1%
associate-+r+83.1%
+-commutative83.1%
unsub-neg83.1%
*-lft-identity83.1%
times-frac83.2%
associate-*l/83.1%
*-lft-identity83.1%
div-sub83.2%
Simplified83.2%
if 6.7999999999999997e-41 < x Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in t around 0 86.9%
associate-+r+86.9%
mul-1-neg86.9%
unsub-neg86.9%
+-commutative86.9%
associate-/l*91.9%
+-commutative91.9%
Simplified91.9%
div-sub91.9%
pow191.9%
pow191.9%
pow-div91.9%
metadata-eval91.9%
metadata-eval91.9%
associate-/r/91.8%
Applied egg-rr91.8%
Taylor expanded in y around 0 86.8%
+-commutative86.8%
*-commutative86.8%
times-frac91.8%
Simplified91.8%
Final simplification85.1%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.4e-112)
(/ (- x (/ x (- (* z t) x))) (+ x 1.0))
(if (<= x 1.65e-41)
(/ (+ x (/ (- y (/ x z)) t)) (+ x 1.0))
(/ (- (+ x 1.0) (/ y (/ x z))) (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.4e-112) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if (x <= 1.65e-41) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-3.4d-112)) then
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
else if (x <= 1.65d-41) then
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0d0)
else
tmp = ((x + 1.0d0) - (y / (x / z))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.4e-112) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if (x <= 1.65e-41) {
tmp = (x + ((y - (x / z)) / t)) / (x + 1.0);
} else {
tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.4e-112: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) elif x <= 1.65e-41: tmp = (x + ((y - (x / z)) / t)) / (x + 1.0) else: tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.4e-112) tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); elseif (x <= 1.65e-41) tmp = Float64(Float64(x + Float64(Float64(y - Float64(x / z)) / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x + 1.0) - Float64(y / Float64(x / z))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.4e-112) tmp = (x - (x / ((z * t) - x))) / (x + 1.0); elseif (x <= 1.65e-41) tmp = (x + ((y - (x / z)) / t)) / (x + 1.0); else tmp = ((x + 1.0) - (y / (x / z))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.4e-112], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.65e-41], N[(N[(x + N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x + 1.0), $MachinePrecision] - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{-112}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-41}:\\
\;\;\;\;\frac{x + \frac{y - \frac{x}{z}}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x + 1\right) - \frac{y}{\frac{x}{z}}}{x + 1}\\
\end{array}
\end{array}
if x < -3.3999999999999998e-112Initial program 88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in y around 0 83.0%
+-commutative83.0%
Simplified83.0%
if -3.3999999999999998e-112 < x < 1.65000000000000012e-41Initial program 85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in t around inf 83.1%
Taylor expanded in x around 0 83.1%
sub-neg83.1%
distribute-lft-in83.1%
*-rgt-identity83.1%
distribute-rgt-neg-out83.1%
associate-*r/83.1%
*-rgt-identity83.1%
associate-+r+83.1%
+-commutative83.1%
unsub-neg83.1%
*-lft-identity83.1%
times-frac83.2%
associate-*l/83.1%
*-lft-identity83.1%
div-sub83.2%
Simplified83.2%
if 1.65000000000000012e-41 < x Initial program 91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in t around 0 86.9%
associate-+r+86.9%
mul-1-neg86.9%
unsub-neg86.9%
+-commutative86.9%
associate-/l*91.9%
+-commutative91.9%
Simplified91.9%
Final simplification85.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.4e-106) (not (<= t 4e-89))) (/ (+ x (/ y t)) (+ x 1.0)) (- 1.0 (* (/ y (+ x 1.0)) (/ z x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.4e-106) || !(t <= 4e-89)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (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 ((t <= (-3.4d-106)) .or. (.not. (t <= 4d-89))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 - ((y / (x + 1.0d0)) * (z / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.4e-106) || !(t <= 4e-89)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 - ((y / (x + 1.0)) * (z / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.4e-106) or not (t <= 4e-89): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 - ((y / (x + 1.0)) * (z / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.4e-106) || !(t <= 4e-89)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 - Float64(Float64(y / Float64(x + 1.0)) * Float64(z / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.4e-106) || ~((t <= 4e-89))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 - ((y / (x + 1.0)) * (z / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.4e-106], N[Not[LessEqual[t, 4e-89]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-106} \lor \neg \left(t \leq 4 \cdot 10^{-89}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{y}{x + 1} \cdot \frac{z}{x}\\
\end{array}
\end{array}
if t < -3.39999999999999982e-106 or 4.00000000000000015e-89 < t Initial program 84.0%
*-commutative84.0%
Simplified84.0%
Taylor expanded in z around inf 88.0%
if -3.39999999999999982e-106 < t < 4.00000000000000015e-89Initial program 93.9%
*-commutative93.9%
Simplified93.9%
Taylor expanded in t around 0 73.6%
associate-+r+73.6%
mul-1-neg73.6%
unsub-neg73.6%
+-commutative73.6%
associate-/l*77.5%
+-commutative77.5%
Simplified77.5%
div-sub77.5%
pow177.5%
pow177.5%
pow-div77.5%
metadata-eval77.5%
metadata-eval77.5%
associate-/r/75.5%
Applied egg-rr75.5%
Taylor expanded in y around 0 73.5%
+-commutative73.5%
*-commutative73.5%
times-frac78.5%
Simplified78.5%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.05e+71) 1.0 (if (<= x 1.4e-62) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.05e+71) {
tmp = 1.0;
} else if (x <= 1.4e-62) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-2.05d+71)) then
tmp = 1.0d0
else if (x <= 1.4d-62) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.05e+71) {
tmp = 1.0;
} else if (x <= 1.4e-62) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.05e+71: tmp = 1.0 elif x <= 1.4e-62: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.05e+71) tmp = 1.0; elseif (x <= 1.4e-62) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.05e+71) tmp = 1.0; elseif (x <= 1.4e-62) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.05e+71], 1.0, If[LessEqual[x, 1.4e-62], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.05 \cdot 10^{+71}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.4 \cdot 10^{-62}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.0500000000000001e71 or 1.40000000000000001e-62 < x Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in z around inf 68.7%
+-commutative68.7%
div-inv68.7%
fma-define68.7%
Applied egg-rr68.7%
Taylor expanded in x around inf 86.6%
if -2.0500000000000001e71 < x < 1.40000000000000001e-62Initial program 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in z around inf 72.9%
Final simplification78.6%
(FPCore (x y z t) :precision binary64 (if (<= x -4.8e-111) 1.0 (if (<= x 8.9e-63) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e-111) {
tmp = 1.0;
} else if (x <= 8.9e-63) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-4.8d-111)) then
tmp = 1.0d0
else if (x <= 8.9d-63) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.8e-111) {
tmp = 1.0;
} else if (x <= 8.9e-63) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.8e-111: tmp = 1.0 elif x <= 8.9e-63: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.8e-111) tmp = 1.0; elseif (x <= 8.9e-63) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.8e-111) tmp = 1.0; elseif (x <= 8.9e-63) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.8e-111], 1.0, If[LessEqual[x, 8.9e-63], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-111}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.9 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.8000000000000001e-111 or 8.89999999999999988e-63 < x Initial program 90.3%
*-commutative90.3%
Simplified90.3%
Taylor expanded in z around inf 67.3%
+-commutative67.3%
div-inv67.3%
fma-define67.3%
Applied egg-rr67.3%
Taylor expanded in x around inf 75.9%
if -4.8000000000000001e-111 < x < 8.89999999999999988e-63Initial program 84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 75.8%
+-commutative75.8%
div-inv75.6%
fma-define75.7%
Applied egg-rr75.7%
Taylor expanded in x around 0 61.3%
Final simplification69.4%
(FPCore (x y z t) :precision binary64 (if (<= x -1.8e-59) (/ x (+ x 1.0)) (if (<= x 1.02e-62) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.8e-59) {
tmp = x / (x + 1.0);
} else if (x <= 1.02e-62) {
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.8d-59)) then
tmp = x / (x + 1.0d0)
else if (x <= 1.02d-62) 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.8e-59) {
tmp = x / (x + 1.0);
} else if (x <= 1.02e-62) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.8e-59: tmp = x / (x + 1.0) elif x <= 1.02e-62: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.8e-59) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1.02e-62) 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.8e-59) tmp = x / (x + 1.0); elseif (x <= 1.02e-62) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.8e-59], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.02e-62], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-59}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-62}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.8e-59Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in t around inf 81.9%
+-commutative81.9%
Simplified81.9%
if -1.8e-59 < x < 1.02000000000000005e-62Initial program 85.8%
*-commutative85.8%
Simplified85.8%
Taylor expanded in z around inf 73.0%
+-commutative73.0%
div-inv72.9%
fma-define72.9%
Applied egg-rr72.9%
Taylor expanded in x around 0 58.2%
if 1.02000000000000005e-62 < x Initial program 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in z around inf 66.5%
+-commutative66.5%
div-inv66.5%
fma-define66.5%
Applied egg-rr66.5%
Taylor expanded in x around inf 82.9%
Final simplification70.6%
(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 87.7%
*-commutative87.7%
Simplified87.7%
clear-num87.7%
inv-pow87.7%
fma-neg87.7%
Applied egg-rr87.7%
unpow-187.7%
fma-neg87.7%
*-commutative87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in x around inf 49.1%
frac-2neg49.1%
metadata-eval49.1%
div-inv49.1%
div-inv49.0%
+-commutative49.0%
distribute-lft-neg-in49.0%
+-commutative49.0%
add-sqr-sqrt23.7%
sqrt-unprod13.1%
sqr-neg13.1%
sqrt-unprod1.3%
add-sqr-sqrt2.8%
div-inv2.8%
frac-2neg2.8%
+-commutative2.8%
clear-num2.8%
Applied egg-rr2.8%
associate-*r/2.8%
mul-1-neg2.8%
+-commutative2.8%
Simplified2.8%
Taylor expanded in x around inf 2.8%
Final simplification2.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 87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in z around inf 71.1%
+-commutative71.1%
div-inv71.1%
fma-define71.1%
Applied egg-rr71.1%
Taylor expanded in x around inf 46.1%
Final simplification46.1%
(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 2024034
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))