
(FPCore (x) :precision binary64 (* x (log x)))
double code(double x) {
return x * log(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * log(x)
end function
public static double code(double x) {
return x * Math.log(x);
}
def code(x): return x * math.log(x)
function code(x) return Float64(x * log(x)) end
function tmp = code(x) tmp = x * log(x); end
code[x_] := N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 2 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (* x (log x)))
double code(double x) {
return x * log(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * log(x)
end function
public static double code(double x) {
return x * Math.log(x);
}
def code(x): return x * math.log(x)
function code(x) return Float64(x * log(x)) end
function tmp = code(x) tmp = x * log(x); end
code[x_] := N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log x
\end{array}
(FPCore (x) :precision binary64 (* x (log x)))
double code(double x) {
return x * log(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * log(x)
end function
public static double code(double x) {
return x * Math.log(x);
}
def code(x): return x * math.log(x)
function code(x) return Float64(x * log(x)) end
function tmp = code(x) tmp = x * log(x); end
code[x_] := N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \log x
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x) :precision binary64 (* x 0.0))
double code(double x) {
return x * 0.0;
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * 0.0d0
end function
public static double code(double x) {
return x * 0.0;
}
def code(x): return x * 0.0
function code(x) return Float64(x * 0.0) end
function tmp = code(x) tmp = x * 0.0; end
code[x_] := N[(x * 0.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0
\end{array}
Initial program 99.6%
Taylor expanded in x around inf 99.6%
add-sqr-sqrt99.6%
associate-/r*99.6%
metadata-eval99.6%
sqrt-div99.6%
add-exp-log99.6%
add-sqr-sqrt55.9%
sqrt-unprod58.3%
log-rec58.3%
log-rec58.3%
sqr-neg58.3%
sqrt-unprod2.2%
add-sqr-sqrt6.1%
add-exp-log4.0%
/-rgt-identity4.0%
/-rgt-identity4.0%
log-div4.0%
Applied egg-rr4.0%
+-inverses4.0%
Simplified4.0%
Final simplification4.0%
herbie shell --seed 2024071
(FPCore (x)
:name "Statistics.Distribution.Binomial:directEntropy from math-functions-0.1.5.2"
:precision binary64
(* x (log x)))