
(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 (+ (+ 1.0 (log x)) -1.0)))
double code(double x) {
return x * ((1.0 + log(x)) + -1.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = x * ((1.0d0 + log(x)) + (-1.0d0))
end function
public static double code(double x) {
return x * ((1.0 + Math.log(x)) + -1.0);
}
def code(x): return x * ((1.0 + math.log(x)) + -1.0)
function code(x) return Float64(x * Float64(Float64(1.0 + log(x)) + -1.0)) end
function tmp = code(x) tmp = x * ((1.0 + log(x)) + -1.0); end
code[x_] := N[(x * N[(N[(1.0 + N[Log[x], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\left(1 + \log x\right) + -1\right)
\end{array}
Initial program 99.6%
expm1-log1p-u54.8%
expm1-undefine54.8%
log1p-undefine54.8%
rem-exp-log99.6%
Applied egg-rr99.6%
Final simplification99.6%
(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%
herbie shell --seed 2024137
(FPCore (x)
:name "Statistics.Distribution.Binomial:directEntropy from math-functions-0.1.5.2"
:precision binary64
(* x (log x)))