
(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 5 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 (/ 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}
Initial program 95.6%
(FPCore (x y z) :precision binary64 (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))
double code(double x, double y, double z) {
return 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 = y / ((1.1283791670955126d0 * exp(z)) - (x * y))
end function
public static double code(double x, double y, double z) {
return y / ((1.1283791670955126 * Math.exp(z)) - (x * y));
}
def code(x, y, z): return y / ((1.1283791670955126 * math.exp(z)) - (x * y))
function code(x, y, z) return Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))) end
function tmp = code(x, y, z) tmp = y / ((1.1283791670955126 * exp(z)) - (x * y)); end
code[x_, y_, z_] := N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}
Initial program 95.6%
Taylor expanded in x around 0
Applied rewrites27.0%
(FPCore (x y z) :precision binary64 (- (* 1.1283791670955126 (exp z)) (* x y)))
double code(double x, double y, double z) {
return (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 = (1.1283791670955126d0 * exp(z)) - (x * y)
end function
public static double code(double x, double y, double z) {
return (1.1283791670955126 * Math.exp(z)) - (x * y);
}
def code(x, y, z): return (1.1283791670955126 * math.exp(z)) - (x * y)
function code(x, y, z) return Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y)) end
function tmp = code(x, y, z) tmp = (1.1283791670955126 * exp(z)) - (x * y); end
code[x_, y_, z_] := N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1.1283791670955126 \cdot e^{z} - x \cdot y
\end{array}
Initial program 95.6%
Taylor expanded in x around 0
Applied rewrites3.2%
(FPCore (x y z) :precision binary64 (* 1.1283791670955126 (exp z)))
double code(double x, double y, double z) {
return 1.1283791670955126 * exp(z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 1.1283791670955126d0 * exp(z)
end function
public static double code(double x, double y, double z) {
return 1.1283791670955126 * Math.exp(z);
}
def code(x, y, z): return 1.1283791670955126 * math.exp(z)
function code(x, y, z) return Float64(1.1283791670955126 * exp(z)) end
function tmp = code(x, y, z) tmp = 1.1283791670955126 * exp(z); end
code[x_, y_, z_] := N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1.1283791670955126 \cdot e^{z}
\end{array}
Initial program 95.6%
Taylor expanded in x around 0
Applied rewrites2.9%
(FPCore (x y z) :precision binary64 (exp z))
double code(double x, double y, double z) {
return exp(z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = exp(z)
end function
public static double code(double x, double y, double z) {
return Math.exp(z);
}
def code(x, y, z): return math.exp(z)
function code(x, y, z) return exp(z) end
function tmp = code(x, y, z) tmp = exp(z); end
code[x_, y_, z_] := N[Exp[z], $MachinePrecision]
\begin{array}{l}
\\
e^{z}
\end{array}
Initial program 95.6%
Taylor expanded in x around 0
Applied rewrites2.9%
Taylor expanded in x around 0
Applied rewrites2.9%
(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 2024321
(FPCore (x y z)
:name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
:precision binary64
:pre (TRUE)
:alt
(! :herbie-platform default (+ x (/ 1 (- (* (/ 5641895835477563/5000000000000000 y) (exp z)) x))))
(+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))