
(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 4 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 (- (* 1.1283791670955126 (/ (exp z) y)) x))))
double code(double x, double y, double z) {
return x + (1.0 / ((1.1283791670955126 * (exp(z) / y)) - 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 * (exp(z) / y)) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / ((1.1283791670955126 * (Math.exp(z) / y)) - x));
}
def code(x, y, z): return x + (1.0 / ((1.1283791670955126 * (math.exp(z) / y)) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(1.1283791670955126 * Float64(exp(z) / y)) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / ((1.1283791670955126 * (exp(z) / y)) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(1.1283791670955126 * N[(N[Exp[z], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{1.1283791670955126 \cdot \frac{e^{z}}{y} - x}
\end{array}
Initial program 93.3%
*-lft-identity93.3%
associate-/l*93.3%
remove-double-neg93.3%
neg-mul-193.3%
associate-/r*93.3%
div-sub93.5%
metadata-eval93.5%
associate-/l*93.5%
*-commutative93.5%
associate-*l*93.5%
neg-mul-193.5%
/-rgt-identity93.5%
div-sub93.3%
associate-/r*93.3%
neg-mul-193.3%
remove-double-neg93.3%
associate-*r/93.3%
distribute-lft-neg-out93.3%
neg-mul-193.3%
*-commutative93.3%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (+ x (/ 1.0 (- (/ 1.1283791670955126 y) x))))
double code(double x, double y, double z) {
return x + (1.0 / ((1.1283791670955126 / y) - 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) - x))
end function
public static double code(double x, double y, double z) {
return x + (1.0 / ((1.1283791670955126 / y) - x));
}
def code(x, y, z): return x + (1.0 / ((1.1283791670955126 / y) - x))
function code(x, y, z) return Float64(x + Float64(1.0 / Float64(Float64(1.1283791670955126 / y) - x))) end
function tmp = code(x, y, z) tmp = x + (1.0 / ((1.1283791670955126 / y) - x)); end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(1.1283791670955126 / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{1}{\frac{1.1283791670955126}{y} - x}
\end{array}
Initial program 93.3%
*-lft-identity93.3%
associate-/l*93.3%
remove-double-neg93.3%
neg-mul-193.3%
associate-/r*93.3%
div-sub93.5%
metadata-eval93.5%
associate-/l*93.5%
*-commutative93.5%
associate-*l*93.5%
neg-mul-193.5%
/-rgt-identity93.5%
div-sub93.3%
associate-/r*93.3%
neg-mul-193.3%
remove-double-neg93.3%
associate-*r/93.3%
distribute-lft-neg-out93.3%
neg-mul-193.3%
*-commutative93.3%
Simplified99.9%
Taylor expanded in z around 0 78.7%
Final simplification78.7%
(FPCore (x y z) :precision binary64 (+ x (/ -1.0 x)))
double code(double x, double y, double z) {
return x + (-1.0 / 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) / x)
end function
public static double code(double x, double y, double z) {
return x + (-1.0 / x);
}
def code(x, y, z): return x + (-1.0 / x)
function code(x, y, z) return Float64(x + Float64(-1.0 / x)) end
function tmp = code(x, y, z) tmp = x + (-1.0 / x); end
code[x_, y_, z_] := N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{-1}{x}
\end{array}
Initial program 93.3%
*-lft-identity93.3%
associate-/l*93.3%
remove-double-neg93.3%
neg-mul-193.3%
associate-/r*93.3%
div-sub93.5%
metadata-eval93.5%
associate-/l*93.5%
*-commutative93.5%
associate-*l*93.5%
neg-mul-193.5%
/-rgt-identity93.5%
div-sub93.3%
associate-/r*93.3%
neg-mul-193.3%
remove-double-neg93.3%
associate-*r/93.3%
distribute-lft-neg-out93.3%
neg-mul-193.3%
*-commutative93.3%
Simplified99.9%
Taylor expanded in x around inf 69.7%
Final simplification69.7%
(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 93.3%
*-lft-identity93.3%
associate-/l*93.3%
remove-double-neg93.3%
neg-mul-193.3%
associate-/r*93.3%
div-sub93.5%
metadata-eval93.5%
associate-/l*93.5%
*-commutative93.5%
associate-*l*93.5%
neg-mul-193.5%
/-rgt-identity93.5%
div-sub93.3%
associate-/r*93.3%
neg-mul-193.3%
remove-double-neg93.3%
associate-*r/93.3%
distribute-lft-neg-out93.3%
neg-mul-193.3%
*-commutative93.3%
Simplified99.9%
Taylor expanded in x around inf 67.2%
Final simplification67.2%
(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 2024033
(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)))))