
(FPCore (x) :precision binary64 (log (+ x (sqrt (+ (* x x) 1.0)))))
double code(double x) {
return log((x + sqrt(((x * x) + 1.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = log((x + sqrt(((x * x) + 1.0d0))))
end function
public static double code(double x) {
return Math.log((x + Math.sqrt(((x * x) + 1.0))));
}
def code(x): return math.log((x + math.sqrt(((x * x) + 1.0))))
function code(x) return log(Float64(x + sqrt(Float64(Float64(x * x) + 1.0)))) end
function tmp = code(x) tmp = log((x + sqrt(((x * x) + 1.0)))); end
code[x_] := N[Log[N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + \sqrt{x \cdot x + 1}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (log (+ x (sqrt (+ (* x x) 1.0)))))
double code(double x) {
return log((x + sqrt(((x * x) + 1.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = log((x + sqrt(((x * x) + 1.0d0))))
end function
public static double code(double x) {
return Math.log((x + Math.sqrt(((x * x) + 1.0))));
}
def code(x): return math.log((x + math.sqrt(((x * x) + 1.0))))
function code(x) return log(Float64(x + sqrt(Float64(Float64(x * x) + 1.0)))) end
function tmp = code(x) tmp = log((x + sqrt(((x * x) + 1.0)))); end
code[x_] := N[Log[N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\log \left(x + \sqrt{x \cdot x + 1}\right)
\end{array}
(FPCore (x)
:precision binary64
(if (<= x -0.05)
(- (log1p (+ (hypot 1.0 x) (- -1.0 x))))
(if (<= x 0.022)
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (pow x 2.0) (+ 0.075 (* (pow x 2.0) -0.044642857142857144)))
0.16666666666666666))))
(log1p (+ (hypot 1.0 x) (* x (- 1.0 (/ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= -0.05) {
tmp = -log1p((hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.022) {
tmp = x * (1.0 + (pow(x, 2.0) * ((pow(x, 2.0) * (0.075 + (pow(x, 2.0) * -0.044642857142857144))) - 0.16666666666666666)));
} else {
tmp = log1p((hypot(1.0, x) + (x * (1.0 - (1.0 / x)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.05) {
tmp = -Math.log1p((Math.hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.022) {
tmp = x * (1.0 + (Math.pow(x, 2.0) * ((Math.pow(x, 2.0) * (0.075 + (Math.pow(x, 2.0) * -0.044642857142857144))) - 0.16666666666666666)));
} else {
tmp = Math.log1p((Math.hypot(1.0, x) + (x * (1.0 - (1.0 / x)))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.05: tmp = -math.log1p((math.hypot(1.0, x) + (-1.0 - x))) elif x <= 0.022: tmp = x * (1.0 + (math.pow(x, 2.0) * ((math.pow(x, 2.0) * (0.075 + (math.pow(x, 2.0) * -0.044642857142857144))) - 0.16666666666666666))) else: tmp = math.log1p((math.hypot(1.0, x) + (x * (1.0 - (1.0 / x))))) return tmp
function code(x) tmp = 0.0 if (x <= -0.05) tmp = Float64(-log1p(Float64(hypot(1.0, x) + Float64(-1.0 - x)))); elseif (x <= 0.022) tmp = Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64((x ^ 2.0) * Float64(0.075 + Float64((x ^ 2.0) * -0.044642857142857144))) - 0.16666666666666666)))); else tmp = log1p(Float64(hypot(1.0, x) + Float64(x * Float64(1.0 - Float64(1.0 / x))))); end return tmp end
code[x_] := If[LessEqual[x, -0.05], (-N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[x, 0.022], N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[Power[x, 2.0], $MachinePrecision] * N[(0.075 + N[(N[Power[x, 2.0], $MachinePrecision] * -0.044642857142857144), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(x * N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.05:\\
\;\;\;\;-\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + \left(-1 - x\right)\right)\\
\mathbf{elif}\;x \leq 0.022:\\
\;\;\;\;x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + {x}^{2} \cdot -0.044642857142857144\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + x \cdot \left(1 - \frac{1}{x}\right)\right)\\
\end{array}
\end{array}
if x < -0.050000000000000003Initial program 5.1%
flip-+4.8%
frac-2neg4.8%
log-div4.8%
add-sqr-sqrt4.8%
pow24.8%
fma-define4.8%
+-commutative4.8%
hypot-1-def4.8%
Applied egg-rr4.8%
fma-undefine4.8%
unpow24.8%
associate--r+49.0%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
Simplified99.9%
add-sqr-sqrt99.1%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod0.0%
add-sqr-sqrt1.5%
log1p-expm1-u0.7%
add-sqr-sqrt0.0%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod99.1%
add-sqr-sqrt99.9%
expm1-undefine99.9%
add-exp-log99.9%
Applied egg-rr99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l-100.0%
Simplified100.0%
if -0.050000000000000003 < x < 0.021999999999999999Initial program 9.9%
Taylor expanded in x around 0 100.0%
if 0.021999999999999999 < x Initial program 57.7%
add-sqr-sqrt57.7%
pow257.7%
log-pow57.8%
+-commutative57.8%
hypot-1-def100.0%
Applied egg-rr100.0%
log1p-expm1-u100.0%
log1p-undefine99.9%
expm1-undefine99.9%
*-commutative99.9%
exp-to-pow99.9%
pow299.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
log1p-define99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(if (<= x -0.014)
(- (log1p (+ (hypot 1.0 x) (- -1.0 x))))
(if (<= x 0.0138)
(log1p
(*
x
(+ 1.0 (* x (+ 0.5 (* (pow x 2.0) (- (* (pow x 2.0) 0.0625) 0.125)))))))
(log1p (+ (hypot 1.0 x) (* x (- 1.0 (/ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= -0.014) {
tmp = -log1p((hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.0138) {
tmp = log1p((x * (1.0 + (x * (0.5 + (pow(x, 2.0) * ((pow(x, 2.0) * 0.0625) - 0.125)))))));
} else {
tmp = log1p((hypot(1.0, x) + (x * (1.0 - (1.0 / x)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.014) {
tmp = -Math.log1p((Math.hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.0138) {
tmp = Math.log1p((x * (1.0 + (x * (0.5 + (Math.pow(x, 2.0) * ((Math.pow(x, 2.0) * 0.0625) - 0.125)))))));
} else {
tmp = Math.log1p((Math.hypot(1.0, x) + (x * (1.0 - (1.0 / x)))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.014: tmp = -math.log1p((math.hypot(1.0, x) + (-1.0 - x))) elif x <= 0.0138: tmp = math.log1p((x * (1.0 + (x * (0.5 + (math.pow(x, 2.0) * ((math.pow(x, 2.0) * 0.0625) - 0.125))))))) else: tmp = math.log1p((math.hypot(1.0, x) + (x * (1.0 - (1.0 / x))))) return tmp
function code(x) tmp = 0.0 if (x <= -0.014) tmp = Float64(-log1p(Float64(hypot(1.0, x) + Float64(-1.0 - x)))); elseif (x <= 0.0138) tmp = log1p(Float64(x * Float64(1.0 + Float64(x * Float64(0.5 + Float64((x ^ 2.0) * Float64(Float64((x ^ 2.0) * 0.0625) - 0.125))))))); else tmp = log1p(Float64(hypot(1.0, x) + Float64(x * Float64(1.0 - Float64(1.0 / x))))); end return tmp end
code[x_] := If[LessEqual[x, -0.014], (-N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[x, 0.0138], N[Log[1 + N[(x * N[(1.0 + N[(x * N[(0.5 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[Power[x, 2.0], $MachinePrecision] * 0.0625), $MachinePrecision] - 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(x * N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.014:\\
\;\;\;\;-\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + \left(-1 - x\right)\right)\\
\mathbf{elif}\;x \leq 0.0138:\\
\;\;\;\;\mathsf{log1p}\left(x \cdot \left(1 + x \cdot \left(0.5 + {x}^{2} \cdot \left({x}^{2} \cdot 0.0625 - 0.125\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + x \cdot \left(1 - \frac{1}{x}\right)\right)\\
\end{array}
\end{array}
if x < -0.0140000000000000003Initial program 5.1%
flip-+4.8%
frac-2neg4.8%
log-div4.8%
add-sqr-sqrt4.8%
pow24.8%
fma-define4.8%
+-commutative4.8%
hypot-1-def4.8%
Applied egg-rr4.8%
fma-undefine4.8%
unpow24.8%
associate--r+49.0%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
Simplified99.9%
add-sqr-sqrt99.1%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod0.0%
add-sqr-sqrt1.5%
log1p-expm1-u0.7%
add-sqr-sqrt0.0%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod99.1%
add-sqr-sqrt99.9%
expm1-undefine99.9%
add-exp-log99.9%
Applied egg-rr99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l-100.0%
Simplified100.0%
if -0.0140000000000000003 < x < 0.0138Initial program 9.9%
add-sqr-sqrt9.9%
pow29.9%
log-pow9.9%
+-commutative9.9%
hypot-1-def9.8%
Applied egg-rr9.8%
log1p-expm1-u9.8%
log1p-undefine9.8%
expm1-undefine9.8%
*-commutative9.8%
exp-to-pow9.8%
pow29.8%
add-sqr-sqrt9.9%
Applied egg-rr9.9%
log1p-define9.9%
sub-neg9.9%
+-commutative9.9%
metadata-eval9.9%
associate-+l+9.8%
Simplified9.8%
Taylor expanded in x around 0 99.9%
if 0.0138 < x Initial program 57.7%
add-sqr-sqrt57.7%
pow257.7%
log-pow57.8%
+-commutative57.8%
hypot-1-def100.0%
Applied egg-rr100.0%
log1p-expm1-u100.0%
log1p-undefine99.9%
expm1-undefine99.9%
*-commutative99.9%
exp-to-pow99.9%
pow299.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
log1p-define99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
Final simplification100.0%
(FPCore (x)
:precision binary64
(if (<= x -0.0072)
(- (log1p (+ (hypot 1.0 x) (- -1.0 x))))
(if (<= x 0.007)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log1p (+ (hypot 1.0 x) (* x (- 1.0 (/ 1.0 x))))))))
double code(double x) {
double tmp;
if (x <= -0.0072) {
tmp = -log1p((hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.007) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log1p((hypot(1.0, x) + (x * (1.0 - (1.0 / x)))));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.0072) {
tmp = -Math.log1p((Math.hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.007) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log1p((Math.hypot(1.0, x) + (x * (1.0 - (1.0 / x)))));
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.0072: tmp = -math.log1p((math.hypot(1.0, x) + (-1.0 - x))) elif x <= 0.007: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log1p((math.hypot(1.0, x) + (x * (1.0 - (1.0 / x))))) return tmp
function code(x) tmp = 0.0 if (x <= -0.0072) tmp = Float64(-log1p(Float64(hypot(1.0, x) + Float64(-1.0 - x)))); elseif (x <= 0.007) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log1p(Float64(hypot(1.0, x) + Float64(x * Float64(1.0 - Float64(1.0 / x))))); end return tmp end
code[x_] := If[LessEqual[x, -0.0072], (-N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[x, 0.007], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(x * N[(1.0 - N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0072:\\
\;\;\;\;-\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + \left(-1 - x\right)\right)\\
\mathbf{elif}\;x \leq 0.007:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + x \cdot \left(1 - \frac{1}{x}\right)\right)\\
\end{array}
\end{array}
if x < -0.0071999999999999998Initial program 5.1%
flip-+4.8%
frac-2neg4.8%
log-div4.8%
add-sqr-sqrt4.8%
pow24.8%
fma-define4.8%
+-commutative4.8%
hypot-1-def4.8%
Applied egg-rr4.8%
fma-undefine4.8%
unpow24.8%
associate--r+49.0%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
Simplified99.9%
add-sqr-sqrt99.1%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod0.0%
add-sqr-sqrt1.5%
log1p-expm1-u0.7%
add-sqr-sqrt0.0%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod99.1%
add-sqr-sqrt99.9%
expm1-undefine99.9%
add-exp-log99.9%
Applied egg-rr99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l-100.0%
Simplified100.0%
if -0.0071999999999999998 < x < 0.00700000000000000015Initial program 9.9%
Taylor expanded in x around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
if 0.00700000000000000015 < x Initial program 57.7%
add-sqr-sqrt57.7%
pow257.7%
log-pow57.8%
+-commutative57.8%
hypot-1-def100.0%
Applied egg-rr100.0%
log1p-expm1-u100.0%
log1p-undefine99.9%
expm1-undefine99.9%
*-commutative99.9%
exp-to-pow99.9%
pow299.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
log1p-define99.9%
sub-neg99.9%
+-commutative99.9%
metadata-eval99.9%
associate-+l+99.9%
Simplified99.9%
Taylor expanded in x around inf 100.0%
Final simplification99.9%
(FPCore (x)
:precision binary64
(if (<= x -0.0072)
(- (log1p (+ (hypot 1.0 x) (- -1.0 x))))
(if (<= x 0.0075)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log (+ x (hypot 1.0 x))))))
double code(double x) {
double tmp;
if (x <= -0.0072) {
tmp = -log1p((hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.0075) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log((x + hypot(1.0, x)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.0072) {
tmp = -Math.log1p((Math.hypot(1.0, x) + (-1.0 - x)));
} else if (x <= 0.0075) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log((x + Math.hypot(1.0, x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.0072: tmp = -math.log1p((math.hypot(1.0, x) + (-1.0 - x))) elif x <= 0.0075: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log((x + math.hypot(1.0, x))) return tmp
function code(x) tmp = 0.0 if (x <= -0.0072) tmp = Float64(-log1p(Float64(hypot(1.0, x) + Float64(-1.0 - x)))); elseif (x <= 0.0075) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log(Float64(x + hypot(1.0, x))); end return tmp end
code[x_] := If[LessEqual[x, -0.0072], (-N[Log[1 + N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[x, 0.0075], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0072:\\
\;\;\;\;-\mathsf{log1p}\left(\mathsf{hypot}\left(1, x\right) + \left(-1 - x\right)\right)\\
\mathbf{elif}\;x \leq 0.0075:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\
\end{array}
\end{array}
if x < -0.0071999999999999998Initial program 5.1%
flip-+4.8%
frac-2neg4.8%
log-div4.8%
add-sqr-sqrt4.8%
pow24.8%
fma-define4.8%
+-commutative4.8%
hypot-1-def4.8%
Applied egg-rr4.8%
fma-undefine4.8%
unpow24.8%
associate--r+49.0%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
Simplified99.9%
add-sqr-sqrt99.1%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod0.0%
add-sqr-sqrt1.5%
log1p-expm1-u0.7%
add-sqr-sqrt0.0%
sqrt-unprod99.9%
sqr-neg99.9%
sqrt-unprod99.1%
add-sqr-sqrt99.9%
expm1-undefine99.9%
add-exp-log99.9%
Applied egg-rr99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l-100.0%
Simplified100.0%
if -0.0071999999999999998 < x < 0.0074999999999999997Initial program 9.9%
Taylor expanded in x around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
if 0.0074999999999999997 < x Initial program 57.7%
sqr-neg57.7%
+-commutative57.7%
sqr-neg57.7%
hypot-1-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x)
:precision binary64
(if (<= x -0.0068)
(- (log (- (hypot 1.0 x) x)))
(if (<= x 0.0075)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log (+ x (hypot 1.0 x))))))
double code(double x) {
double tmp;
if (x <= -0.0068) {
tmp = -log((hypot(1.0, x) - x));
} else if (x <= 0.0075) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log((x + hypot(1.0, x)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.0068) {
tmp = -Math.log((Math.hypot(1.0, x) - x));
} else if (x <= 0.0075) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log((x + Math.hypot(1.0, x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.0068: tmp = -math.log((math.hypot(1.0, x) - x)) elif x <= 0.0075: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log((x + math.hypot(1.0, x))) return tmp
function code(x) tmp = 0.0 if (x <= -0.0068) tmp = Float64(-log(Float64(hypot(1.0, x) - x))); elseif (x <= 0.0075) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log(Float64(x + hypot(1.0, x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -0.0068) tmp = -log((hypot(1.0, x) - x)); elseif (x <= 0.0075) tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))); else tmp = log((x + hypot(1.0, x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -0.0068], (-N[Log[N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision]), If[LessEqual[x, 0.0075], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0068:\\
\;\;\;\;-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\\
\mathbf{elif}\;x \leq 0.0075:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\
\end{array}
\end{array}
if x < -0.00679999999999999962Initial program 5.1%
flip-+4.8%
frac-2neg4.8%
log-div4.8%
add-sqr-sqrt4.8%
pow24.8%
fma-define4.8%
+-commutative4.8%
hypot-1-def4.8%
Applied egg-rr4.8%
fma-undefine4.8%
unpow24.8%
associate--r+49.0%
+-inverses99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
neg-sub099.9%
associate--r-99.9%
neg-sub099.9%
+-commutative99.9%
sub-neg99.9%
neg-sub099.9%
Simplified99.9%
if -0.00679999999999999962 < x < 0.0074999999999999997Initial program 9.9%
Taylor expanded in x around 0 99.9%
unpow299.9%
Applied egg-rr99.9%
unpow299.9%
Applied egg-rr99.9%
if 0.0074999999999999997 < x Initial program 57.7%
sqr-neg57.7%
+-commutative57.7%
sqr-neg57.7%
hypot-1-def99.9%
Simplified99.9%
(FPCore (x)
:precision binary64
(if (<= x -1.3)
(log (/ -0.5 x))
(if (<= x 0.0075)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log (+ x (hypot 1.0 x))))))
double code(double x) {
double tmp;
if (x <= -1.3) {
tmp = log((-0.5 / x));
} else if (x <= 0.0075) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log((x + hypot(1.0, x)));
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -1.3) {
tmp = Math.log((-0.5 / x));
} else if (x <= 0.0075) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log((x + Math.hypot(1.0, x)));
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.3: tmp = math.log((-0.5 / x)) elif x <= 0.0075: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log((x + math.hypot(1.0, x))) return tmp
function code(x) tmp = 0.0 if (x <= -1.3) tmp = log(Float64(-0.5 / x)); elseif (x <= 0.0075) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log(Float64(x + hypot(1.0, x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.3) tmp = log((-0.5 / x)); elseif (x <= 0.0075) tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))); else tmp = log((x + hypot(1.0, x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.3], N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 0.0075], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3:\\
\;\;\;\;\log \left(\frac{-0.5}{x}\right)\\
\mathbf{elif}\;x \leq 0.0075:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + \mathsf{hypot}\left(1, x\right)\right)\\
\end{array}
\end{array}
if x < -1.30000000000000004Initial program 3.5%
Taylor expanded in x around -inf 98.7%
if -1.30000000000000004 < x < 0.0074999999999999997Initial program 10.6%
Taylor expanded in x around 0 99.5%
unpow299.5%
Applied egg-rr99.5%
unpow299.5%
Applied egg-rr99.5%
if 0.0074999999999999997 < x Initial program 57.7%
sqr-neg57.7%
+-commutative57.7%
sqr-neg57.7%
hypot-1-def99.9%
Simplified99.9%
(FPCore (x)
:precision binary64
(if (<= x -1.3)
(log (/ -0.5 x))
(if (<= x 1.3)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log (+ x x)))))
double code(double x) {
double tmp;
if (x <= -1.3) {
tmp = log((-0.5 / x));
} else if (x <= 1.3) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log((x + x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.3d0)) then
tmp = log(((-0.5d0) / x))
else if (x <= 1.3d0) then
tmp = x * (1.0d0 + ((x * x) * ((0.075d0 * (x * x)) - 0.16666666666666666d0)))
else
tmp = log((x + x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -1.3) {
tmp = Math.log((-0.5 / x));
} else if (x <= 1.3) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log((x + x));
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.3: tmp = math.log((-0.5 / x)) elif x <= 1.3: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log((x + x)) return tmp
function code(x) tmp = 0.0 if (x <= -1.3) tmp = log(Float64(-0.5 / x)); elseif (x <= 1.3) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log(Float64(x + x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.3) tmp = log((-0.5 / x)); elseif (x <= 1.3) tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))); else tmp = log((x + x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.3], N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.3], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(x + x), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3:\\
\;\;\;\;\log \left(\frac{-0.5}{x}\right)\\
\mathbf{elif}\;x \leq 1.3:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + x\right)\\
\end{array}
\end{array}
if x < -1.30000000000000004Initial program 3.5%
Taylor expanded in x around -inf 98.7%
if -1.30000000000000004 < x < 1.30000000000000004Initial program 11.3%
Taylor expanded in x around 0 99.2%
unpow299.2%
Applied egg-rr99.2%
unpow299.2%
Applied egg-rr99.2%
if 1.30000000000000004 < x Initial program 57.2%
Taylor expanded in x around inf 98.7%
(FPCore (x)
:precision binary64
(if (<= x -3.6)
-42.666666666666664
(if (<= x 1.3)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log (+ x x)))))
double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 1.3) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log((x + x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.6d0)) then
tmp = -42.666666666666664d0
else if (x <= 1.3d0) then
tmp = x * (1.0d0 + ((x * x) * ((0.075d0 * (x * x)) - 0.16666666666666666d0)))
else
tmp = log((x + x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 1.3) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log((x + x));
}
return tmp;
}
def code(x): tmp = 0 if x <= -3.6: tmp = -42.666666666666664 elif x <= 1.3: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log((x + x)) return tmp
function code(x) tmp = 0.0 if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 1.3) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log(Float64(x + x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 1.3) tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))); else tmp = log((x + x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -3.6], -42.666666666666664, If[LessEqual[x, 1.3], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(x + x), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6:\\
\;\;\;\;-42.666666666666664\\
\mathbf{elif}\;x \leq 1.3:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + x\right)\\
\end{array}
\end{array}
if x < -3.60000000000000009Initial program 1.8%
add-sqr-sqrt1.8%
pow21.8%
log-pow1.8%
+-commutative1.8%
hypot-1-def3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in x around -inf 1.5%
Simplified17.2%
if -3.60000000000000009 < x < 1.30000000000000004Initial program 12.0%
Taylor expanded in x around 0 98.5%
unpow298.5%
Applied egg-rr98.5%
unpow298.5%
Applied egg-rr98.5%
if 1.30000000000000004 < x Initial program 57.2%
Taylor expanded in x around inf 98.7%
(FPCore (x)
:precision binary64
(if (<= x -3.6)
-42.666666666666664
(if (<= x 1.55)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log (+ x 1.0)))))
double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 1.55) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log((x + 1.0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.6d0)) then
tmp = -42.666666666666664d0
else if (x <= 1.55d0) then
tmp = x * (1.0d0 + ((x * x) * ((0.075d0 * (x * x)) - 0.16666666666666666d0)))
else
tmp = log((x + 1.0d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 1.55) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log((x + 1.0));
}
return tmp;
}
def code(x): tmp = 0 if x <= -3.6: tmp = -42.666666666666664 elif x <= 1.55: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log((x + 1.0)) return tmp
function code(x) tmp = 0.0 if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 1.55) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log(Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 1.55) tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))); else tmp = log((x + 1.0)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -3.6], -42.666666666666664, If[LessEqual[x, 1.55], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6:\\
\;\;\;\;-42.666666666666664\\
\mathbf{elif}\;x \leq 1.55:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + 1\right)\\
\end{array}
\end{array}
if x < -3.60000000000000009Initial program 1.8%
add-sqr-sqrt1.8%
pow21.8%
log-pow1.8%
+-commutative1.8%
hypot-1-def3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in x around -inf 1.5%
Simplified17.2%
if -3.60000000000000009 < x < 1.55000000000000004Initial program 12.0%
Taylor expanded in x around 0 98.5%
unpow298.5%
Applied egg-rr98.5%
unpow298.5%
Applied egg-rr98.5%
if 1.55000000000000004 < x Initial program 57.2%
Taylor expanded in x around 0 31.2%
(FPCore (x)
:precision binary64
(if (<= x -3.6)
-42.666666666666664
(if (<= x 1.55)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
(log1p x))))
double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 1.55) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = log1p(x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 1.55) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = Math.log1p(x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -3.6: tmp = -42.666666666666664 elif x <= 1.55: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = math.log1p(x) return tmp
function code(x) tmp = 0.0 if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 1.55) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = log1p(x); end return tmp end
code[x_] := If[LessEqual[x, -3.6], -42.666666666666664, If[LessEqual[x, 1.55], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Log[1 + x], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6:\\
\;\;\;\;-42.666666666666664\\
\mathbf{elif}\;x \leq 1.55:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(x\right)\\
\end{array}
\end{array}
if x < -3.60000000000000009Initial program 1.8%
add-sqr-sqrt1.8%
pow21.8%
log-pow1.8%
+-commutative1.8%
hypot-1-def3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in x around -inf 1.5%
Simplified17.2%
if -3.60000000000000009 < x < 1.55000000000000004Initial program 12.0%
Taylor expanded in x around 0 98.5%
unpow298.5%
Applied egg-rr98.5%
unpow298.5%
Applied egg-rr98.5%
if 1.55000000000000004 < x Initial program 57.2%
Taylor expanded in x around 0 31.2%
*-un-lft-identity31.2%
log-prod31.2%
metadata-eval31.2%
+-commutative31.2%
log1p-define31.2%
Applied egg-rr31.2%
+-lft-identity31.2%
Simplified31.2%
(FPCore (x)
:precision binary64
(if (<= x -3.6)
-42.666666666666664
(if (<= x 3.6)
(* x (+ 1.0 (* (* x x) (- (* 0.075 (* x x)) 0.16666666666666666))))
43.666666666666664)))
double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 3.6) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = 43.666666666666664;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-3.6d0)) then
tmp = -42.666666666666664d0
else if (x <= 3.6d0) then
tmp = x * (1.0d0 + ((x * x) * ((0.075d0 * (x * x)) - 0.16666666666666666d0)))
else
tmp = 43.666666666666664d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -3.6) {
tmp = -42.666666666666664;
} else if (x <= 3.6) {
tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666)));
} else {
tmp = 43.666666666666664;
}
return tmp;
}
def code(x): tmp = 0 if x <= -3.6: tmp = -42.666666666666664 elif x <= 3.6: tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))) else: tmp = 43.666666666666664 return tmp
function code(x) tmp = 0.0 if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 3.6) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * Float64(Float64(0.075 * Float64(x * x)) - 0.16666666666666666)))); else tmp = 43.666666666666664; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -3.6) tmp = -42.666666666666664; elseif (x <= 3.6) tmp = x * (1.0 + ((x * x) * ((0.075 * (x * x)) - 0.16666666666666666))); else tmp = 43.666666666666664; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -3.6], -42.666666666666664, If[LessEqual[x, 3.6], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * N[(N[(0.075 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 43.666666666666664]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6:\\
\;\;\;\;-42.666666666666664\\
\mathbf{elif}\;x \leq 3.6:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot \left(0.075 \cdot \left(x \cdot x\right) - 0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;43.666666666666664\\
\end{array}
\end{array}
if x < -3.60000000000000009Initial program 1.8%
add-sqr-sqrt1.8%
pow21.8%
log-pow1.8%
+-commutative1.8%
hypot-1-def3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in x around -inf 1.5%
Simplified17.2%
if -3.60000000000000009 < x < 3.60000000000000009Initial program 12.0%
Taylor expanded in x around 0 98.5%
unpow298.5%
Applied egg-rr98.5%
unpow298.5%
Applied egg-rr98.5%
if 3.60000000000000009 < x Initial program 57.2%
add-sqr-sqrt57.2%
pow257.2%
log-pow57.2%
+-commutative57.2%
hypot-1-def100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 11.2%
*-commutative11.2%
Simplified11.2%
Taylor expanded in x around inf 17.2%
Simplified16.8%
(FPCore (x)
:precision binary64
(if (<= x -2.4)
-42.666666666666664
(if (<= x 2.4)
(* x (+ 1.0 (* (* x x) -0.16666666666666666)))
43.666666666666664)))
double code(double x) {
double tmp;
if (x <= -2.4) {
tmp = -42.666666666666664;
} else if (x <= 2.4) {
tmp = x * (1.0 + ((x * x) * -0.16666666666666666));
} else {
tmp = 43.666666666666664;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-2.4d0)) then
tmp = -42.666666666666664d0
else if (x <= 2.4d0) then
tmp = x * (1.0d0 + ((x * x) * (-0.16666666666666666d0)))
else
tmp = 43.666666666666664d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -2.4) {
tmp = -42.666666666666664;
} else if (x <= 2.4) {
tmp = x * (1.0 + ((x * x) * -0.16666666666666666));
} else {
tmp = 43.666666666666664;
}
return tmp;
}
def code(x): tmp = 0 if x <= -2.4: tmp = -42.666666666666664 elif x <= 2.4: tmp = x * (1.0 + ((x * x) * -0.16666666666666666)) else: tmp = 43.666666666666664 return tmp
function code(x) tmp = 0.0 if (x <= -2.4) tmp = -42.666666666666664; elseif (x <= 2.4) tmp = Float64(x * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))); else tmp = 43.666666666666664; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -2.4) tmp = -42.666666666666664; elseif (x <= 2.4) tmp = x * (1.0 + ((x * x) * -0.16666666666666666)); else tmp = 43.666666666666664; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -2.4], -42.666666666666664, If[LessEqual[x, 2.4], N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 43.666666666666664]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4:\\
\;\;\;\;-42.666666666666664\\
\mathbf{elif}\;x \leq 2.4:\\
\;\;\;\;x \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;43.666666666666664\\
\end{array}
\end{array}
if x < -2.39999999999999991Initial program 1.8%
add-sqr-sqrt1.8%
pow21.8%
log-pow1.8%
+-commutative1.8%
hypot-1-def3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in x around -inf 1.5%
Simplified17.2%
if -2.39999999999999991 < x < 2.39999999999999991Initial program 12.0%
Taylor expanded in x around 0 98.5%
unpow298.5%
Applied egg-rr98.5%
unpow298.5%
Applied egg-rr98.5%
Taylor expanded in x around 0 98.0%
if 2.39999999999999991 < x Initial program 57.2%
add-sqr-sqrt57.2%
pow257.2%
log-pow57.2%
+-commutative57.2%
hypot-1-def100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 11.2%
*-commutative11.2%
Simplified11.2%
Taylor expanded in x around inf 17.2%
Simplified16.8%
(FPCore (x) :precision binary64 (if (<= x -44.0) -42.666666666666664 (if (<= x 43.0) x 43.666666666666664)))
double code(double x) {
double tmp;
if (x <= -44.0) {
tmp = -42.666666666666664;
} else if (x <= 43.0) {
tmp = x;
} else {
tmp = 43.666666666666664;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-44.0d0)) then
tmp = -42.666666666666664d0
else if (x <= 43.0d0) then
tmp = x
else
tmp = 43.666666666666664d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -44.0) {
tmp = -42.666666666666664;
} else if (x <= 43.0) {
tmp = x;
} else {
tmp = 43.666666666666664;
}
return tmp;
}
def code(x): tmp = 0 if x <= -44.0: tmp = -42.666666666666664 elif x <= 43.0: tmp = x else: tmp = 43.666666666666664 return tmp
function code(x) tmp = 0.0 if (x <= -44.0) tmp = -42.666666666666664; elseif (x <= 43.0) tmp = x; else tmp = 43.666666666666664; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -44.0) tmp = -42.666666666666664; elseif (x <= 43.0) tmp = x; else tmp = 43.666666666666664; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -44.0], -42.666666666666664, If[LessEqual[x, 43.0], x, 43.666666666666664]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -44:\\
\;\;\;\;-42.666666666666664\\
\mathbf{elif}\;x \leq 43:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;43.666666666666664\\
\end{array}
\end{array}
if x < -44Initial program 1.8%
add-sqr-sqrt1.8%
pow21.8%
log-pow1.8%
+-commutative1.8%
hypot-1-def3.1%
Applied egg-rr3.1%
Taylor expanded in x around 0 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in x around -inf 1.5%
Simplified17.2%
if -44 < x < 43Initial program 12.7%
Taylor expanded in x around 0 97.9%
Taylor expanded in x around 0 96.1%
if 43 < x Initial program 56.7%
add-sqr-sqrt56.7%
pow256.7%
log-pow56.7%
+-commutative56.7%
hypot-1-def100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 11.1%
*-commutative11.1%
Simplified11.1%
Taylor expanded in x around inf 17.2%
Simplified16.9%
(FPCore (x) :precision binary64 (if (<= x 5e-311) -42.666666666666664 43.666666666666664))
double code(double x) {
double tmp;
if (x <= 5e-311) {
tmp = -42.666666666666664;
} else {
tmp = 43.666666666666664;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 5d-311) then
tmp = -42.666666666666664d0
else
tmp = 43.666666666666664d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 5e-311) {
tmp = -42.666666666666664;
} else {
tmp = 43.666666666666664;
}
return tmp;
}
def code(x): tmp = 0 if x <= 5e-311: tmp = -42.666666666666664 else: tmp = 43.666666666666664 return tmp
function code(x) tmp = 0.0 if (x <= 5e-311) tmp = -42.666666666666664; else tmp = 43.666666666666664; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 5e-311) tmp = -42.666666666666664; else tmp = 43.666666666666664; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 5e-311], -42.666666666666664, 43.666666666666664]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-311}:\\
\;\;\;\;-42.666666666666664\\
\mathbf{else}:\\
\;\;\;\;43.666666666666664\\
\end{array}
\end{array}
if x < 5.00000000000023e-311Initial program 7.3%
add-sqr-sqrt7.3%
pow27.3%
log-pow7.3%
+-commutative7.3%
hypot-1-def7.8%
Applied egg-rr7.8%
Taylor expanded in x around 0 5.5%
*-commutative5.5%
Simplified5.5%
Taylor expanded in x around -inf 1.4%
Simplified10.7%
if 5.00000000000023e-311 < x Initial program 38.6%
add-sqr-sqrt38.5%
pow238.5%
log-pow38.6%
+-commutative38.6%
hypot-1-def63.5%
Applied egg-rr63.5%
Taylor expanded in x around 0 10.9%
*-commutative10.9%
Simplified10.9%
Taylor expanded in x around inf 10.8%
Simplified12.2%
(FPCore (x) :precision binary64 (if (<= x -1.1e-308) -42.666666666666664 21.333333333333332))
double code(double x) {
double tmp;
if (x <= -1.1e-308) {
tmp = -42.666666666666664;
} else {
tmp = 21.333333333333332;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-1.1d-308)) then
tmp = -42.666666666666664d0
else
tmp = 21.333333333333332d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -1.1e-308) {
tmp = -42.666666666666664;
} else {
tmp = 21.333333333333332;
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.1e-308: tmp = -42.666666666666664 else: tmp = 21.333333333333332 return tmp
function code(x) tmp = 0.0 if (x <= -1.1e-308) tmp = -42.666666666666664; else tmp = 21.333333333333332; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.1e-308) tmp = -42.666666666666664; else tmp = 21.333333333333332; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.1e-308], -42.666666666666664, 21.333333333333332]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-308}:\\
\;\;\;\;-42.666666666666664\\
\mathbf{else}:\\
\;\;\;\;21.333333333333332\\
\end{array}
\end{array}
if x < -1.1000000000000001e-308Initial program 7.3%
add-sqr-sqrt7.3%
pow27.3%
log-pow7.3%
+-commutative7.3%
hypot-1-def7.8%
Applied egg-rr7.8%
Taylor expanded in x around 0 5.5%
*-commutative5.5%
Simplified5.5%
Taylor expanded in x around -inf 1.4%
Simplified10.7%
if -1.1000000000000001e-308 < x Initial program 38.6%
add-sqr-sqrt38.5%
pow238.5%
log-pow38.6%
+-commutative38.6%
hypot-1-def63.5%
Applied egg-rr63.5%
Taylor expanded in x around 0 10.9%
*-commutative10.9%
Simplified10.9%
Taylor expanded in x around -inf 0.0%
Simplified11.7%
(FPCore (x) :precision binary64 (if (<= x -7e-308) -42.666666666666664 1.2083333333333333))
double code(double x) {
double tmp;
if (x <= -7e-308) {
tmp = -42.666666666666664;
} else {
tmp = 1.2083333333333333;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= (-7d-308)) then
tmp = -42.666666666666664d0
else
tmp = 1.2083333333333333d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= -7e-308) {
tmp = -42.666666666666664;
} else {
tmp = 1.2083333333333333;
}
return tmp;
}
def code(x): tmp = 0 if x <= -7e-308: tmp = -42.666666666666664 else: tmp = 1.2083333333333333 return tmp
function code(x) tmp = 0.0 if (x <= -7e-308) tmp = -42.666666666666664; else tmp = 1.2083333333333333; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -7e-308) tmp = -42.666666666666664; else tmp = 1.2083333333333333; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -7e-308], -42.666666666666664, 1.2083333333333333]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-308}:\\
\;\;\;\;-42.666666666666664\\
\mathbf{else}:\\
\;\;\;\;1.2083333333333333\\
\end{array}
\end{array}
if x < -7e-308Initial program 7.3%
add-sqr-sqrt7.3%
pow27.3%
log-pow7.3%
+-commutative7.3%
hypot-1-def7.8%
Applied egg-rr7.8%
Taylor expanded in x around 0 5.5%
*-commutative5.5%
Simplified5.5%
Taylor expanded in x around -inf 1.4%
Simplified10.7%
if -7e-308 < x Initial program 38.6%
add-sqr-sqrt38.5%
pow238.5%
log-pow38.6%
+-commutative38.6%
hypot-1-def63.5%
Applied egg-rr63.5%
log1p-expm1-u63.5%
log1p-undefine63.5%
expm1-undefine63.5%
*-commutative63.5%
exp-to-pow63.5%
pow263.5%
add-sqr-sqrt63.5%
Applied egg-rr63.5%
log1p-define63.5%
sub-neg63.5%
+-commutative63.5%
metadata-eval63.5%
associate-+l+63.4%
Simplified63.4%
Taylor expanded in x around inf 58.5%
Simplified10.7%
(FPCore (x) :precision binary64 -42.666666666666664)
double code(double x) {
return -42.666666666666664;
}
real(8) function code(x)
real(8), intent (in) :: x
code = -42.666666666666664d0
end function
public static double code(double x) {
return -42.666666666666664;
}
def code(x): return -42.666666666666664
function code(x) return -42.666666666666664 end
function tmp = code(x) tmp = -42.666666666666664; end
code[x_] := -42.666666666666664
\begin{array}{l}
\\
-42.666666666666664
\end{array}
Initial program 23.4%
add-sqr-sqrt23.4%
pow223.4%
log-pow23.4%
+-commutative23.4%
hypot-1-def36.5%
Applied egg-rr36.5%
Taylor expanded in x around 0 8.3%
*-commutative8.3%
Simplified8.3%
Taylor expanded in x around -inf 0.7%
Simplified6.1%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ (* x x) 1.0)))) (if (< x 0.0) (log (/ -1.0 (- x t_0))) (log (+ x t_0)))))
double code(double x) {
double t_0 = sqrt(((x * x) + 1.0));
double tmp;
if (x < 0.0) {
tmp = log((-1.0 / (x - t_0)));
} else {
tmp = log((x + t_0));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt(((x * x) + 1.0d0))
if (x < 0.0d0) then
tmp = log(((-1.0d0) / (x - t_0)))
else
tmp = log((x + t_0))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = Math.sqrt(((x * x) + 1.0));
double tmp;
if (x < 0.0) {
tmp = Math.log((-1.0 / (x - t_0)));
} else {
tmp = Math.log((x + t_0));
}
return tmp;
}
def code(x): t_0 = math.sqrt(((x * x) + 1.0)) tmp = 0 if x < 0.0: tmp = math.log((-1.0 / (x - t_0))) else: tmp = math.log((x + t_0)) return tmp
function code(x) t_0 = sqrt(Float64(Float64(x * x) + 1.0)) tmp = 0.0 if (x < 0.0) tmp = log(Float64(-1.0 / Float64(x - t_0))); else tmp = log(Float64(x + t_0)); end return tmp end
function tmp_2 = code(x) t_0 = sqrt(((x * x) + 1.0)); tmp = 0.0; if (x < 0.0) tmp = log((-1.0 / (x - t_0))); else tmp = log((x + t_0)); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]}, If[Less[x, 0.0], N[Log[N[(-1.0 / N[(x - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Log[N[(x + t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{x \cdot x + 1}\\
\mathbf{if}\;x < 0:\\
\;\;\;\;\log \left(\frac{-1}{x - t\_0}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + t\_0\right)\\
\end{array}
\end{array}
herbie shell --seed 2024131
(FPCore (x)
:name "Hyperbolic arcsine"
:precision binary64
:alt
(! :herbie-platform default (if (< x 0) (log (/ -1 (- x (sqrt (+ (* x x) 1))))) (log (+ x (sqrt (+ (* x x) 1))))))
(log (+ x (sqrt (+ (* x x) 1.0)))))