
(FPCore (x) :precision binary32 (acosh x))
float code(float x) {
return acoshf(x);
}
function code(x) return acosh(x) end
function tmp = code(x) tmp = acosh(x); end
\begin{array}{l}
\\
\cosh^{-1} x
\end{array}
Sampling outcomes in binary32 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary32 (log (+ x (sqrt (- (* x x) 1.0)))))
float code(float x) {
return logf((x + sqrtf(((x * x) - 1.0f))));
}
real(4) function code(x)
real(4), intent (in) :: x
code = log((x + sqrt(((x * x) - 1.0e0))))
end function
function code(x) return log(Float32(x + sqrt(Float32(Float32(x * x) - Float32(1.0))))) end
function tmp = code(x) tmp = log((x + sqrt(((x * x) - single(1.0))))); end
\begin{array}{l}
\\
\log \left(x + \sqrt{x \cdot x - 1}\right)
\end{array}
(FPCore (x) :precision binary32 (- (log (/ 0.5 x))))
float code(float x) {
return -logf((0.5f / x));
}
real(4) function code(x)
real(4), intent (in) :: x
code = -log((0.5e0 / x))
end function
function code(x) return Float32(-log(Float32(Float32(0.5) / x))) end
function tmp = code(x) tmp = -log((single(0.5) / x)); end
\begin{array}{l}
\\
-\log \left(\frac{0.5}{x}\right)
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
(FPCore (x) :precision binary32 (log (+ x x)))
float code(float x) {
return logf((x + x));
}
real(4) function code(x)
real(4), intent (in) :: x
code = log((x + x))
end function
function code(x) return log(Float32(x + x)) end
function tmp = code(x) tmp = log((x + x)); end
\begin{array}{l}
\\
\log \left(x + x\right)
\end{array}
Initial program 49.6%
Taylor expanded in x around inf 95.2%
(FPCore (x) :precision binary32 9.0)
float code(float x) {
return 9.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 9.0e0
end function
function code(x) return Float32(9.0) end
function tmp = code(x) tmp = single(9.0); end
\begin{array}{l}
\\
9
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr25.3%
(FPCore (x) :precision binary32 8.0)
float code(float x) {
return 8.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 8.0e0
end function
function code(x) return Float32(8.0) end
function tmp = code(x) tmp = single(8.0); end
\begin{array}{l}
\\
8
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr24.8%
(FPCore (x) :precision binary32 6.0)
float code(float x) {
return 6.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 6.0e0
end function
function code(x) return Float32(6.0) end
function tmp = code(x) tmp = single(6.0); end
\begin{array}{l}
\\
6
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr24.0%
(FPCore (x) :precision binary32 5.0)
float code(float x) {
return 5.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 5.0e0
end function
function code(x) return Float32(5.0) end
function tmp = code(x) tmp = single(5.0); end
\begin{array}{l}
\\
5
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr23.7%
(FPCore (x) :precision binary32 4.0)
float code(float x) {
return 4.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 4.0e0
end function
function code(x) return Float32(4.0) end
function tmp = code(x) tmp = single(4.0); end
\begin{array}{l}
\\
4
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr23.3%
(FPCore (x) :precision binary32 3.0)
float code(float x) {
return 3.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 3.0e0
end function
function code(x) return Float32(3.0) end
function tmp = code(x) tmp = single(3.0); end
\begin{array}{l}
\\
3
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr22.7%
(FPCore (x) :precision binary32 2.5)
float code(float x) {
return 2.5f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 2.5e0
end function
function code(x) return Float32(2.5) end
function tmp = code(x) tmp = single(2.5); end
\begin{array}{l}
\\
2.5
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr22.6%
(FPCore (x) :precision binary32 2.0)
float code(float x) {
return 2.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 2.0e0
end function
function code(x) return Float32(2.0) end
function tmp = code(x) tmp = single(2.0); end
\begin{array}{l}
\\
2
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr22.3%
(FPCore (x) :precision binary32 1.5)
float code(float x) {
return 1.5f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 1.5e0
end function
function code(x) return Float32(1.5) end
function tmp = code(x) tmp = single(1.5); end
\begin{array}{l}
\\
1.5
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr21.6%
(FPCore (x) :precision binary32 1.0)
float code(float x) {
return 1.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 1.0e0
end function
function code(x) return Float32(1.0) end
function tmp = code(x) tmp = single(1.0); end
\begin{array}{l}
\\
1
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr21.0%
(FPCore (x) :precision binary32 0.5)
float code(float x) {
return 0.5f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 0.5e0
end function
function code(x) return Float32(0.5) end
function tmp = code(x) tmp = single(0.5); end
\begin{array}{l}
\\
0.5
\end{array}
Initial program 49.6%
flip-+7.5%
div-inv7.5%
log-prod7.5%
pow27.5%
add-sqr-sqrt7.1%
fmm-def7.0%
metadata-eval7.0%
fmm-def7.0%
metadata-eval7.0%
Applied egg-rr7.0%
log-rec7.0%
sub-neg7.0%
fma-undefine7.0%
unpow27.0%
associate--r+9.4%
+-inverses9.4%
metadata-eval9.4%
metadata-eval9.4%
neg-sub09.4%
Simplified9.4%
Taylor expanded in x around inf 97.0%
Applied egg-rr20.1%
(FPCore (x) :precision binary32 0.0)
float code(float x) {
return 0.0f;
}
real(4) function code(x)
real(4), intent (in) :: x
code = 0.0e0
end function
function code(x) return Float32(0.0) end
function tmp = code(x) tmp = single(0.0); end
\begin{array}{l}
\\
0
\end{array}
Initial program 49.6%
Taylor expanded in x around inf 95.2%
flip-+-0.0%
log-div-0.0%
+-inverses-0.0%
+-inverses-0.0%
Applied egg-rr-0.0%
+-inverses6.1%
Simplified6.1%
(FPCore (x) :precision binary32 (log (+ x (* (sqrt (- x 1.0)) (sqrt (+ x 1.0))))))
float code(float x) {
return logf((x + (sqrtf((x - 1.0f)) * sqrtf((x + 1.0f)))));
}
real(4) function code(x)
real(4), intent (in) :: x
code = log((x + (sqrt((x - 1.0e0)) * sqrt((x + 1.0e0)))))
end function
function code(x) return log(Float32(x + Float32(sqrt(Float32(x - Float32(1.0))) * sqrt(Float32(x + Float32(1.0)))))) end
function tmp = code(x) tmp = log((x + (sqrt((x - single(1.0))) * sqrt((x + single(1.0)))))); end
\begin{array}{l}
\\
\log \left(x + \sqrt{x - 1} \cdot \sqrt{x + 1}\right)
\end{array}
herbie shell --seed 2024176
(FPCore (x)
:name "Rust f32::acosh"
:precision binary32
:pre (>= x 1.0)
:alt
(! :herbie-platform default (log (+ x (* (sqrt (- x 1)) (sqrt (+ x 1))))))
(log (+ x (sqrt (- (* x x) 1.0)))))