?

Average Accuracy: 37.9% → 100.0%
Time: 2.7s
Precision: binary64
Cost: 6592

?

\[\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{exp.f64}\left(x\right), 1\right), x\right) \]
\[\mathsf{/.f64}\left(\mathsf{expm1.f64}\left(x\right), x\right) \]
(FPCore (x) :precision binary64 (/.f64 (-.f64 (exp.f64 x) 1) x))
(FPCore (x) :precision binary64 (/.f64 (expm1.f64 x) x))
\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{exp.f64}\left(x\right), 1\right), x\right)
\mathsf{/.f64}\left(\mathsf{expm1.f64}\left(x\right), x\right)

Error?

Target

Original37.9%
Target37.2%
Herbie100.0%
\[\begin{array}{l} \mathbf{if}\;\mathsf{<.f64}\left(x, 1\right) \land \mathsf{>.f64}\left(x, -1\right):\\ \;\;\;\;\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{exp.f64}\left(x\right), 1\right), \mathsf{log.f64}\left(\mathsf{exp.f64}\left(x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{exp.f64}\left(x\right), 1\right), x\right)\\ \end{array} \]

Derivation?

  1. Initial program 37.9%

    \[\mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{exp.f64}\left(x\right), 1\right), x\right) \]
  2. Simplified100.0%

    \[\leadsto \color{blue}{\mathsf{/.f64}\left(\mathsf{expm1.f64}\left(x\right), x\right)} \]
    Proof

    [Start]37.9

    \[ \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{exp.f64}\left(x\right), 1\right), x\right) \]

    expm1-def [=>]100.0

    \[ \mathsf{/.f64}\left(\color{blue}{\mathsf{expm1.f64}\left(x\right)}, x\right) \]
  3. Final simplification100.0%

    \[\leadsto \mathsf{/.f64}\left(\mathsf{expm1.f64}\left(x\right), x\right) \]

Alternatives

Alternative 1
Accuracy66.6%
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023144 
(FPCore (x)
  :name "Kahan's exp quotient"
  :precision binary64

  :herbie-target
  (if (and (< x 1.0) (> x -1.0)) (/ (- (exp x) 1.0) (log (exp x))) (/ (- (exp x) 1.0) x))

  (/ (- (exp x) 1.0) x))