
(FPCore (x) :precision binary64 (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))
double code(double x) {
return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = sqrt(((exp((2.0d0 * x)) - 1.0d0) / (exp(x) - 1.0d0)))
end function
public static double code(double x) {
return Math.sqrt(((Math.exp((2.0 * x)) - 1.0) / (Math.exp(x) - 1.0)));
}
def code(x): return math.sqrt(((math.exp((2.0 * x)) - 1.0) / (math.exp(x) - 1.0)))
function code(x) return sqrt(Float64(Float64(exp(Float64(2.0 * x)) - 1.0) / Float64(exp(x) - 1.0))) end
function tmp = code(x) tmp = sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0))); end
code[x_] := N[Sqrt[N[(N[(N[Exp[N[(2 * x), $MachinePrecision]], $MachinePrecision] - 1), $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
Herbie found 1 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))
double code(double x) {
return sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0)));
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = sqrt(((exp((2.0d0 * x)) - 1.0d0) / (exp(x) - 1.0d0)))
end function
public static double code(double x) {
return Math.sqrt(((Math.exp((2.0 * x)) - 1.0) / (Math.exp(x) - 1.0)));
}
def code(x): return math.sqrt(((math.exp((2.0 * x)) - 1.0) / (math.exp(x) - 1.0)))
function code(x) return sqrt(Float64(Float64(exp(Float64(2.0 * x)) - 1.0) / Float64(exp(x) - 1.0))) end
function tmp = code(x) tmp = sqrt(((exp((2.0 * x)) - 1.0) / (exp(x) - 1.0))); end
code[x_] := N[Sqrt[N[(N[(N[Exp[N[(2 * x), $MachinePrecision]], $MachinePrecision] - 1), $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
(FPCore (x) :precision binary64 (sqrt (- (exp x) -1)))
double code(double x) {
return sqrt((exp(x) - -1.0));
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = sqrt((exp(x) - (-1.0d0)))
end function
public static double code(double x) {
return Math.sqrt((Math.exp(x) - -1.0));
}
def code(x): return math.sqrt((math.exp(x) - -1.0))
function code(x) return sqrt(Float64(exp(x) - -1.0)) end
function tmp = code(x) tmp = sqrt((exp(x) - -1.0)); end
code[x_] := N[Sqrt[N[(N[Exp[x], $MachinePrecision] - -1), $MachinePrecision]], $MachinePrecision]
\sqrt{e^{x} - -1}
Initial program 35.9%
lift-*.f64N/A
count-2-revN/A
lower-+.f6435.9%
Applied rewrites35.9%
lift-/.f64N/A
mult-flipN/A
lift--.f64N/A
lift-exp.f64N/A
lift-+.f64N/A
exp-sumN/A
lift-exp.f64N/A
lift-exp.f64N/A
difference-of-sqr-1-revN/A
lift-+.f64N/A
lift--.f64N/A
lift-*.f64N/A
mult-flipN/A
lift-*.f64N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identity100.0%
lift-+.f64N/A
add-flipN/A
metadata-evalN/A
lower--.f64100.0%
Applied rewrites100.0%
herbie shell --seed 2025326 -o generate:taylor -o generate:evaluate
(FPCore (x)
:name "sqrtexp (problem 3.4.4)"
:precision binary64
(sqrt (/ (- (exp (* 2 x)) 1) (- (exp x) 1))))