?

Average Error: 29.3 → 0.0
Time: 17.7s
Precision: binary64
Cost: 13440

?

\[0 \leq x \land x \leq 1.79 \cdot 10^{+308}\]
\[\mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(x, 1\right)\right) - 1\right) \]
\[\mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(x, 1\right)}{x}}\right) \]
(FPCore (x) :precision binary64 (log1p (- (+ x (hypot x 1.0)) 1.0)))
(FPCore (x)
 :precision binary64
 (log1p (+ x (/ x (/ (+ 1.0 (hypot x 1.0)) x)))))
double code(double x) {
	return log1p(((x + hypot(x, 1.0)) - 1.0));
}
double code(double x) {
	return log1p((x + (x / ((1.0 + hypot(x, 1.0)) / x))));
}
public static double code(double x) {
	return Math.log1p(((x + Math.hypot(x, 1.0)) - 1.0));
}
public static double code(double x) {
	return Math.log1p((x + (x / ((1.0 + Math.hypot(x, 1.0)) / x))));
}
def code(x):
	return math.log1p(((x + math.hypot(x, 1.0)) - 1.0))
def code(x):
	return math.log1p((x + (x / ((1.0 + math.hypot(x, 1.0)) / x))))
function code(x)
	return log1p(Float64(Float64(x + hypot(x, 1.0)) - 1.0))
end
function code(x)
	return log1p(Float64(x + Float64(x / Float64(Float64(1.0 + hypot(x, 1.0)) / x))))
end
code[x_] := N[Log[1 + N[(N[(x + N[Sqrt[x ^ 2 + 1.0 ^ 2], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Log[1 + N[(x + N[(x / N[(N[(1.0 + N[Sqrt[x ^ 2 + 1.0 ^ 2], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(x, 1\right)\right) - 1\right)
\mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(x, 1\right)}{x}}\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 29.3

    \[\mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(x, 1\right)\right) - 1\right) \]
  2. Simplified0.3

    \[\leadsto \color{blue}{\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(x, 1\right) - 1\right)\right)} \]
    Proof

    [Start]29.3

    \[ \mathsf{log1p}\left(\left(x + \mathsf{hypot}\left(x, 1\right)\right) - 1\right) \]

    associate--l+ [=>]0.3

    \[ \mathsf{log1p}\left(\color{blue}{x + \left(\mathsf{hypot}\left(x, 1\right) - 1\right)}\right) \]
  3. Applied egg-rr15.8

    \[\leadsto \mathsf{log1p}\left(x + \color{blue}{\left(x \cdot x + 0\right) \cdot \frac{1}{1 + \mathsf{hypot}\left(x, 1\right)}}\right) \]
  4. Simplified0.0

    \[\leadsto \mathsf{log1p}\left(x + \color{blue}{\frac{x}{\frac{1 + \mathsf{hypot}\left(x, 1\right)}{x}}}\right) \]
    Proof

    [Start]15.8

    \[ \mathsf{log1p}\left(x + \left(x \cdot x + 0\right) \cdot \frac{1}{1 + \mathsf{hypot}\left(x, 1\right)}\right) \]

    *-commutative [<=]15.8

    \[ \mathsf{log1p}\left(x + \color{blue}{\frac{1}{1 + \mathsf{hypot}\left(x, 1\right)} \cdot \left(x \cdot x + 0\right)}\right) \]

    associate-*l/ [=>]15.8

    \[ \mathsf{log1p}\left(x + \color{blue}{\frac{1 \cdot \left(x \cdot x + 0\right)}{1 + \mathsf{hypot}\left(x, 1\right)}}\right) \]

    +-rgt-identity [=>]15.8

    \[ \mathsf{log1p}\left(x + \frac{1 \cdot \color{blue}{\left(x \cdot x\right)}}{1 + \mathsf{hypot}\left(x, 1\right)}\right) \]

    *-lft-identity [=>]15.8

    \[ \mathsf{log1p}\left(x + \frac{\color{blue}{x \cdot x}}{1 + \mathsf{hypot}\left(x, 1\right)}\right) \]

    associate-/l* [=>]0.0

    \[ \mathsf{log1p}\left(x + \color{blue}{\frac{x}{\frac{1 + \mathsf{hypot}\left(x, 1\right)}{x}}}\right) \]
  5. Final simplification0.0

    \[\leadsto \mathsf{log1p}\left(x + \frac{x}{\frac{1 + \mathsf{hypot}\left(x, 1\right)}{x}}\right) \]

Alternatives

Alternative 1
Error0.3
Cost13184
\[\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(x, 1\right) + -1\right)\right) \]
Alternative 2
Error0.2
Cost7364
\[\begin{array}{l} \mathbf{if}\;x \leq 1.3:\\ \;\;\;\;\mathsf{log1p}\left(x + \frac{x}{\frac{2 + 0.5 \cdot \left(x \cdot x\right)}{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + \left(x + \frac{0.5}{x}\right)\right)\\ \end{array} \]
Alternative 3
Error0.8
Cost7232
\[\mathsf{log1p}\left(x + \frac{x}{\frac{\frac{0.5}{x} + \left(x + 1\right)}{x}}\right) \]
Alternative 4
Error0.3
Cost6980
\[\begin{array}{l} \mathbf{if}\;x \leq 0.95:\\ \;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + \left(x + \frac{0.5}{x}\right)\right)\\ \end{array} \]
Alternative 5
Error0.4
Cost6916
\[\begin{array}{l} \mathbf{if}\;x \leq 1.25:\\ \;\;\;\;x + -0.16666666666666666 \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\log \left(x \cdot 2\right)\\ \end{array} \]
Alternative 6
Error0.5
Cost6724
\[\begin{array}{l} \mathbf{if}\;x \leq 1.25:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\log \left(x \cdot 2\right)\\ \end{array} \]
Alternative 7
Error22.6
Cost6464
\[\mathsf{log1p}\left(x\right) \]
Alternative 8
Error30.6
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 1 
(FPCore (x)
  :name "log1p(x + hypot(x,1) -1 )"
  :precision binary64
  :pre (and (<= 0.0 x) (<= x 1.79e+308))
  (log1p (- (+ x (hypot x 1.0)) 1.0)))