
(FPCore (x) :precision binary64 (- (/ (+ 2.30753 (* x 0.27061)) (+ 1.0 (* x (+ 0.99229 (* x 0.04481))))) x))
double code(double x) {
return ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((2.30753d0 + (x * 0.27061d0)) / (1.0d0 + (x * (0.99229d0 + (x * 0.04481d0))))) - x
end function
public static double code(double x) {
return ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x;
}
def code(x): return ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x
function code(x) return Float64(Float64(Float64(2.30753 + Float64(x * 0.27061)) / Float64(1.0 + Float64(x * Float64(0.99229 + Float64(x * 0.04481))))) - x) end
function tmp = code(x) tmp = ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x; end
code[x_] := N[(N[(N[(2.30753 + N[(x * 0.27061), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(x * N[(0.99229 + N[(x * 0.04481), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{2.30753 + x \cdot 0.27061}{1 + x \cdot \left(0.99229 + x \cdot 0.04481\right)} - x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ (+ 2.30753 (* x 0.27061)) (+ 1.0 (* x (+ 0.99229 (* x 0.04481))))) x))
double code(double x) {
return ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((2.30753d0 + (x * 0.27061d0)) / (1.0d0 + (x * (0.99229d0 + (x * 0.04481d0))))) - x
end function
public static double code(double x) {
return ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x;
}
def code(x): return ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x
function code(x) return Float64(Float64(Float64(2.30753 + Float64(x * 0.27061)) / Float64(1.0 + Float64(x * Float64(0.99229 + Float64(x * 0.04481))))) - x) end
function tmp = code(x) tmp = ((2.30753 + (x * 0.27061)) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x; end
code[x_] := N[(N[(N[(2.30753 + N[(x * 0.27061), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(x * N[(0.99229 + N[(x * 0.04481), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{2.30753 + x \cdot 0.27061}{1 + x \cdot \left(0.99229 + x \cdot 0.04481\right)} - x
\end{array}
(FPCore (x) :precision binary64 (- (/ 1.0 (/ (+ 1.0 (* x (+ 0.99229 (* x 0.04481)))) (+ (* x 0.27061) 2.30753))) x))
double code(double x) {
return (1.0 / ((1.0 + (x * (0.99229 + (x * 0.04481)))) / ((x * 0.27061) + 2.30753))) - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / ((1.0d0 + (x * (0.99229d0 + (x * 0.04481d0)))) / ((x * 0.27061d0) + 2.30753d0))) - x
end function
public static double code(double x) {
return (1.0 / ((1.0 + (x * (0.99229 + (x * 0.04481)))) / ((x * 0.27061) + 2.30753))) - x;
}
def code(x): return (1.0 / ((1.0 + (x * (0.99229 + (x * 0.04481)))) / ((x * 0.27061) + 2.30753))) - x
function code(x) return Float64(Float64(1.0 / Float64(Float64(1.0 + Float64(x * Float64(0.99229 + Float64(x * 0.04481)))) / Float64(Float64(x * 0.27061) + 2.30753))) - x) end
function tmp = code(x) tmp = (1.0 / ((1.0 + (x * (0.99229 + (x * 0.04481)))) / ((x * 0.27061) + 2.30753))) - x; end
code[x_] := N[(N[(1.0 / N[(N[(1.0 + N[(x * N[(0.99229 + N[(x * 0.04481), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(x * 0.27061), $MachinePrecision] + 2.30753), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{1 + x \cdot \left(0.99229 + x \cdot 0.04481\right)}{x \cdot 0.27061 + 2.30753}} - x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
clear-num100.0%
inv-pow100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
(FPCore (x) :precision binary64 (- (/ (+ (* x 0.27061) 2.30753) (+ 1.0 (* x (+ 0.99229 (* x 0.04481))))) x))
double code(double x) {
return (((x * 0.27061) + 2.30753) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((x * 0.27061d0) + 2.30753d0) / (1.0d0 + (x * (0.99229d0 + (x * 0.04481d0))))) - x
end function
public static double code(double x) {
return (((x * 0.27061) + 2.30753) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x;
}
def code(x): return (((x * 0.27061) + 2.30753) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x
function code(x) return Float64(Float64(Float64(Float64(x * 0.27061) + 2.30753) / Float64(1.0 + Float64(x * Float64(0.99229 + Float64(x * 0.04481))))) - x) end
function tmp = code(x) tmp = (((x * 0.27061) + 2.30753) / (1.0 + (x * (0.99229 + (x * 0.04481))))) - x; end
code[x_] := N[(N[(N[(N[(x * 0.27061), $MachinePrecision] + 2.30753), $MachinePrecision] / N[(1.0 + N[(x * N[(0.99229 + N[(x * 0.04481), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot 0.27061 + 2.30753}{1 + x \cdot \left(0.99229 + x \cdot 0.04481\right)} - x
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(-
(/
1.0
(+
0.4333638132548656
(* x (+ 0.37920088514346545 (* x -0.025050834237766436)))))
x))
double code(double x) {
return (1.0 / (0.4333638132548656 + (x * (0.37920088514346545 + (x * -0.025050834237766436))))) - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (0.4333638132548656d0 + (x * (0.37920088514346545d0 + (x * (-0.025050834237766436d0)))))) - x
end function
public static double code(double x) {
return (1.0 / (0.4333638132548656 + (x * (0.37920088514346545 + (x * -0.025050834237766436))))) - x;
}
def code(x): return (1.0 / (0.4333638132548656 + (x * (0.37920088514346545 + (x * -0.025050834237766436))))) - x
function code(x) return Float64(Float64(1.0 / Float64(0.4333638132548656 + Float64(x * Float64(0.37920088514346545 + Float64(x * -0.025050834237766436))))) - x) end
function tmp = code(x) tmp = (1.0 / (0.4333638132548656 + (x * (0.37920088514346545 + (x * -0.025050834237766436))))) - x; end
code[x_] := N[(N[(1.0 / N[(0.4333638132548656 + N[(x * N[(0.37920088514346545 + N[(x * -0.025050834237766436), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{0.4333638132548656 + x \cdot \left(0.37920088514346545 + x \cdot -0.025050834237766436\right)} - x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
clear-num100.0%
inv-pow100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in x around 0 98.6%
*-commutative98.6%
Simplified98.6%
(FPCore (x) :precision binary64 (- (/ 1.0 (+ 0.4333638132548656 (* x 0.37920088514346545))) x))
double code(double x) {
return (1.0 / (0.4333638132548656 + (x * 0.37920088514346545))) - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / (0.4333638132548656d0 + (x * 0.37920088514346545d0))) - x
end function
public static double code(double x) {
return (1.0 / (0.4333638132548656 + (x * 0.37920088514346545))) - x;
}
def code(x): return (1.0 / (0.4333638132548656 + (x * 0.37920088514346545))) - x
function code(x) return Float64(Float64(1.0 / Float64(0.4333638132548656 + Float64(x * 0.37920088514346545))) - x) end
function tmp = code(x) tmp = (1.0 / (0.4333638132548656 + (x * 0.37920088514346545))) - x; end
code[x_] := N[(N[(1.0 / N[(0.4333638132548656 + N[(x * 0.37920088514346545), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{0.4333638132548656 + x \cdot 0.37920088514346545} - x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
clear-num100.0%
inv-pow100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in x around 0 98.5%
Final simplification98.5%
(FPCore (x) :precision binary64 (- 2.30753 x))
double code(double x) {
return 2.30753 - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 2.30753d0 - x
end function
public static double code(double x) {
return 2.30753 - x;
}
def code(x): return 2.30753 - x
function code(x) return Float64(2.30753 - x) end
function tmp = code(x) tmp = 2.30753 - x; end
code[x_] := N[(2.30753 - x), $MachinePrecision]
\begin{array}{l}
\\
2.30753 - x
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 96.9%
(FPCore (x) :precision binary64 (- 0.4434857248047533 x))
double code(double x) {
return 0.4434857248047533 - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.4434857248047533d0 - x
end function
public static double code(double x) {
return 0.4434857248047533 - x;
}
def code(x): return 0.4434857248047533 - x
function code(x) return Float64(0.4434857248047533 - x) end
function tmp = code(x) tmp = 0.4434857248047533 - x; end
code[x_] := N[(0.4434857248047533 - x), $MachinePrecision]
\begin{array}{l}
\\
0.4434857248047533 - x
\end{array}
Initial program 100.0%
Taylor expanded in x around inf 100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
clear-num100.0%
inv-pow100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
Applied egg-rr100.0%
unpow-1100.0%
Simplified100.0%
Taylor expanded in x around inf 63.3%
associate-*r/63.3%
metadata-eval63.3%
Simplified63.3%
Taylor expanded in x around 0 62.2%
(FPCore (x) :precision binary64 (- 0.2727126142559131 x))
double code(double x) {
return 0.2727126142559131 - x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.2727126142559131d0 - x
end function
public static double code(double x) {
return 0.2727126142559131 - x;
}
def code(x): return 0.2727126142559131 - x
function code(x) return Float64(0.2727126142559131 - x) end
function tmp = code(x) tmp = 0.2727126142559131 - x; end
code[x_] := N[(0.2727126142559131 - x), $MachinePrecision]
\begin{array}{l}
\\
0.2727126142559131 - x
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in x around inf 62.0%
(FPCore (x) :precision binary64 (- x))
double code(double x) {
return -x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = -x
end function
public static double code(double x) {
return -x;
}
def code(x): return -x
function code(x) return Float64(-x) end
function tmp = code(x) tmp = -x; end
code[x_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 96.9%
Taylor expanded in x around inf 57.3%
neg-mul-157.3%
Simplified57.3%
(FPCore (x) :precision binary64 x)
double code(double x) {
return x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = x
end function
public static double code(double x) {
return x;
}
def code(x): return x
function code(x) return x end
function tmp = code(x) tmp = x; end
code[x_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 96.9%
Taylor expanded in x around inf 57.3%
neg-mul-157.3%
Simplified57.3%
neg-sub057.3%
sub-neg57.3%
add-sqr-sqrt26.4%
sqrt-unprod17.2%
sqr-neg17.2%
sqrt-prod1.4%
add-sqr-sqrt2.1%
Applied egg-rr2.1%
+-lft-identity2.1%
Simplified2.1%
herbie shell --seed 2024116
(FPCore (x)
:name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, C"
:precision binary64
(- (/ (+ 2.30753 (* x 0.27061)) (+ 1.0 (* x (+ 0.99229 (* x 0.04481))))) x))