(FPCore (x) :precision binary64 (acosh x))
double code(double x) { return acosh(x); }
def code(x): return math.acosh(x)
function code(x) return acosh(x) end
function tmp = code(x) tmp = acosh(x); end
code[x_] := N[ArcCosh[x], $MachinePrecision]
\begin{array}{l} \\ \cosh^{-1} x \end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 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)))); }
module fmin_fmax_functions implicit none private public fmax public fmin interface fmax module procedure fmax88 module procedure fmax44 module procedure fmax84 module procedure fmax48 end interface interface fmin module procedure fmin88 module procedure fmin44 module procedure fmin84 module procedure fmin48 end interface contains real(8) function fmax88(x, y) result (res) real(8), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(x, max(x, y), y /= y), x /= x) end function real(4) function fmax44(x, y) result (res) real(4), intent (in) :: x real(4), intent (in) :: y res = merge(y, merge(x, max(x, y), y /= y), x /= x) end function real(8) function fmax84(x, y) result(res) real(8), intent (in) :: x real(4), intent (in) :: y res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x) end function real(8) function fmax48(x, y) result(res) real(4), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x) end function real(8) function fmin88(x, y) result (res) real(8), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(x, min(x, y), y /= y), x /= x) end function real(4) function fmin44(x, y) result (res) real(4), intent (in) :: x real(4), intent (in) :: y res = merge(y, merge(x, min(x, y), y /= y), x /= x) end function real(8) function fmin84(x, y) result(res) real(8), intent (in) :: x real(4), intent (in) :: y res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x) end function real(8) function fmin48(x, y) result(res) real(4), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x) end function end module real(8) function code(x) use fmin_fmax_functions 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 (acosh x))
double code(double x) { return acosh(x); }
def code(x): return math.acosh(x)
function code(x) return acosh(x) end
function tmp = code(x) tmp = acosh(x); end
code[x_] := N[ArcCosh[x], $MachinePrecision]
\begin{array}{l} \\ \cosh^{-1} x \end{array}
Initial program 49.3%
lift-log.f64
N/A
lift-+.f64
N/A
lift-sqrt.f64
N/A
lift--.f64
N/A
lift-*.f64
N/A
acosh-def-rev
N/A
lower-acosh.f64
99.6
Applied rewrites99.6%
(FPCore (x) :precision binary64 (log (+ x (* (sqrt (- x 1.0)) (sqrt (+ x 1.0))))))
double code(double x) { return log((x + (sqrt((x - 1.0)) * sqrt((x + 1.0))))); }
module fmin_fmax_functions implicit none private public fmax public fmin interface fmax module procedure fmax88 module procedure fmax44 module procedure fmax84 module procedure fmax48 end interface interface fmin module procedure fmin88 module procedure fmin44 module procedure fmin84 module procedure fmin48 end interface contains real(8) function fmax88(x, y) result (res) real(8), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(x, max(x, y), y /= y), x /= x) end function real(4) function fmax44(x, y) result (res) real(4), intent (in) :: x real(4), intent (in) :: y res = merge(y, merge(x, max(x, y), y /= y), x /= x) end function real(8) function fmax84(x, y) result(res) real(8), intent (in) :: x real(4), intent (in) :: y res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x) end function real(8) function fmax48(x, y) result(res) real(4), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x) end function real(8) function fmin88(x, y) result (res) real(8), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(x, min(x, y), y /= y), x /= x) end function real(4) function fmin44(x, y) result (res) real(4), intent (in) :: x real(4), intent (in) :: y res = merge(y, merge(x, min(x, y), y /= y), x /= x) end function real(8) function fmin84(x, y) result(res) real(8), intent (in) :: x real(4), intent (in) :: y res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x) end function real(8) function fmin48(x, y) result(res) real(4), intent (in) :: x real(8), intent (in) :: y res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x) end function end module real(8) function code(x) use fmin_fmax_functions real(8), intent (in) :: x code = log((x + (sqrt((x - 1.0d0)) * sqrt((x + 1.0d0))))) end function
public static double code(double x) { return Math.log((x + (Math.sqrt((x - 1.0)) * Math.sqrt((x + 1.0))))); }
def code(x): return math.log((x + (math.sqrt((x - 1.0)) * math.sqrt((x + 1.0)))))
function code(x) return log(Float64(x + Float64(sqrt(Float64(x - 1.0)) * sqrt(Float64(x + 1.0))))) end
function tmp = code(x) tmp = log((x + (sqrt((x - 1.0)) * sqrt((x + 1.0))))); end
code[x_] := N[Log[N[(x + N[(N[Sqrt[N[(x - 1.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l} \\ \log \left(x + \sqrt{x - 1} \cdot \sqrt{x + 1}\right) \end{array}
herbie shell --seed 2025046
(FPCore (x)
:name "Rust f64::acosh"
:precision binary64
:pre (>= x 1.0)
:alt
(! :herbie-platform default (log (+ x (* (sqrt (- x 1)) (sqrt (+ x 1))))))
(log (+ x (sqrt (- (* x x) 1.0)))))