
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z): return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z) return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)))) end
function tmp = code(x, y, z) tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y))); end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (- x (/ 1.0 x)) (- x (/ y (fma x y (* (exp z) -1.1283791670955126))))))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x - (1.0 / x);
} else {
tmp = x - (y / fma(x, y, (exp(z) * -1.1283791670955126)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x - Float64(1.0 / x)); else tmp = Float64(x - Float64(y / fma(x, y, Float64(exp(z) * -1.1283791670955126)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(x * y + N[(N[Exp[z], $MachinePrecision] * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 96.8%
remove-double-neg96.8%
distribute-frac-neg96.8%
unsub-neg96.8%
distribute-frac-neg96.8%
distribute-neg-frac296.8%
neg-sub096.8%
associate--r-96.8%
neg-sub096.8%
+-commutative96.8%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= (exp z) 0.0)
(- x (/ 1.0 x))
(if (<= (exp z) 1.00000002)
(- x (/ y (- (+ (* z -1.1283791670955126) (* x y)) 1.1283791670955126)))
x)))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x - (1.0 / x);
} else if (exp(z) <= 1.00000002) {
tmp = x - (y / (((z * -1.1283791670955126) + (x * y)) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (exp(z) <= 0.0d0) then
tmp = x - (1.0d0 / x)
else if (exp(z) <= 1.00000002d0) then
tmp = x - (y / (((z * (-1.1283791670955126d0)) + (x * y)) - 1.1283791670955126d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (Math.exp(z) <= 0.0) {
tmp = x - (1.0 / x);
} else if (Math.exp(z) <= 1.00000002) {
tmp = x - (y / (((z * -1.1283791670955126) + (x * y)) - 1.1283791670955126));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x - (1.0 / x) elif math.exp(z) <= 1.00000002: tmp = x - (y / (((z * -1.1283791670955126) + (x * y)) - 1.1283791670955126)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (exp(z) <= 0.0) tmp = Float64(x - Float64(1.0 / x)); elseif (exp(z) <= 1.00000002) tmp = Float64(x - Float64(y / Float64(Float64(Float64(z * -1.1283791670955126) + Float64(x * y)) - 1.1283791670955126))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x - (1.0 / x); elseif (exp(z) <= 1.00000002) tmp = x - (y / (((z * -1.1283791670955126) + (x * y)) - 1.1283791670955126)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 1.00000002], N[(x - N[(y / N[(N[(N[(z * -1.1283791670955126), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{elif}\;e^{z} \leq 1.00000002:\\
\;\;\;\;x - \frac{y}{\left(z \cdot -1.1283791670955126 + x \cdot y\right) - 1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
if 0.0 < (exp.f64 z) < 1.0000000200000001Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
if 1.0000000200000001 < (exp.f64 z) Initial program 91.4%
remove-double-neg91.4%
distribute-frac-neg91.4%
unsub-neg91.4%
distribute-frac-neg91.4%
distribute-neg-frac291.4%
neg-sub091.4%
associate--r-91.4%
neg-sub091.4%
+-commutative91.4%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.2%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= z -4.6) (- x (/ 1.0 x)) (if (<= z 2.1e-12) (+ x (* 0.8862269254527579 (- y (* z y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.6) {
tmp = x - (1.0 / x);
} else if (z <= 2.1e-12) {
tmp = x + (0.8862269254527579 * (y - (z * y)));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-4.6d0)) then
tmp = x - (1.0d0 / x)
else if (z <= 2.1d-12) then
tmp = x + (0.8862269254527579d0 * (y - (z * y)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.6) {
tmp = x - (1.0 / x);
} else if (z <= 2.1e-12) {
tmp = x + (0.8862269254527579 * (y - (z * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.6: tmp = x - (1.0 / x) elif z <= 2.1e-12: tmp = x + (0.8862269254527579 * (y - (z * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.6) tmp = Float64(x - Float64(1.0 / x)); elseif (z <= 2.1e-12) tmp = Float64(x + Float64(0.8862269254527579 * Float64(y - Float64(z * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.6) tmp = x - (1.0 / x); elseif (z <= 2.1e-12) tmp = x + (0.8862269254527579 * (y - (z * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.6], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e-12], N[(x + N[(0.8862269254527579 * N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-12}:\\
\;\;\;\;x + 0.8862269254527579 \cdot \left(y - z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.5999999999999996Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
if -4.5999999999999996 < z < 2.09999999999999994e-12Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around 0 79.2%
Taylor expanded in z around 0 79.3%
+-commutative79.3%
metadata-eval79.3%
cancel-sign-sub-inv79.3%
distribute-lft-out--79.3%
*-commutative79.3%
Simplified79.3%
if 2.09999999999999994e-12 < z Initial program 91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
unsub-neg91.5%
distribute-frac-neg91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
neg-sub091.5%
+-commutative91.5%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.4%
Taylor expanded in x around inf 99.0%
Final simplification89.8%
(FPCore (x y z) :precision binary64 (if (<= z -14500.0) (- x (/ 1.0 x)) (if (<= z 2.85e-8) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -14500.0) {
tmp = x - (1.0 / x);
} else if (z <= 2.85e-8) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-14500.0d0)) then
tmp = x - (1.0d0 / x)
else if (z <= 2.85d-8) then
tmp = x + (y / (1.1283791670955126d0 - (x * y)))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -14500.0) {
tmp = x - (1.0 / x);
} else if (z <= 2.85e-8) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -14500.0: tmp = x - (1.0 / x) elif z <= 2.85e-8: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -14500.0) tmp = Float64(x - Float64(1.0 / x)); elseif (z <= 2.85e-8) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -14500.0) tmp = x - (1.0 / x); elseif (z <= 2.85e-8) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -14500.0], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.85e-8], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -14500:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{elif}\;z \leq 2.85 \cdot 10^{-8}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -14500Initial program 86.5%
remove-double-neg86.5%
distribute-frac-neg86.5%
unsub-neg86.5%
distribute-frac-neg86.5%
distribute-neg-frac286.5%
neg-sub086.2%
associate--r-86.2%
neg-sub086.8%
+-commutative86.8%
fma-define86.8%
*-commutative86.8%
distribute-rgt-neg-in86.8%
metadata-eval86.8%
Simplified86.8%
Taylor expanded in y around inf 100.0%
if -14500 < z < 2.85000000000000004e-8Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.5%
if 2.85000000000000004e-8 < z Initial program 91.4%
remove-double-neg91.4%
distribute-frac-neg91.4%
unsub-neg91.4%
distribute-frac-neg91.4%
distribute-neg-frac291.4%
neg-sub091.4%
associate--r-91.4%
neg-sub091.4%
+-commutative91.4%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.2%
Taylor expanded in x around inf 100.0%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= z -4.45e-7) (- x (/ 1.0 x)) (if (<= z 1.46e-8) (+ x (/ -1.0 (/ -1.1283791670955126 y))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.45e-7) {
tmp = x - (1.0 / x);
} else if (z <= 1.46e-8) {
tmp = x + (-1.0 / (-1.1283791670955126 / y));
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-4.45d-7)) then
tmp = x - (1.0d0 / x)
else if (z <= 1.46d-8) then
tmp = x + ((-1.0d0) / ((-1.1283791670955126d0) / y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -4.45e-7) {
tmp = x - (1.0 / x);
} else if (z <= 1.46e-8) {
tmp = x + (-1.0 / (-1.1283791670955126 / y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.45e-7: tmp = x - (1.0 / x) elif z <= 1.46e-8: tmp = x + (-1.0 / (-1.1283791670955126 / y)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.45e-7) tmp = Float64(x - Float64(1.0 / x)); elseif (z <= 1.46e-8) tmp = Float64(x + Float64(-1.0 / Float64(-1.1283791670955126 / y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.45e-7) tmp = x - (1.0 / x); elseif (z <= 1.46e-8) tmp = x + (-1.0 / (-1.1283791670955126 / y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.45e-7], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.46e-8], N[(x + N[(-1.0 / N[(-1.1283791670955126 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.45 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{elif}\;z \leq 1.46 \cdot 10^{-8}:\\
\;\;\;\;x + \frac{-1}{\frac{-1.1283791670955126}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.45e-7Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
if -4.45e-7 < z < 1.46e-8Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.5%
Taylor expanded in y around 0 78.9%
*-commutative78.9%
Simplified78.9%
metadata-eval78.9%
div-inv78.9%
clear-num79.0%
Applied egg-rr79.0%
if 1.46e-8 < z Initial program 91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
unsub-neg91.5%
distribute-frac-neg91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
neg-sub091.5%
+-commutative91.5%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.4%
Taylor expanded in x around inf 99.0%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= z -550.0) (/ -1.0 x) (if (<= z 2e-12) (- x (* y -0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -550.0) {
tmp = -1.0 / x;
} else if (z <= 2e-12) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-550.0d0)) then
tmp = (-1.0d0) / x
else if (z <= 2d-12) then
tmp = x - (y * (-0.8862269254527579d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -550.0) {
tmp = -1.0 / x;
} else if (z <= 2e-12) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -550.0: tmp = -1.0 / x elif z <= 2e-12: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -550.0) tmp = Float64(-1.0 / x); elseif (z <= 2e-12) tmp = Float64(x - Float64(y * -0.8862269254527579)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -550.0) tmp = -1.0 / x; elseif (z <= 2e-12) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -550.0], N[(-1.0 / x), $MachinePrecision], If[LessEqual[z, 2e-12], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -550:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-12}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -550Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 59.4%
if -550 < z < 1.99999999999999996e-12Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.5%
Taylor expanded in y around 0 78.9%
*-commutative78.9%
Simplified78.9%
if 1.99999999999999996e-12 < z Initial program 91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
unsub-neg91.5%
distribute-frac-neg91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
neg-sub091.5%
+-commutative91.5%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.4%
Taylor expanded in x around inf 99.0%
Final simplification79.7%
(FPCore (x y z) :precision binary64 (if (<= z -1.9e-7) (- x (/ 1.0 x)) (if (<= z 1.85e-8) (- x (* y -0.8862269254527579)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e-7) {
tmp = x - (1.0 / x);
} else if (z <= 1.85e-8) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.9d-7)) then
tmp = x - (1.0d0 / x)
else if (z <= 1.85d-8) then
tmp = x - (y * (-0.8862269254527579d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.9e-7) {
tmp = x - (1.0 / x);
} else if (z <= 1.85e-8) {
tmp = x - (y * -0.8862269254527579);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.9e-7: tmp = x - (1.0 / x) elif z <= 1.85e-8: tmp = x - (y * -0.8862269254527579) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.9e-7) tmp = Float64(x - Float64(1.0 / x)); elseif (z <= 1.85e-8) tmp = Float64(x - Float64(y * -0.8862269254527579)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.9e-7) tmp = x - (1.0 / x); elseif (z <= 1.85e-8) tmp = x - (y * -0.8862269254527579); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.9e-7], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.85e-8], N[(x - N[(y * -0.8862269254527579), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{-8}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.90000000000000007e-7Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
if -1.90000000000000007e-7 < z < 1.85e-8Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.5%
Taylor expanded in y around 0 78.9%
*-commutative78.9%
Simplified78.9%
if 1.85e-8 < z Initial program 91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
unsub-neg91.5%
distribute-frac-neg91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
neg-sub091.5%
+-commutative91.5%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.4%
Taylor expanded in x around inf 99.0%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= z -2.7e-7) (- x (/ 1.0 x)) (if (<= z 6.7e-9) (- x (/ y -1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.7e-7) {
tmp = x - (1.0 / x);
} else if (z <= 6.7e-9) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-2.7d-7)) then
tmp = x - (1.0d0 / x)
else if (z <= 6.7d-9) then
tmp = x - (y / (-1.1283791670955126d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.7e-7) {
tmp = x - (1.0 / x);
} else if (z <= 6.7e-9) {
tmp = x - (y / -1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.7e-7: tmp = x - (1.0 / x) elif z <= 6.7e-9: tmp = x - (y / -1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.7e-7) tmp = Float64(x - Float64(1.0 / x)); elseif (z <= 6.7e-9) tmp = Float64(x - Float64(y / -1.1283791670955126)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.7e-7) tmp = x - (1.0 / x); elseif (z <= 6.7e-9) tmp = x - (y / -1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.7e-7], N[(x - N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.7e-9], N[(x - N[(y / -1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{-7}:\\
\;\;\;\;x - \frac{1}{x}\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{-9}:\\
\;\;\;\;x - \frac{y}{-1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.70000000000000009e-7Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
if -2.70000000000000009e-7 < z < 6.69999999999999961e-9Initial program 99.8%
remove-double-neg99.8%
distribute-frac-neg99.8%
unsub-neg99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
neg-sub099.8%
associate--r-99.8%
neg-sub099.8%
+-commutative99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.5%
Taylor expanded in x around 0 78.9%
if 6.69999999999999961e-9 < z Initial program 91.5%
remove-double-neg91.5%
distribute-frac-neg91.5%
unsub-neg91.5%
distribute-frac-neg91.5%
distribute-neg-frac291.5%
neg-sub091.5%
associate--r-91.5%
neg-sub091.5%
+-commutative91.5%
fma-define100.0%
*-commutative100.0%
distribute-rgt-neg-in100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around 0 84.4%
Taylor expanded in x around inf 99.0%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= z -500.0) (/ -1.0 x) x))
double code(double x, double y, double z) {
double tmp;
if (z <= -500.0) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-500.0d0)) then
tmp = (-1.0d0) / x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -500.0) {
tmp = -1.0 / x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -500.0: tmp = -1.0 / x else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -500.0) tmp = Float64(-1.0 / x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -500.0) tmp = -1.0 / x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -500.0], N[(-1.0 / x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -500:\\
\;\;\;\;\frac{-1}{x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -500Initial program 86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
unsub-neg86.7%
distribute-frac-neg86.7%
distribute-neg-frac286.7%
neg-sub086.4%
associate--r-86.4%
neg-sub087.0%
+-commutative87.0%
fma-define87.0%
*-commutative87.0%
distribute-rgt-neg-in87.0%
metadata-eval87.0%
Simplified87.0%
Taylor expanded in y around inf 100.0%
Taylor expanded in x around 0 59.4%
if -500 < z Initial program 96.8%
remove-double-neg96.8%
distribute-frac-neg96.8%
unsub-neg96.8%
distribute-frac-neg96.8%
distribute-neg-frac296.8%
neg-sub096.8%
associate--r-96.8%
neg-sub096.8%
+-commutative96.8%
fma-define99.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 94.2%
Taylor expanded in x around inf 73.6%
Final simplification70.1%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.3%
remove-double-neg94.3%
distribute-frac-neg94.3%
unsub-neg94.3%
distribute-frac-neg94.3%
distribute-neg-frac294.3%
neg-sub094.2%
associate--r-94.2%
neg-sub094.4%
+-commutative94.4%
fma-define96.7%
*-commutative96.7%
distribute-rgt-neg-in96.7%
metadata-eval96.7%
Simplified96.7%
Taylor expanded in z around 0 81.9%
Taylor expanded in x around inf 65.5%
Final simplification65.5%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x))))
double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (1.0d0 / (((1.1283791670955126d0 / y) * exp(z)) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / (((1.1283791670955126 / y) * Math.exp(z)) - x));
}
def code(x, y, z): return x + (1.0 / (((1.1283791670955126 / y) * math.exp(z)) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(Float64(1.1283791670955126 / y) * exp(z)) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(N[(1.1283791670955126 / y), $MachinePrecision] * N[Exp[z], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}
\end{array}
herbie shell --seed 2024071
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:alt
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))