Average Error: 14.3 → 7.5
Time: 37.6s
Precision: 64
Internal precision: 128
\[x \cdot \log \left(\frac{x}{y}\right) - z\]
⬇
\[\begin{array}{l}
\mathbf{if}\;y \le 1.707486177612851 \cdot 10^{-299}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array}\]
Target
| Original | 14.3 |
| Comparison | 7.3 |
| Herbie | 7.5 |
\[ \begin{array}{l}
\mathbf{if}\;y \lt 7.595077799083773 \cdot 10^{-308}:\\
\;\;\;\;x \cdot \log \left(\frac{x}{y}\right) - z\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x - \log y\right) - z\\
\end{array} \]
Derivation
- Split input into 2 regimes.
-
if y < 1.707486177612851e-299
Initial program 14.3
\[x \cdot \log \left(\frac{x}{y}\right) - z\]
if 1.707486177612851e-299 < y
Initial program 14.3
\[x \cdot \log \left(\frac{x}{y}\right) - z\]
Applied taylor 0.3
\[\leadsto x \cdot \left(\log x - \log y\right) - z\]
Taylor expanded around 0 0.3
\[\leadsto x \cdot \color{blue}{\left(\log x - \log y\right)} - z\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie --seed '#(4152991467 2894169543 3043670663 4084068115 85329585 1186516373)'
(FPCore (x y z)
:name "Numeric.SpecFunctions.Extra:bd0 from math-functions-0.1.5.2"
:target
(if (< y 7.595077799083773e-308) (- (* x (log (/ x y))) z) (- (* x (- (log x) (log y))) z))
(- (* x (log (/ x y))) z))