Alternative 1 | |
---|---|
Error | 0.3 |
Cost | 13184 |
\[\mathsf{log1p}\left(x + \left(\mathsf{hypot}\left(x, 1\right) + -1\right)\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)
Results
Initial program 29.3
Simplified0.3
[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)
\] |
Applied egg-rr15.8
Simplified0.0
[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)
\] |
Final simplification0.0
Alternative 1 | |
---|---|
Error | 0.3 |
Cost | 13184 |
Alternative 2 | |
---|---|
Error | 0.2 |
Cost | 7364 |
Alternative 3 | |
---|---|
Error | 0.8 |
Cost | 7232 |
Alternative 4 | |
---|---|
Error | 0.3 |
Cost | 6980 |
Alternative 5 | |
---|---|
Error | 0.4 |
Cost | 6916 |
Alternative 6 | |
---|---|
Error | 0.5 |
Cost | 6724 |
Alternative 7 | |
---|---|
Error | 22.6 |
Cost | 6464 |
Alternative 8 | |
---|---|
Error | 30.6 |
Cost | 64 |
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)))