
(FPCore (x y z) :precision binary64 :pre TRUE (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = ((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * (y / x)) / z END code
\frac{\cosh x \cdot \frac{y}{x}}{z}
Herbie found 4 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 :pre TRUE (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (cosh(x) * (y / x)) / z
end function
public static double code(double x, double y, double z) {
return (Math.cosh(x) * (y / x)) / z;
}
def code(x, y, z): return (math.cosh(x) * (y / x)) / z
function code(x, y, z) return Float64(Float64(cosh(x) * Float64(y / x)) / z) end
function tmp = code(x, y, z) tmp = (cosh(x) * (y / x)) / z; end
code[x_, y_, z_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = ((((1) / (2)) * ((exp(x)) + ((1) / (exp(x))))) * (y / x)) / z END code
\frac{\cosh x \cdot \frac{y}{x}}{z}
(FPCore (x y z) :precision binary64 :pre TRUE (* (copysign 1.0 x) (if (<= (fabs x) 0.2322009367506751) (/ (* y (cosh (fabs x))) (* z (fabs x))) (/ y (* 0.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (fabs(x) <= 0.2322009367506751) {
tmp = (y * cosh(fabs(x))) / (z * fabs(x));
} else {
tmp = y / (0.0 * z);
}
return copysign(1.0, x) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(x) <= 0.2322009367506751) {
tmp = (y * Math.cosh(Math.abs(x))) / (z * Math.abs(x));
} else {
tmp = y / (0.0 * z);
}
return Math.copySign(1.0, x) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(x) <= 0.2322009367506751: tmp = (y * math.cosh(math.fabs(x))) / (z * math.fabs(x)) else: tmp = y / (0.0 * z) return math.copysign(1.0, x) * tmp
function code(x, y, z) tmp = 0.0 if (abs(x) <= 0.2322009367506751) tmp = Float64(Float64(y * cosh(abs(x))) / Float64(z * abs(x))); else tmp = Float64(y / Float64(0.0 * z)); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(x) <= 0.2322009367506751) tmp = (y * cosh(abs(x))) / (z * abs(x)); else tmp = y / (0.0 * z); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 0.2322009367506751], N[(N[(y * N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(z * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(0.0 * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2322009367506751:\\
\;\;\;\;\frac{y \cdot \cosh \left(\left|x\right|\right)}{z \cdot \left|x\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{0 \cdot z}\\
\end{array}
if x < 0.2322009367506751Initial program 84.6%
Applied rewrites83.8%
if 0.2322009367506751 < x Initial program 84.6%
Taylor expanded in x around 0
Applied rewrites49.3%
Taylor expanded in undef-var around zero
Applied rewrites32.7%
(FPCore (x y z) :precision binary64 :pre TRUE (* (copysign 1.0 x) (if (<= (fabs x) 0.2322009367506751) (/ y (* (fabs x) z)) (/ y (* 0.0 z)))))
double code(double x, double y, double z) {
double tmp;
if (fabs(x) <= 0.2322009367506751) {
tmp = y / (fabs(x) * z);
} else {
tmp = y / (0.0 * z);
}
return copysign(1.0, x) * tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if (Math.abs(x) <= 0.2322009367506751) {
tmp = y / (Math.abs(x) * z);
} else {
tmp = y / (0.0 * z);
}
return Math.copySign(1.0, x) * tmp;
}
def code(x, y, z): tmp = 0 if math.fabs(x) <= 0.2322009367506751: tmp = y / (math.fabs(x) * z) else: tmp = y / (0.0 * z) return math.copysign(1.0, x) * tmp
function code(x, y, z) tmp = 0.0 if (abs(x) <= 0.2322009367506751) tmp = Float64(y / Float64(abs(x) * z)); else tmp = Float64(y / Float64(0.0 * z)); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x, y, z) tmp = 0.0; if (abs(x) <= 0.2322009367506751) tmp = y / (abs(x) * z); else tmp = y / (0.0 * z); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_, y_, z_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 0.2322009367506751], N[(y / N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(y / N[(0.0 * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 0.2322009367506751:\\
\;\;\;\;\frac{y}{\left|x\right| \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{0 \cdot z}\\
\end{array}
if x < 0.2322009367506751Initial program 84.6%
Taylor expanded in x around 0
Applied rewrites49.3%
if 0.2322009367506751 < x Initial program 84.6%
Taylor expanded in x around 0
Applied rewrites49.3%
Taylor expanded in undef-var around zero
Applied rewrites32.7%
(FPCore (x y z) :precision binary64 :pre TRUE (if (<= (* (cosh x) (/ y x)) INFINITY) (/ (* y (/ (cosh x) x)) z) (/ (* y (/ (cosh x) z)) x)))
double code(double x, double y, double z) {
double tmp;
if ((cosh(x) * (y / x)) <= ((double) INFINITY)) {
tmp = (y * (cosh(x) / x)) / z;
} else {
tmp = (y * (cosh(x) / z)) / x;
}
return tmp;
}
public static double code(double x, double y, double z) {
double tmp;
if ((Math.cosh(x) * (y / x)) <= Double.POSITIVE_INFINITY) {
tmp = (y * (Math.cosh(x) / x)) / z;
} else {
tmp = (y * (Math.cosh(x) / z)) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (math.cosh(x) * (y / x)) <= math.inf: tmp = (y * (math.cosh(x) / x)) / z else: tmp = (y * (math.cosh(x) / z)) / x return tmp
function code(x, y, z) tmp = 0.0 if (Float64(cosh(x) * Float64(y / x)) <= Inf) tmp = Float64(Float64(y * Float64(cosh(x) / x)) / z); else tmp = Float64(Float64(y * Float64(cosh(x) / z)) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((cosh(x) * (y / x)) <= Inf) tmp = (y * (cosh(x) / x)) / z; else tmp = (y * (cosh(x) / z)) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y * N[(N[Cosh[x], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y}{x} \leq \infty:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \frac{\cosh x}{z}}{x}\\
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < +inf.0Initial program 84.6%
Applied rewrites95.6%
if +inf.0 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 84.6%
Applied rewrites95.8%
(FPCore (x y z) :precision binary64 :pre TRUE (/ y (* x z)))
double code(double x, double y, double z) {
return y / (x * z);
}
real(8) function code(x, y, z)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y / (x * z)
end function
public static double code(double x, double y, double z) {
return y / (x * z);
}
def code(x, y, z): return y / (x * z)
function code(x, y, z) return Float64(y / Float64(x * z)) end
function tmp = code(x, y, z) tmp = y / (x * z); end
code[x_, y_, z_] := N[(y / N[(x * z), $MachinePrecision]), $MachinePrecision]
f(x, y, z): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf] code: THEORY BEGIN f(x, y, z: real): real = y / (x * z) END code
\frac{y}{x \cdot z}
Initial program 84.6%
Taylor expanded in x around 0
Applied rewrites49.3%
herbie shell --seed 2026092
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
(/ (* (cosh x) (/ y x)) z))