Average Error: 15.1 → 0.4
Time: 45.0s
Precision: 64
Internal Precision: 384
\[x \cdot \log \left(\frac{x}{y}\right)\]
\[\log \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{y}}\right) \cdot \left(x + x\right) + x \cdot \log \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{y}}\right)\]

Error

Bits error versus x

Bits error versus y

Target

Original15.1
Target8.1
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;y \lt 1.2973149052617803 \cdot 10^{-303}:\\ \;\;\;\;x \cdot \log \left(\frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{1}{\log x - \log y}}\\ \end{array}\]

Derivation

  1. Initial program 15.1

    \[x \cdot \log \left(\frac{x}{y}\right)\]
  2. Using strategy rm
  3. Applied add-cube-cbrt15.1

    \[\leadsto x \cdot \log \color{blue}{\left(\left(\sqrt[3]{\frac{x}{y}} \cdot \sqrt[3]{\frac{x}{y}}\right) \cdot \sqrt[3]{\frac{x}{y}}\right)}\]
  4. Applied log-prod15.2

    \[\leadsto x \cdot \color{blue}{\left(\log \left(\sqrt[3]{\frac{x}{y}} \cdot \sqrt[3]{\frac{x}{y}}\right) + \log \left(\sqrt[3]{\frac{x}{y}}\right)\right)}\]
  5. Applied distribute-lft-in15.2

    \[\leadsto \color{blue}{x \cdot \log \left(\sqrt[3]{\frac{x}{y}} \cdot \sqrt[3]{\frac{x}{y}}\right) + x \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)}\]
  6. Applied simplify15.2

    \[\leadsto \color{blue}{\log \left(\sqrt[3]{\frac{x}{y}}\right) \cdot \left(x + x\right)} + x \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\]
  7. Using strategy rm
  8. Applied div-inv15.2

    \[\leadsto \log \left(\sqrt[3]{\color{blue}{x \cdot \frac{1}{y}}}\right) \cdot \left(x + x\right) + x \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\]
  9. Applied cbrt-prod15.2

    \[\leadsto \log \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{y}}\right)} \cdot \left(x + x\right) + x \cdot \log \left(\sqrt[3]{\frac{x}{y}}\right)\]
  10. Using strategy rm
  11. Applied div-inv15.2

    \[\leadsto \log \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{y}}\right) \cdot \left(x + x\right) + x \cdot \log \left(\sqrt[3]{\color{blue}{x \cdot \frac{1}{y}}}\right)\]
  12. Applied cbrt-prod0.4

    \[\leadsto \log \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{y}}\right) \cdot \left(x + x\right) + x \cdot \log \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{1}{y}}\right)}\]
  13. Removed slow pow expressions.

Runtime

Time bar (total: 45.0s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y)
  :name "Data.HyperLogLog.Type:size from hyperloglog-0.3.4, B"

  :herbie-target
  (if (< y 1.2973149052617803e-303) (* x (log (/ x y))) (/ x (/ 1 (- (log x) (log y)))))

  (* x (log (/ x y))))