
(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 (+ 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.9%
remove-double-neg96.9%
neg-mul-196.9%
associate-/l*96.9%
neg-mul-196.9%
associate-/r*96.9%
div-sub96.9%
metadata-eval96.9%
associate-/l*96.9%
*-commutative96.9%
neg-mul-196.9%
distribute-lft-neg-out96.9%
/-rgt-identity96.9%
div-sub96.9%
associate-/r*96.9%
neg-mul-196.9%
*-rgt-identity96.9%
times-frac96.9%
/-rgt-identity96.9%
*-commutative96.9%
associate-*r/99.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.002)
(+ 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.002) {
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.002d0) 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.002) {
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.002: 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.002) 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.002) 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.002], 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.002:\\
\;\;\;\;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 89.0%
remove-double-neg89.0%
neg-mul-189.0%
associate-/l*89.1%
neg-mul-189.1%
associate-/r*89.1%
div-sub89.2%
metadata-eval89.2%
associate-/l*89.2%
*-commutative89.2%
neg-mul-189.2%
distribute-lft-neg-out89.2%
/-rgt-identity89.2%
div-sub89.1%
associate-/r*89.1%
neg-mul-189.1%
*-rgt-identity89.1%
times-frac89.1%
/-rgt-identity89.1%
*-commutative89.1%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) < 1.002Initial program 99.8%
Taylor expanded in z around 0 99.7%
if 1.002 < (exp.f64 z) Initial program 98.1%
remove-double-neg98.1%
neg-mul-198.1%
associate-/l*98.1%
neg-mul-198.1%
associate-/r*98.1%
div-sub98.1%
metadata-eval98.1%
associate-/l*98.1%
*-commutative98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
/-rgt-identity98.1%
div-sub98.1%
associate-/r*98.1%
neg-mul-198.1%
*-rgt-identity98.1%
times-frac98.1%
/-rgt-identity98.1%
*-commutative98.1%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 47.1%
Taylor expanded in x around inf 100.0%
Final simplification99.8%
(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 89.0%
remove-double-neg89.0%
neg-mul-189.0%
associate-/l*89.1%
neg-mul-189.1%
associate-/r*89.1%
div-sub89.2%
metadata-eval89.2%
associate-/l*89.2%
*-commutative89.2%
neg-mul-189.2%
distribute-lft-neg-out89.2%
/-rgt-identity89.2%
div-sub89.1%
associate-/r*89.1%
neg-mul-189.1%
*-rgt-identity89.1%
times-frac89.1%
/-rgt-identity89.1%
*-commutative89.1%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if 0.0 < (exp.f64 z) Initial program 99.4%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (<= z -0.0032) (+ x (/ -1.0 x)) (if (<= z 0.000115) (+ x (* 0.8862269254527579 (- y (* z y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.0032) {
tmp = x + (-1.0 / x);
} else if (z <= 0.000115) {
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 <= (-0.0032d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.000115d0) 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 <= -0.0032) {
tmp = x + (-1.0 / x);
} else if (z <= 0.000115) {
tmp = x + (0.8862269254527579 * (y - (z * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.0032: tmp = x + (-1.0 / x) elif z <= 0.000115: tmp = x + (0.8862269254527579 * (y - (z * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.0032) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.000115) 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 <= -0.0032) tmp = x + (-1.0 / x); elseif (z <= 0.000115) tmp = x + (0.8862269254527579 * (y - (z * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.0032], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.000115], 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 -0.0032:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.000115:\\
\;\;\;\;x + 0.8862269254527579 \cdot \left(y - z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.00320000000000000015Initial program 89.4%
remove-double-neg89.4%
neg-mul-189.4%
associate-/l*89.4%
neg-mul-189.4%
associate-/r*89.4%
div-sub89.6%
metadata-eval89.6%
associate-/l*89.6%
*-commutative89.6%
neg-mul-189.6%
distribute-lft-neg-out89.6%
/-rgt-identity89.6%
div-sub89.4%
associate-/r*89.4%
neg-mul-189.4%
*-rgt-identity89.4%
times-frac89.4%
/-rgt-identity89.4%
*-commutative89.4%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -0.00320000000000000015 < z < 1.15e-4Initial program 99.8%
remove-double-neg99.8%
neg-mul-199.8%
associate-/l*99.8%
neg-mul-199.8%
associate-/r*99.8%
div-sub99.8%
metadata-eval99.8%
associate-/l*99.8%
*-commutative99.8%
neg-mul-199.8%
distribute-lft-neg-out99.8%
/-rgt-identity99.8%
div-sub99.8%
associate-/r*99.8%
neg-mul-199.8%
*-rgt-identity99.8%
times-frac99.8%
/-rgt-identity99.8%
*-commutative99.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 76.1%
Taylor expanded in z around 0 76.0%
+-commutative76.0%
mul-1-neg76.0%
unsub-neg76.0%
Simplified76.0%
if 1.15e-4 < z Initial program 98.1%
remove-double-neg98.1%
neg-mul-198.1%
associate-/l*98.1%
neg-mul-198.1%
associate-/r*98.1%
div-sub98.1%
metadata-eval98.1%
associate-/l*98.1%
*-commutative98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
/-rgt-identity98.1%
div-sub98.1%
associate-/r*98.1%
neg-mul-198.1%
*-rgt-identity98.1%
times-frac98.1%
/-rgt-identity98.1%
*-commutative98.1%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 47.1%
Taylor expanded in x around inf 100.0%
Final simplification87.0%
(FPCore (x y z) :precision binary64 (if (<= z -300.0) (+ x (/ -1.0 x)) (if (<= z 0.0035) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -300.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.0035) {
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 <= (-300.0d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 0.0035d0) 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 <= -300.0) {
tmp = x + (-1.0 / x);
} else if (z <= 0.0035) {
tmp = x + (y / (1.1283791670955126 - (x * y)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -300.0: tmp = x + (-1.0 / x) elif z <= 0.0035: tmp = x + (y / (1.1283791670955126 - (x * y))) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -300.0) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 0.0035) 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 <= -300.0) tmp = x + (-1.0 / x); elseif (z <= 0.0035) tmp = x + (y / (1.1283791670955126 - (x * y))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -300.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0035], 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 -300:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 0.0035:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -300Initial program 89.0%
remove-double-neg89.0%
neg-mul-189.0%
associate-/l*89.1%
neg-mul-189.1%
associate-/r*89.1%
div-sub89.2%
metadata-eval89.2%
associate-/l*89.2%
*-commutative89.2%
neg-mul-189.2%
distribute-lft-neg-out89.2%
/-rgt-identity89.2%
div-sub89.1%
associate-/r*89.1%
neg-mul-189.1%
*-rgt-identity89.1%
times-frac89.1%
/-rgt-identity89.1%
*-commutative89.1%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -300 < z < 0.00350000000000000007Initial program 99.8%
Taylor expanded in z around 0 99.1%
if 0.00350000000000000007 < z Initial program 98.1%
remove-double-neg98.1%
neg-mul-198.1%
associate-/l*98.1%
neg-mul-198.1%
associate-/r*98.1%
div-sub98.1%
metadata-eval98.1%
associate-/l*98.1%
*-commutative98.1%
neg-mul-198.1%
distribute-lft-neg-out98.1%
/-rgt-identity98.1%
div-sub98.1%
associate-/r*98.1%
neg-mul-198.1%
*-rgt-identity98.1%
times-frac98.1%
/-rgt-identity98.1%
*-commutative98.1%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 47.1%
Taylor expanded in x around inf 100.0%
Final simplification99.5%
(FPCore (x y z)
:precision binary64
(if (<= y -1.6e-55)
x
(if (<= y 8.5e+101)
(+ x (/ y 1.1283791670955126))
(if (<= y 5.5e+257) x (/ -1.0 x)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.6e-55) {
tmp = x;
} else if (y <= 8.5e+101) {
tmp = x + (y / 1.1283791670955126);
} else if (y <= 5.5e+257) {
tmp = x;
} else {
tmp = -1.0 / 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 <= (-1.6d-55)) then
tmp = x
else if (y <= 8.5d+101) then
tmp = x + (y / 1.1283791670955126d0)
else if (y <= 5.5d+257) then
tmp = x
else
tmp = (-1.0d0) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.6e-55) {
tmp = x;
} else if (y <= 8.5e+101) {
tmp = x + (y / 1.1283791670955126);
} else if (y <= 5.5e+257) {
tmp = x;
} else {
tmp = -1.0 / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.6e-55: tmp = x elif y <= 8.5e+101: tmp = x + (y / 1.1283791670955126) elif y <= 5.5e+257: tmp = x else: tmp = -1.0 / x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.6e-55) tmp = x; elseif (y <= 8.5e+101) tmp = Float64(x + Float64(y / 1.1283791670955126)); elseif (y <= 5.5e+257) tmp = x; else tmp = Float64(-1.0 / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.6e-55) tmp = x; elseif (y <= 8.5e+101) tmp = x + (y / 1.1283791670955126); elseif (y <= 5.5e+257) tmp = x; else tmp = -1.0 / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.6e-55], x, If[LessEqual[y, 8.5e+101], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e+257], x, N[(-1.0 / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-55}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+101}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{+257}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x}\\
\end{array}
\end{array}
if y < -1.6000000000000001e-55 or 8.5000000000000001e101 < y < 5.49999999999999957e257Initial program 98.9%
remove-double-neg98.9%
neg-mul-198.9%
associate-/l*98.9%
neg-mul-198.9%
associate-/r*98.9%
div-sub98.9%
metadata-eval98.9%
associate-/l*98.9%
*-commutative98.9%
neg-mul-198.9%
distribute-lft-neg-out98.9%
/-rgt-identity98.9%
div-sub98.9%
associate-/r*98.9%
neg-mul-198.9%
*-rgt-identity98.9%
times-frac98.9%
/-rgt-identity98.9%
*-commutative98.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in x around inf 79.8%
Taylor expanded in x around inf 74.5%
if -1.6000000000000001e-55 < y < 8.5000000000000001e101Initial program 95.2%
Taylor expanded in z around 0 82.4%
Taylor expanded in y around 0 81.5%
if 5.49999999999999957e257 < y Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
associate-/l*100.0%
neg-mul-1100.0%
associate-/r*100.0%
div-sub100.0%
metadata-eval100.0%
associate-/l*100.0%
*-commutative100.0%
neg-mul-1100.0%
distribute-lft-neg-out100.0%
/-rgt-identity100.0%
div-sub100.0%
associate-/r*100.0%
neg-mul-1100.0%
*-rgt-identity100.0%
times-frac100.0%
/-rgt-identity100.0%
*-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 84.2%
flip3--34.4%
Applied egg-rr34.4%
cube-div34.1%
metadata-eval34.1%
sub-neg34.1%
distribute-neg-frac34.1%
metadata-eval34.1%
fma-def34.1%
rgt-mult-inverse34.1%
+-commutative34.1%
associate-*r/34.1%
*-rgt-identity34.1%
Simplified34.1%
Taylor expanded in x around 0 75.3%
Final simplification78.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.0028) (+ x (/ -1.0 x)) (if (<= z 3.4e-42) (+ x (/ y 1.1283791670955126)) x)))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.0028) {
tmp = x + (-1.0 / x);
} else if (z <= 3.4e-42) {
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 <= (-0.0028d0)) then
tmp = x + ((-1.0d0) / x)
else if (z <= 3.4d-42) 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 <= -0.0028) {
tmp = x + (-1.0 / x);
} else if (z <= 3.4e-42) {
tmp = x + (y / 1.1283791670955126);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.0028: tmp = x + (-1.0 / x) elif z <= 3.4e-42: tmp = x + (y / 1.1283791670955126) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.0028) tmp = Float64(x + Float64(-1.0 / x)); elseif (z <= 3.4e-42) 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 <= -0.0028) tmp = x + (-1.0 / x); elseif (z <= 3.4e-42) tmp = x + (y / 1.1283791670955126); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.0028], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e-42], N[(x + N[(y / 1.1283791670955126), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0028:\\
\;\;\;\;x + \frac{-1}{x}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-42}:\\
\;\;\;\;x + \frac{y}{1.1283791670955126}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.00279999999999999997Initial program 89.4%
remove-double-neg89.4%
neg-mul-189.4%
associate-/l*89.4%
neg-mul-189.4%
associate-/r*89.4%
div-sub89.6%
metadata-eval89.6%
associate-/l*89.6%
*-commutative89.6%
neg-mul-189.6%
distribute-lft-neg-out89.6%
/-rgt-identity89.6%
div-sub89.4%
associate-/r*89.4%
neg-mul-189.4%
*-rgt-identity89.4%
times-frac89.4%
/-rgt-identity89.4%
*-commutative89.4%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
if -0.00279999999999999997 < z < 3.40000000000000022e-42Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in y around 0 76.1%
if 3.40000000000000022e-42 < z Initial program 98.3%
remove-double-neg98.3%
neg-mul-198.3%
associate-/l*98.3%
neg-mul-198.3%
associate-/r*98.3%
div-sub98.3%
metadata-eval98.3%
associate-/l*98.3%
*-commutative98.3%
neg-mul-198.3%
distribute-lft-neg-out98.3%
/-rgt-identity98.3%
div-sub98.3%
associate-/r*98.3%
neg-mul-198.3%
*-rgt-identity98.3%
times-frac98.3%
/-rgt-identity98.3%
*-commutative98.3%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in x around inf 46.0%
Taylor expanded in x around inf 96.8%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= y 3.2e+259) x (/ -1.0 x)))
double code(double x, double y, double z) {
double tmp;
if (y <= 3.2e+259) {
tmp = x;
} else {
tmp = -1.0 / 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 <= 3.2d+259) then
tmp = x
else
tmp = (-1.0d0) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 3.2e+259) {
tmp = x;
} else {
tmp = -1.0 / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 3.2e+259: tmp = x else: tmp = -1.0 / x return tmp
function code(x, y, z) tmp = 0.0 if (y <= 3.2e+259) tmp = x; else tmp = Float64(-1.0 / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 3.2e+259) tmp = x; else tmp = -1.0 / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 3.2e+259], x, N[(-1.0 / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.2 \cdot 10^{+259}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{x}\\
\end{array}
\end{array}
if y < 3.20000000000000018e259Initial program 96.7%
remove-double-neg96.7%
neg-mul-196.7%
associate-/l*96.8%
neg-mul-196.8%
associate-/r*96.8%
div-sub96.8%
metadata-eval96.8%
associate-/l*96.8%
*-commutative96.8%
neg-mul-196.8%
distribute-lft-neg-out96.8%
/-rgt-identity96.8%
div-sub96.8%
associate-/r*96.8%
neg-mul-196.8%
*-rgt-identity96.8%
times-frac96.7%
/-rgt-identity96.7%
*-commutative96.7%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in x around inf 69.0%
Taylor expanded in x around inf 72.1%
if 3.20000000000000018e259 < y Initial program 100.0%
remove-double-neg100.0%
neg-mul-1100.0%
associate-/l*100.0%
neg-mul-1100.0%
associate-/r*100.0%
div-sub100.0%
metadata-eval100.0%
associate-/l*100.0%
*-commutative100.0%
neg-mul-1100.0%
distribute-lft-neg-out100.0%
/-rgt-identity100.0%
div-sub100.0%
associate-/r*100.0%
neg-mul-1100.0%
*-rgt-identity100.0%
times-frac100.0%
/-rgt-identity100.0%
*-commutative100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in x around inf 84.2%
flip3--34.4%
Applied egg-rr34.4%
cube-div34.1%
metadata-eval34.1%
sub-neg34.1%
distribute-neg-frac34.1%
metadata-eval34.1%
fma-def34.1%
rgt-mult-inverse34.1%
+-commutative34.1%
associate-*r/34.1%
*-rgt-identity34.1%
Simplified34.1%
Taylor expanded in x around 0 75.3%
Final simplification72.2%
(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.9%
remove-double-neg96.9%
neg-mul-196.9%
associate-/l*96.9%
neg-mul-196.9%
associate-/r*96.9%
div-sub96.9%
metadata-eval96.9%
associate-/l*96.9%
*-commutative96.9%
neg-mul-196.9%
distribute-lft-neg-out96.9%
/-rgt-identity96.9%
div-sub96.9%
associate-/r*96.9%
neg-mul-196.9%
*-rgt-identity96.9%
times-frac96.9%
/-rgt-identity96.9%
*-commutative96.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in x around inf 69.7%
Taylor expanded in x around inf 69.5%
Final simplification69.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 2023274
(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)))))