
(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 9 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))
(if (<= (exp z) 1.05)
(+ x (/ y (- (+ 1.1283791670955126 (* z 1.1283791670955126)) (* x y))))
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.05) {
tmp = x + (y / ((1.1283791670955126 + (z * 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 (exp(z) <= 0.0d0) then
tmp = x + ((-1.0d0) / x)
else if (exp(z) <= 1.05d0) then
tmp = x + (y / ((1.1283791670955126d0 + (z * 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 (Math.exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else if (Math.exp(z) <= 1.05) {
tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y)));
} 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.05: tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y))) 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.05) tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 + Float64(z * 1.1283791670955126)) - Float64(x * y)))); 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.05) tmp = x + (y / ((1.1283791670955126 + (z * 1.1283791670955126)) - (x * y))); 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.05], N[(x + N[(y / N[(N[(1.1283791670955126 + N[(z * 1.1283791670955126), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $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.05:\\
\;\;\;\;x + \frac{y}{\left(1.1283791670955126 + z \cdot 1.1283791670955126\right) - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 88.2%
*-lft-identity88.2%
metadata-eval88.2%
times-frac88.2%
neg-mul-188.2%
sub0-neg88.2%
associate-+l-88.2%
neg-sub088.6%
+-commutative88.6%
sub-neg88.6%
associate-/l*88.7%
div-sub88.5%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) < 1.05000000000000004Initial program 99.9%
Taylor expanded in z around 0 100.0%
if 1.05000000000000004 < (exp.f64 z) Initial program 96.9%
*-lft-identity96.9%
metadata-eval96.9%
times-frac96.9%
neg-mul-196.9%
sub0-neg96.9%
associate-+l-96.9%
neg-sub096.9%
+-commutative96.9%
sub-neg96.9%
associate-/l*96.9%
div-sub96.9%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 41.6%
Taylor expanded in x around inf 100.0%
Final simplification100.0%
(FPCore (x y z) :precision binary64 (if (<= (exp z) 0.0) (+ x (/ -1.0 x)) (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y))))))
double code(double x, double y, double z) {
double tmp;
if (exp(z) <= 0.0) {
tmp = x + (-1.0 / x);
} else {
tmp = x + (y / ((exp(z) * 1.1283791670955126) - (x * y)));
}
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
tmp = x + (y / ((exp(z) * 1.1283791670955126d0) - (x * y)))
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 {
tmp = x + (y / ((Math.exp(z) * 1.1283791670955126) - (x * y)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if math.exp(z) <= 0.0: tmp = x + (-1.0 / x) else: tmp = x + (y / ((math.exp(z) * 1.1283791670955126) - (x * y))) 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 / Float64(Float64(exp(z) * 1.1283791670955126) - Float64(x * y)))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (exp(z) <= 0.0) tmp = x + (-1.0 / x); else tmp = x + (y / ((exp(z) * 1.1283791670955126) - (x * y))); 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], N[(x + N[(y / N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(x * y), $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}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\
\end{array}
\end{array}
if (exp.f64 z) < 0.0Initial program 88.2%
*-lft-identity88.2%
metadata-eval88.2%
times-frac88.2%
neg-mul-188.2%
sub0-neg88.2%
associate-+l-88.2%
neg-sub088.6%
+-commutative88.6%
sub-neg88.6%
associate-/l*88.7%
div-sub88.5%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 98.9%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (+ x (/ -1.0 (fma (exp z) (/ -1.1283791670955126 y) x))))
double code(double x, double y, double z) {
return x + (-1.0 / fma(exp(z), (-1.1283791670955126 / y), x));
}
function code(x, y, z) return Float64(x + Float64(-1.0 / fma(exp(z), Float64(-1.1283791670955126 / y), x))) end
code[x_, y_, z_] := N[(x + N[(-1.0 / N[(N[Exp[z], $MachinePrecision] * N[(-1.1283791670955126 / y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-1}{\mathsf{fma}\left(e^{z}, \frac{-1.1283791670955126}{y}, x\right)}
\end{array}
Initial program 96.1%
*-lft-identity96.1%
metadata-eval96.1%
times-frac96.1%
neg-mul-196.1%
sub0-neg96.1%
associate-+l-96.1%
neg-sub096.2%
+-commutative96.2%
sub-neg96.2%
associate-/l*96.2%
div-sub96.2%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/99.9%
cancel-sign-sub-inv99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))) (t_1 (+ x (/ y 1.1283791670955126))))
(if (<= z -5e-135)
t_0
(if (<= z -1.6e-297)
t_1
(if (<= z 3.6e-299)
t_0
(if (<= z 1.02e-191)
t_1
(if (<= z 2.05e-22) (+ x (/ y (* x (- y)))) x)))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / 1.1283791670955126);
double tmp;
if (z <= -5e-135) {
tmp = t_0;
} else if (z <= -1.6e-297) {
tmp = t_1;
} else if (z <= 3.6e-299) {
tmp = t_0;
} else if (z <= 1.02e-191) {
tmp = t_1;
} else if (z <= 2.05e-22) {
tmp = x + (y / (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
t_1 = x + (y / 1.1283791670955126d0)
if (z <= (-5d-135)) then
tmp = t_0
else if (z <= (-1.6d-297)) then
tmp = t_1
else if (z <= 3.6d-299) then
tmp = t_0
else if (z <= 1.02d-191) then
tmp = t_1
else if (z <= 2.05d-22) then
tmp = x + (y / (x * -y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / 1.1283791670955126);
double tmp;
if (z <= -5e-135) {
tmp = t_0;
} else if (z <= -1.6e-297) {
tmp = t_1;
} else if (z <= 3.6e-299) {
tmp = t_0;
} else if (z <= 1.02e-191) {
tmp = t_1;
} else if (z <= 2.05e-22) {
tmp = x + (y / (x * -y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) t_1 = x + (y / 1.1283791670955126) tmp = 0 if z <= -5e-135: tmp = t_0 elif z <= -1.6e-297: tmp = t_1 elif z <= 3.6e-299: tmp = t_0 elif z <= 1.02e-191: tmp = t_1 elif z <= 2.05e-22: tmp = x + (y / (x * -y)) else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) t_1 = Float64(x + Float64(y / 1.1283791670955126)) tmp = 0.0 if (z <= -5e-135) tmp = t_0; elseif (z <= -1.6e-297) tmp = t_1; elseif (z <= 3.6e-299) tmp = t_0; elseif (z <= 1.02e-191) tmp = t_1; elseif (z <= 2.05e-22) tmp = Float64(x + Float64(y / Float64(x * Float64(-y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); t_1 = x + (y / 1.1283791670955126); tmp = 0.0; if (z <= -5e-135) tmp = t_0; elseif (z <= -1.6e-297) tmp = t_1; elseif (z <= 3.6e-299) tmp = t_0; elseif (z <= 1.02e-191) tmp = t_1; elseif (z <= 2.05e-22) tmp = x + (y / (x * -y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e-135], t$95$0, If[LessEqual[z, -1.6e-297], t$95$1, If[LessEqual[z, 3.6e-299], t$95$0, If[LessEqual[z, 1.02e-191], t$95$1, If[LessEqual[z, 2.05e-22], N[(x + N[(y / N[(x * (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
t_1 := x + \frac{y}{1.1283791670955126}\\
\mathbf{if}\;z \leq -5 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-299}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-191}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{y}{x \cdot \left(-y\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -5.0000000000000002e-135 or -1.59999999999999986e-297 < z < 3.6e-299Initial program 92.9%
*-lft-identity92.9%
metadata-eval92.9%
times-frac92.9%
neg-mul-192.9%
sub0-neg92.9%
associate-+l-92.9%
neg-sub093.2%
+-commutative93.2%
sub-neg93.2%
associate-/l*93.2%
div-sub93.0%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 92.1%
if -5.0000000000000002e-135 < z < -1.59999999999999986e-297 or 3.6e-299 < z < 1.02e-191Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 78.8%
Taylor expanded in z around 0 78.8%
if 1.02e-191 < z < 2.05e-22Initial program 99.9%
Taylor expanded in x around inf 73.2%
mul-1-neg73.2%
distribute-rgt-neg-out73.2%
Simplified73.2%
if 2.05e-22 < z Initial program 97.1%
*-lft-identity97.1%
metadata-eval97.1%
times-frac97.1%
neg-mul-197.1%
sub0-neg97.1%
associate-+l-97.1%
neg-sub097.1%
+-commutative97.1%
sub-neg97.1%
associate-/l*97.0%
div-sub97.0%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified100.0%
Taylor expanded in x around inf 41.5%
Taylor expanded in x around inf 95.8%
Final simplification88.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))))
(if (<= z -4.8e-135)
t_0
(if (<= z -3.05e-297)
(+ x (/ y 1.1283791670955126))
(if (<= z 1.8e-297)
t_0
(if (<= z 1.1e-191)
(+ x (/ y (+ 1.1283791670955126 (* z 1.1283791670955126))))
(if (<= z 1.8e-21) (+ x (/ y (* x (- y)))) x)))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -4.8e-135) {
tmp = t_0;
} else if (z <= -3.05e-297) {
tmp = x + (y / 1.1283791670955126);
} else if (z <= 1.8e-297) {
tmp = t_0;
} else if (z <= 1.1e-191) {
tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126)));
} else if (z <= 1.8e-21) {
tmp = x + (y / (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) :: t_0
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
if (z <= (-4.8d-135)) then
tmp = t_0
else if (z <= (-3.05d-297)) then
tmp = x + (y / 1.1283791670955126d0)
else if (z <= 1.8d-297) then
tmp = t_0
else if (z <= 1.1d-191) then
tmp = x + (y / (1.1283791670955126d0 + (z * 1.1283791670955126d0)))
else if (z <= 1.8d-21) then
tmp = x + (y / (x * -y))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double tmp;
if (z <= -4.8e-135) {
tmp = t_0;
} else if (z <= -3.05e-297) {
tmp = x + (y / 1.1283791670955126);
} else if (z <= 1.8e-297) {
tmp = t_0;
} else if (z <= 1.1e-191) {
tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126)));
} else if (z <= 1.8e-21) {
tmp = x + (y / (x * -y));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) tmp = 0 if z <= -4.8e-135: tmp = t_0 elif z <= -3.05e-297: tmp = x + (y / 1.1283791670955126) elif z <= 1.8e-297: tmp = t_0 elif z <= 1.1e-191: tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126))) elif z <= 1.8e-21: tmp = x + (y / (x * -y)) else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) tmp = 0.0 if (z <= -4.8e-135) tmp = t_0; elseif (z <= -3.05e-297) tmp = Float64(x + Float64(y / 1.1283791670955126)); elseif (z <= 1.8e-297) tmp = t_0; elseif (z <= 1.1e-191) tmp = Float64(x + Float64(y / Float64(1.1283791670955126 + Float64(z * 1.1283791670955126)))); elseif (z <= 1.8e-21) tmp = Float64(x + Float64(y / Float64(x * Float64(-y)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); tmp = 0.0; if (z <= -4.8e-135) tmp = t_0; elseif (z <= -3.05e-297) tmp = x + (y / 1.1283791670955126); elseif (z <= 1.8e-297) tmp = t_0; elseif (z <= 1.1e-191) tmp = x + (y / (1.1283791670955126 + (z * 1.1283791670955126))); elseif (z <= 1.8e-21) tmp = x + (y / (x * -y)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.8e-135], t$95$0, If[LessEqual[z, -3.05e-297], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-297], t$95$0, If[LessEqual[z, 1.1e-191], N[(x + N[(y / N[(1.1283791670955126 + N[(z * 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e-21], N[(x + N[(y / N[(x * (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
\mathbf{if}\;z \leq -4.8 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.05 \cdot 10^{-297}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-297}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-191}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 + z \cdot 1.1283791670955126}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-21}:\\
\;\;\;\;x + \frac{y}{x \cdot \left(-y\right)}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.7999999999999997e-135 or -3.05e-297 < z < 1.79999999999999997e-297Initial program 92.9%
*-lft-identity92.9%
metadata-eval92.9%
times-frac92.9%
neg-mul-192.9%
sub0-neg92.9%
associate-+l-92.9%
neg-sub093.2%
+-commutative93.2%
sub-neg93.2%
associate-/l*93.2%
div-sub93.0%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 92.1%
if -4.7999999999999997e-135 < z < -3.05e-297Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 70.8%
Taylor expanded in z around 0 70.8%
if 1.79999999999999997e-297 < z < 1.09999999999999999e-191Initial program 100.0%
Taylor expanded in z around 0 100.0%
Taylor expanded in y around 0 88.2%
if 1.09999999999999999e-191 < z < 1.79999999999999995e-21Initial program 99.9%
Taylor expanded in x around inf 73.2%
mul-1-neg73.2%
distribute-rgt-neg-out73.2%
Simplified73.2%
if 1.79999999999999995e-21 < z Initial program 97.1%
*-lft-identity97.1%
metadata-eval97.1%
times-frac97.1%
neg-mul-197.1%
sub0-neg97.1%
associate-+l-97.1%
neg-sub097.1%
+-commutative97.1%
sub-neg97.1%
associate-/l*97.0%
div-sub97.0%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified100.0%
Taylor expanded in x around inf 41.5%
Taylor expanded in x around inf 95.8%
Final simplification88.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ -1.0 x))) (t_1 (+ x (/ y 1.1283791670955126))))
(if (<= z -2.5e-135)
t_0
(if (<= z -1.15e-297)
t_1
(if (<= z 4e-299)
t_0
(if (<= z 6.7e-192) t_1 (if (<= z 7e-22) t_0 x)))))))
double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / 1.1283791670955126);
double tmp;
if (z <= -2.5e-135) {
tmp = t_0;
} else if (z <= -1.15e-297) {
tmp = t_1;
} else if (z <= 4e-299) {
tmp = t_0;
} else if (z <= 6.7e-192) {
tmp = t_1;
} else if (z <= 7e-22) {
tmp = t_0;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x + ((-1.0d0) / x)
t_1 = x + (y / 1.1283791670955126d0)
if (z <= (-2.5d-135)) then
tmp = t_0
else if (z <= (-1.15d-297)) then
tmp = t_1
else if (z <= 4d-299) then
tmp = t_0
else if (z <= 6.7d-192) then
tmp = t_1
else if (z <= 7d-22) then
tmp = t_0
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (-1.0 / x);
double t_1 = x + (y / 1.1283791670955126);
double tmp;
if (z <= -2.5e-135) {
tmp = t_0;
} else if (z <= -1.15e-297) {
tmp = t_1;
} else if (z <= 4e-299) {
tmp = t_0;
} else if (z <= 6.7e-192) {
tmp = t_1;
} else if (z <= 7e-22) {
tmp = t_0;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): t_0 = x + (-1.0 / x) t_1 = x + (y / 1.1283791670955126) tmp = 0 if z <= -2.5e-135: tmp = t_0 elif z <= -1.15e-297: tmp = t_1 elif z <= 4e-299: tmp = t_0 elif z <= 6.7e-192: tmp = t_1 elif z <= 7e-22: tmp = t_0 else: tmp = x return tmp
function code(x, y, z) t_0 = Float64(x + Float64(-1.0 / x)) t_1 = Float64(x + Float64(y / 1.1283791670955126)) tmp = 0.0 if (z <= -2.5e-135) tmp = t_0; elseif (z <= -1.15e-297) tmp = t_1; elseif (z <= 4e-299) tmp = t_0; elseif (z <= 6.7e-192) tmp = t_1; elseif (z <= 7e-22) tmp = t_0; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (-1.0 / x); t_1 = x + (y / 1.1283791670955126); tmp = 0.0; if (z <= -2.5e-135) tmp = t_0; elseif (z <= -1.15e-297) tmp = t_1; elseif (z <= 4e-299) tmp = t_0; elseif (z <= 6.7e-192) tmp = t_1; elseif (z <= 7e-22) tmp = t_0; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e-135], t$95$0, If[LessEqual[z, -1.15e-297], t$95$1, If[LessEqual[z, 4e-299], t$95$0, If[LessEqual[z, 6.7e-192], t$95$1, If[LessEqual[z, 7e-22], t$95$0, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + \frac{-1}{x}\\
t_1 := x + \frac{y}{1.1283791670955126}\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{-135}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-299}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6.7 \cdot 10^{-192}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-22}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.5000000000000001e-135 or -1.15e-297 < z < 3.99999999999999997e-299 or 6.69999999999999991e-192 < z < 7.00000000000000011e-22Initial program 94.1%
*-lft-identity94.1%
metadata-eval94.1%
times-frac94.1%
neg-mul-194.1%
sub0-neg94.1%
associate-+l-94.1%
neg-sub094.3%
+-commutative94.3%
sub-neg94.3%
associate-/l*94.3%
div-sub94.2%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/99.9%
cancel-sign-sub-inv99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in x around inf 88.8%
if -2.5000000000000001e-135 < z < -1.15e-297 or 3.99999999999999997e-299 < z < 6.69999999999999991e-192Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 78.8%
Taylor expanded in z around 0 78.8%
if 7.00000000000000011e-22 < z Initial program 97.1%
*-lft-identity97.1%
metadata-eval97.1%
times-frac97.1%
neg-mul-197.1%
sub0-neg97.1%
associate-+l-97.1%
neg-sub097.1%
+-commutative97.1%
sub-neg97.1%
associate-/l*97.0%
div-sub97.0%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified100.0%
Taylor expanded in x around inf 41.5%
Taylor expanded in x around inf 95.8%
Final simplification88.6%
(FPCore (x y z) :precision binary64 (if (<= z -2.8e+15) (+ x (/ -1.0 x)) (if (<= z 0.08) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.8e+15) {
tmp = x + (-1.0 / x);
} else if (z <= 0.08) {
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 <= (-2.8d+15)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.08d0) 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 <= -2.8e+15) {
tmp = x + (-1.0 / x);
} else if (z <= 0.08) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.8e+15: tmp = x + (-1.0 / x) elif z <= 0.08: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.8e+15) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.08) 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 <= -2.8e+15) tmp = x + (-1.0 / x); elseif (z <= 0.08) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.8e+15], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.08], 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 -2.8 \cdot 10^{+15}:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.08:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.8e15Initial program 88.0%
*-lft-identity88.0%
metadata-eval88.0%
times-frac88.0%
neg-mul-188.0%
sub0-neg88.0%
associate-+l-88.0%
neg-sub088.5%
+-commutative88.5%
sub-neg88.5%
associate-/l*88.5%
div-sub88.3%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -2.8e15 < z < 0.0800000000000000017Initial program 99.9%
Taylor expanded in z around 0 99.7%
if 0.0800000000000000017 < z Initial program 96.9%
*-lft-identity96.9%
metadata-eval96.9%
times-frac96.9%
neg-mul-196.9%
sub0-neg96.9%
associate-+l-96.9%
neg-sub096.9%
+-commutative96.9%
sub-neg96.9%
associate-/l*96.9%
div-sub96.9%
associate-*r/100.0%
*-inverses100.0%
*-rgt-identity100.0%
associate-*l/100.0%
cancel-sign-sub-inv100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
distribute-rgt-neg-in100.0%
Simplified100.0%
Taylor expanded in x around inf 41.6%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (<= y -2.6e+28) x (if (<= y 6.4e-82) (+ x (/ y 1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.6e+28) {
tmp = x;
} else if (y <= 6.4e-82) {
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 (y <= (-2.6d+28)) then
tmp = x
else if (y <= 6.4d-82) 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 (y <= -2.6e+28) {
tmp = x;
} else if (y <= 6.4e-82) {
tmp = x + (y / 1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.6e+28: tmp = x elif y <= 6.4e-82: tmp = x + (y / 1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.6e+28) tmp = x; elseif (y <= 6.4e-82) 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 (y <= -2.6e+28) tmp = x; elseif (y <= 6.4e-82) tmp = x + (y / 1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.6e+28], x, If[LessEqual[y, 6.4e-82], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+28}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-82}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.6000000000000002e28 or 6.4000000000000002e-82 < y Initial program 98.5%
*-lft-identity98.5%
metadata-eval98.5%
times-frac98.5%
neg-mul-198.5%
sub0-neg98.5%
associate-+l-98.5%
neg-sub098.5%
+-commutative98.5%
sub-neg98.5%
associate-/l*98.5%
div-sub98.5%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/99.9%
cancel-sign-sub-inv99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in x around inf 74.8%
Taylor expanded in x around inf 69.3%
if -2.6000000000000002e28 < y < 6.4000000000000002e-82Initial program 93.2%
Taylor expanded in z around 0 86.4%
Taylor expanded in y around 0 86.4%
Taylor expanded in z around 0 83.9%
Final simplification75.8%
(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 96.1%
*-lft-identity96.1%
metadata-eval96.1%
times-frac96.1%
neg-mul-196.1%
sub0-neg96.1%
associate-+l-96.1%
neg-sub096.2%
+-commutative96.2%
sub-neg96.2%
associate-/l*96.2%
div-sub96.2%
associate-*r/99.9%
*-inverses99.9%
*-rgt-identity99.9%
associate-*l/99.9%
cancel-sign-sub-inv99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
Simplified99.9%
Taylor expanded in x around inf 69.3%
Taylor expanded in x around inf 71.0%
Final simplification71.0%
(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 2023199
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:herbie-target
(+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x)))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))