
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
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, 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]
\frac{\cosh x \cdot \frac{y}{x}}{z}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* (cosh x) (/ y x)) z))
double code(double x, double y, double z) {
return (cosh(x) * (y / x)) / z;
}
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, 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]
\frac{\cosh x \cdot \frac{y}{x}}{z}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cosh (fabs x)))
(t_1 (/ (* t_0 (/ (fabs y) (fabs x))) (fabs z))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
t_1
100000000000000002309309130269787154892983822485169927543056457815484218967945768886576179686795076111078238543825857419659919011313587350687602971665369018571203143144663564875896666980352)
t_1
(/ (* (- (fabs y)) (/ t_0 (fabs z))) (- (fabs x)))))))))double code(double x, double y, double z) {
double t_0 = cosh(fabs(x));
double t_1 = (t_0 * (fabs(y) / fabs(x))) / fabs(z);
double tmp;
if (t_1 <= 1e+188) {
tmp = t_1;
} else {
tmp = (-fabs(y) * (t_0 / fabs(z))) / -fabs(x);
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(Math.abs(x));
double t_1 = (t_0 * (Math.abs(y) / Math.abs(x))) / Math.abs(z);
double tmp;
if (t_1 <= 1e+188) {
tmp = t_1;
} else {
tmp = (-Math.abs(y) * (t_0 / Math.abs(z))) / -Math.abs(x);
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z): t_0 = math.cosh(math.fabs(x)) t_1 = (t_0 * (math.fabs(y) / math.fabs(x))) / math.fabs(z) tmp = 0 if t_1 <= 1e+188: tmp = t_1 else: tmp = (-math.fabs(y) * (t_0 / math.fabs(z))) / -math.fabs(x) return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z) t_0 = cosh(abs(x)) t_1 = Float64(Float64(t_0 * Float64(abs(y) / abs(x))) / abs(z)) tmp = 0.0 if (t_1 <= 1e+188) tmp = t_1; else tmp = Float64(Float64(Float64(-abs(y)) * Float64(t_0 / abs(z))) / Float64(-abs(x))); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z) t_0 = cosh(abs(x)); t_1 = (t_0 * (abs(y) / abs(x))) / abs(z); tmp = 0.0; if (t_1 <= 1e+188) tmp = t_1; else tmp = (-abs(y) * (t_0 / abs(z))) / -abs(x); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_] := Block[{t$95$0 = N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[z], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 100000000000000002309309130269787154892983822485169927543056457815484218967945768886576179686795076111078238543825857419659919011313587350687602971665369018571203143144663564875896666980352], t$95$1, N[(N[((-N[Abs[y], $MachinePrecision]) * N[(t$95$0 / N[Abs[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[Abs[x], $MachinePrecision])), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \cosh \left(\left|x\right|\right)\\
t_1 := \frac{t\_0 \cdot \frac{\left|y\right|}{\left|x\right|}}{\left|z\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 100000000000000002309309130269787154892983822485169927543056457815484218967945768886576179686795076111078238543825857419659919011313587350687602971665369018571203143144663564875896666980352:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-\left|y\right|\right) \cdot \frac{t\_0}{\left|z\right|}}{-\left|x\right|}\\
\end{array}\right)\right)
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 1e188Initial program 84.8%
if 1e188 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 84.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-/.f64N/A
frac-2negN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
mult-flip-revN/A
lower-/.f64N/A
lower-neg.f6496.1%
Applied rewrites96.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cosh (fabs x)))
(t_1 (/ (* t_0 (/ (fabs y) (fabs x))) (fabs z))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<= t_1 8000000000000000106300440576)
t_1
(/ (/ (* (fabs y) t_0) (fabs z)) (fabs x))))))))double code(double x, double y, double z) {
double t_0 = cosh(fabs(x));
double t_1 = (t_0 * (fabs(y) / fabs(x))) / fabs(z);
double tmp;
if (t_1 <= 8e+27) {
tmp = t_1;
} else {
tmp = ((fabs(y) * t_0) / fabs(z)) / fabs(x);
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(Math.abs(x));
double t_1 = (t_0 * (Math.abs(y) / Math.abs(x))) / Math.abs(z);
double tmp;
if (t_1 <= 8e+27) {
tmp = t_1;
} else {
tmp = ((Math.abs(y) * t_0) / Math.abs(z)) / Math.abs(x);
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z): t_0 = math.cosh(math.fabs(x)) t_1 = (t_0 * (math.fabs(y) / math.fabs(x))) / math.fabs(z) tmp = 0 if t_1 <= 8e+27: tmp = t_1 else: tmp = ((math.fabs(y) * t_0) / math.fabs(z)) / math.fabs(x) return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z) t_0 = cosh(abs(x)) t_1 = Float64(Float64(t_0 * Float64(abs(y) / abs(x))) / abs(z)) tmp = 0.0 if (t_1 <= 8e+27) tmp = t_1; else tmp = Float64(Float64(Float64(abs(y) * t_0) / abs(z)) / abs(x)); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z) t_0 = cosh(abs(x)); t_1 = (t_0 * (abs(y) / abs(x))) / abs(z); tmp = 0.0; if (t_1 <= 8e+27) tmp = t_1; else tmp = ((abs(y) * t_0) / abs(z)) / abs(x); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_] := Block[{t$95$0 = N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[z], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, 8000000000000000106300440576], t$95$1, N[(N[(N[(N[Abs[y], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Abs[z], $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \cosh \left(\left|x\right|\right)\\
t_1 := \frac{t\_0 \cdot \frac{\left|y\right|}{\left|x\right|}}{\left|z\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 8000000000000000106300440576:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left|y\right| \cdot t\_0}{\left|z\right|}}{\left|x\right|}\\
\end{array}\right)\right)
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 8.0000000000000001e27Initial program 84.8%
if 8.0000000000000001e27 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 84.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6496.1%
Applied rewrites96.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (* (cosh x) (/ y x)) z))) (if (<= t_0 INFINITY) t_0 (* y (/ (cosh x) (* z x))))))
double code(double x, double y, double z) {
double t_0 = (cosh(x) * (y / x)) / z;
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = y * (cosh(x) / (z * x));
}
return tmp;
}
public static double code(double x, double y, double z) {
double t_0 = (Math.cosh(x) * (y / x)) / z;
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = y * (Math.cosh(x) / (z * x));
}
return tmp;
}
def code(x, y, z): t_0 = (math.cosh(x) * (y / x)) / z tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = y * (math.cosh(x) / (z * x)) return tmp
function code(x, y, z) t_0 = Float64(Float64(cosh(x) * Float64(y / x)) / z) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = Float64(y * Float64(cosh(x) / Float64(z * x))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (cosh(x) * (y / x)) / z; tmp = 0.0; if (t_0 <= Inf) tmp = t_0; else tmp = y * (cosh(x) / (z * x)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[Cosh[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[(y * N[(N[Cosh[x], $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\cosh x \cdot \frac{y}{x}}{z}\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\cosh x}{z \cdot x}\\
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 84.8%
if +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4%
Applied rewrites82.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cosh (fabs x))) (t_1 (/ (fabs y) (fabs x))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(if (<=
(* t_0 t_1)
39999999999999999563482447285636784507139225041605435780720061858901209596441032595416451225830520245186635713283815594336131046093817348450418688)
(/ t_1 z)
(/ (* (fabs y) t_0) (* z (fabs x))))))))double code(double x, double y, double z) {
double t_0 = cosh(fabs(x));
double t_1 = fabs(y) / fabs(x);
double tmp;
if ((t_0 * t_1) <= 4e+145) {
tmp = t_1 / z;
} else {
tmp = (fabs(y) * t_0) / (z * fabs(x));
}
return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(Math.abs(x));
double t_1 = Math.abs(y) / Math.abs(x);
double tmp;
if ((t_0 * t_1) <= 4e+145) {
tmp = t_1 / z;
} else {
tmp = (Math.abs(y) * t_0) / (z * Math.abs(x));
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * tmp);
}
def code(x, y, z): t_0 = math.cosh(math.fabs(x)) t_1 = math.fabs(y) / math.fabs(x) tmp = 0 if (t_0 * t_1) <= 4e+145: tmp = t_1 / z else: tmp = (math.fabs(y) * t_0) / (z * math.fabs(x)) return math.copysign(1.0, x) * (math.copysign(1.0, y) * tmp)
function code(x, y, z) t_0 = cosh(abs(x)) t_1 = Float64(abs(y) / abs(x)) tmp = 0.0 if (Float64(t_0 * t_1) <= 4e+145) tmp = Float64(t_1 / z); else tmp = Float64(Float64(abs(y) * t_0) / Float64(z * abs(x))); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp)) end
function tmp_2 = code(x, y, z) t_0 = cosh(abs(x)); t_1 = abs(y) / abs(x); tmp = 0.0; if ((t_0 * t_1) <= 4e+145) tmp = t_1 / z; else tmp = (abs(y) * t_0) / (z * abs(x)); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * tmp); end
code[x_, y_, z_] := Block[{t$95$0 = N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$0 * t$95$1), $MachinePrecision], 39999999999999999563482447285636784507139225041605435780720061858901209596441032595416451225830520245186635713283815594336131046093817348450418688], N[(t$95$1 / z), $MachinePrecision], N[(N[(N[Abs[y], $MachinePrecision] * t$95$0), $MachinePrecision] / N[(z * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \cosh \left(\left|x\right|\right)\\
t_1 := \frac{\left|y\right|}{\left|x\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \cdot t\_1 \leq 39999999999999999563482447285636784507139225041605435780720061858901209596441032595416451225830520245186635713283815594336131046093817348450418688:\\
\;\;\;\;\frac{t\_1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|y\right| \cdot t\_0}{z \cdot \left|x\right|}\\
\end{array}\right)
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4e145Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6448.0%
Applied rewrites48.0%
if 4e145 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.8%
Applied rewrites82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (cosh (fabs x))) (t_1 (/ (fabs y) (fabs x))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(if (<=
(* t_0 t_1)
39999999999999999563482447285636784507139225041605435780720061858901209596441032595416451225830520245186635713283815594336131046093817348450418688)
(/ t_1 z)
(* (fabs y) (/ t_0 (* z (fabs x)))))))))double code(double x, double y, double z) {
double t_0 = cosh(fabs(x));
double t_1 = fabs(y) / fabs(x);
double tmp;
if ((t_0 * t_1) <= 4e+145) {
tmp = t_1 / z;
} else {
tmp = fabs(y) * (t_0 / (z * fabs(x)));
}
return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
public static double code(double x, double y, double z) {
double t_0 = Math.cosh(Math.abs(x));
double t_1 = Math.abs(y) / Math.abs(x);
double tmp;
if ((t_0 * t_1) <= 4e+145) {
tmp = t_1 / z;
} else {
tmp = Math.abs(y) * (t_0 / (z * Math.abs(x)));
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * tmp);
}
def code(x, y, z): t_0 = math.cosh(math.fabs(x)) t_1 = math.fabs(y) / math.fabs(x) tmp = 0 if (t_0 * t_1) <= 4e+145: tmp = t_1 / z else: tmp = math.fabs(y) * (t_0 / (z * math.fabs(x))) return math.copysign(1.0, x) * (math.copysign(1.0, y) * tmp)
function code(x, y, z) t_0 = cosh(abs(x)) t_1 = Float64(abs(y) / abs(x)) tmp = 0.0 if (Float64(t_0 * t_1) <= 4e+145) tmp = Float64(t_1 / z); else tmp = Float64(abs(y) * Float64(t_0 / Float64(z * abs(x)))); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp)) end
function tmp_2 = code(x, y, z) t_0 = cosh(abs(x)); t_1 = abs(y) / abs(x); tmp = 0.0; if ((t_0 * t_1) <= 4e+145) tmp = t_1 / z; else tmp = abs(y) * (t_0 / (z * abs(x))); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * tmp); end
code[x_, y_, z_] := Block[{t$95$0 = N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$0 * t$95$1), $MachinePrecision], 39999999999999999563482447285636784507139225041605435780720061858901209596441032595416451225830520245186635713283815594336131046093817348450418688], N[(t$95$1 / z), $MachinePrecision], N[(N[Abs[y], $MachinePrecision] * N[(t$95$0 / N[(z * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \cosh \left(\left|x\right|\right)\\
t_1 := \frac{\left|y\right|}{\left|x\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \cdot t\_1 \leq 39999999999999999563482447285636784507139225041605435780720061858901209596441032595416451225830520245186635713283815594336131046093817348450418688:\\
\;\;\;\;\frac{t\_1}{z}\\
\mathbf{else}:\\
\;\;\;\;\left|y\right| \cdot \frac{t\_0}{z \cdot \left|x\right|}\\
\end{array}\right)
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4e145Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6448.0%
Applied rewrites48.0%
if 4e145 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4%
Applied rewrites82.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (fabs x))) (t_1 (* (fabs x) z)))
(*
(copysign 1 x)
(if (<= (fabs x) 1770887431076117/36893488147419103232)
(/ y t_1)
(*
y
(/
(*
(fabs x)
(+ z (* (fabs x) (+ (* -1/2 z) (+ (* 1/2 z) (* 1/2 t_1))))))
(* t_0 t_0)))))))double code(double x, double y, double z) {
double t_0 = z * fabs(x);
double t_1 = fabs(x) * z;
double tmp;
if (fabs(x) <= 4.8e-5) {
tmp = y / t_1;
} else {
tmp = y * ((fabs(x) * (z + (fabs(x) * ((-0.5 * z) + ((0.5 * z) + (0.5 * t_1)))))) / (t_0 * t_0));
}
return copysign(1.0, x) * tmp;
}
public static double code(double x, double y, double z) {
double t_0 = z * Math.abs(x);
double t_1 = Math.abs(x) * z;
double tmp;
if (Math.abs(x) <= 4.8e-5) {
tmp = y / t_1;
} else {
tmp = y * ((Math.abs(x) * (z + (Math.abs(x) * ((-0.5 * z) + ((0.5 * z) + (0.5 * t_1)))))) / (t_0 * t_0));
}
return Math.copySign(1.0, x) * tmp;
}
def code(x, y, z): t_0 = z * math.fabs(x) t_1 = math.fabs(x) * z tmp = 0 if math.fabs(x) <= 4.8e-5: tmp = y / t_1 else: tmp = y * ((math.fabs(x) * (z + (math.fabs(x) * ((-0.5 * z) + ((0.5 * z) + (0.5 * t_1)))))) / (t_0 * t_0)) return math.copysign(1.0, x) * tmp
function code(x, y, z) t_0 = Float64(z * abs(x)) t_1 = Float64(abs(x) * z) tmp = 0.0 if (abs(x) <= 4.8e-5) tmp = Float64(y / t_1); else tmp = Float64(y * Float64(Float64(abs(x) * Float64(z + Float64(abs(x) * Float64(Float64(-0.5 * z) + Float64(Float64(0.5 * z) + Float64(0.5 * t_1)))))) / Float64(t_0 * t_0))); end return Float64(copysign(1.0, x) * tmp) end
function tmp_2 = code(x, y, z) t_0 = z * abs(x); t_1 = abs(x) * z; tmp = 0.0; if (abs(x) <= 4.8e-5) tmp = y / t_1; else tmp = y * ((abs(x) * (z + (abs(x) * ((-0.5 * z) + ((0.5 * z) + (0.5 * t_1)))))) / (t_0 * t_0)); end tmp_2 = (sign(x) * abs(1.0)) * tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[x], $MachinePrecision], 1770887431076117/36893488147419103232], N[(y / t$95$1), $MachinePrecision], N[(y * N[(N[(N[Abs[x], $MachinePrecision] * N[(z + N[(N[Abs[x], $MachinePrecision] * N[(N[(-1/2 * z), $MachinePrecision] + N[(N[(1/2 * z), $MachinePrecision] + N[(1/2 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := z \cdot \left|x\right|\\
t_1 := \left|x\right| \cdot z\\
\mathsf{copysign}\left(1, x\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|x\right| \leq \frac{1770887431076117}{36893488147419103232}:\\
\;\;\;\;\frac{y}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\left|x\right| \cdot \left(z + \left|x\right| \cdot \left(\frac{-1}{2} \cdot z + \left(\frac{1}{2} \cdot z + \frac{1}{2} \cdot t\_1\right)\right)\right)}{t\_0 \cdot t\_0}\\
\end{array}
\end{array}
if x < 4.8000000000000001e-5Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
if 4.8000000000000001e-5 < x Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6482.4%
Applied rewrites82.4%
lift-/.f64N/A
lift-cosh.f64N/A
cosh-defN/A
div-addN/A
div-addN/A
frac-addN/A
lower-/.f64N/A
Applied rewrites52.9%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6445.7%
Applied rewrites45.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (fabs y) (fabs x))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(if (<=
(* (cosh (fabs x)) t_0)
499999999999999960548416541607351328777021384687611118643325884835920630831966800139023707085267707205518204055907116200520239285727065764214062887637864581182125170853648392988706023732518458057027666759600481533739104277734798607669877628825763840)
(/ t_0 z)
(/ (* (fabs y) (/ 1 z)) (fabs x)))))))double code(double x, double y, double z) {
double t_0 = fabs(y) / fabs(x);
double tmp;
if ((cosh(fabs(x)) * t_0) <= 5e+248) {
tmp = t_0 / z;
} else {
tmp = (fabs(y) * (1.0 / z)) / fabs(x);
}
return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
public static double code(double x, double y, double z) {
double t_0 = Math.abs(y) / Math.abs(x);
double tmp;
if ((Math.cosh(Math.abs(x)) * t_0) <= 5e+248) {
tmp = t_0 / z;
} else {
tmp = (Math.abs(y) * (1.0 / z)) / Math.abs(x);
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * tmp);
}
def code(x, y, z): t_0 = math.fabs(y) / math.fabs(x) tmp = 0 if (math.cosh(math.fabs(x)) * t_0) <= 5e+248: tmp = t_0 / z else: tmp = (math.fabs(y) * (1.0 / z)) / math.fabs(x) return math.copysign(1.0, x) * (math.copysign(1.0, y) * tmp)
function code(x, y, z) t_0 = Float64(abs(y) / abs(x)) tmp = 0.0 if (Float64(cosh(abs(x)) * t_0) <= 5e+248) tmp = Float64(t_0 / z); else tmp = Float64(Float64(abs(y) * Float64(1.0 / z)) / abs(x)); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp)) end
function tmp_2 = code(x, y, z) t_0 = abs(y) / abs(x); tmp = 0.0; if ((cosh(abs(x)) * t_0) <= 5e+248) tmp = t_0 / z; else tmp = (abs(y) * (1.0 / z)) / abs(x); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * tmp); end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], 499999999999999960548416541607351328777021384687611118643325884835920630831966800139023707085267707205518204055907116200520239285727065764214062887637864581182125170853648392988706023732518458057027666759600481533739104277734798607669877628825763840], N[(t$95$0 / z), $MachinePrecision], N[(N[(N[Abs[y], $MachinePrecision] * N[(1 / z), $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{\left|y\right|}{\left|x\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\cosh \left(\left|x\right|\right) \cdot t\_0 \leq 499999999999999960548416541607351328777021384687611118643325884835920630831966800139023707085267707205518204055907116200520239285727065764214062887637864581182125170853648392988706023732518458057027666759600481533739104277734798607669877628825763840:\\
\;\;\;\;\frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|y\right| \cdot \frac{1}{z}}{\left|x\right|}\\
\end{array}\right)
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4.9999999999999996e248Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6448.0%
Applied rewrites48.0%
if 4.9999999999999996e248 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 84.8%
Taylor expanded in x around 0
Applied rewrites48.0%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
associate-*l*N/A
mult-flip-revN/A
lower-*.f64N/A
lower-/.f6451.8%
Applied rewrites51.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (fabs y) (fabs x))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(*
(copysign 1 z)
(if (<=
(/ (* (cosh (fabs x)) t_0) (fabs z))
8000000000000000106300440576)
(/ t_0 (fabs z))
(/ (/ (fabs y) (fabs z)) (fabs x))))))))double code(double x, double y, double z) {
double t_0 = fabs(y) / fabs(x);
double tmp;
if (((cosh(fabs(x)) * t_0) / fabs(z)) <= 8e+27) {
tmp = t_0 / fabs(z);
} else {
tmp = (fabs(y) / fabs(z)) / fabs(x);
}
return copysign(1.0, x) * (copysign(1.0, y) * (copysign(1.0, z) * tmp));
}
public static double code(double x, double y, double z) {
double t_0 = Math.abs(y) / Math.abs(x);
double tmp;
if (((Math.cosh(Math.abs(x)) * t_0) / Math.abs(z)) <= 8e+27) {
tmp = t_0 / Math.abs(z);
} else {
tmp = (Math.abs(y) / Math.abs(z)) / Math.abs(x);
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * (Math.copySign(1.0, z) * tmp));
}
def code(x, y, z): t_0 = math.fabs(y) / math.fabs(x) tmp = 0 if ((math.cosh(math.fabs(x)) * t_0) / math.fabs(z)) <= 8e+27: tmp = t_0 / math.fabs(z) else: tmp = (math.fabs(y) / math.fabs(z)) / math.fabs(x) return math.copysign(1.0, x) * (math.copysign(1.0, y) * (math.copysign(1.0, z) * tmp))
function code(x, y, z) t_0 = Float64(abs(y) / abs(x)) tmp = 0.0 if (Float64(Float64(cosh(abs(x)) * t_0) / abs(z)) <= 8e+27) tmp = Float64(t_0 / abs(z)); else tmp = Float64(Float64(abs(y) / abs(z)) / abs(x)); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * Float64(copysign(1.0, z) * tmp))) end
function tmp_2 = code(x, y, z) t_0 = abs(y) / abs(x); tmp = 0.0; if (((cosh(abs(x)) * t_0) / abs(z)) <= 8e+27) tmp = t_0 / abs(z); else tmp = (abs(y) / abs(z)) / abs(x); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * ((sign(z) * abs(1.0)) * tmp)); end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[z]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Abs[z], $MachinePrecision]), $MachinePrecision], 8000000000000000106300440576], N[(t$95$0 / N[Abs[z], $MachinePrecision]), $MachinePrecision], N[(N[(N[Abs[y], $MachinePrecision] / N[Abs[z], $MachinePrecision]), $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{\left|y\right|}{\left|x\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \left(\mathsf{copysign}\left(1, z\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh \left(\left|x\right|\right) \cdot t\_0}{\left|z\right|} \leq 8000000000000000106300440576:\\
\;\;\;\;\frac{t\_0}{\left|z\right|}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left|y\right|}{\left|z\right|}}{\left|x\right|}\\
\end{array}\right)\right)
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 8.0000000000000001e27Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6448.0%
Applied rewrites48.0%
if 8.0000000000000001e27 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 84.8%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-*l/N/A
lower-/.f64N/A
mult-flip-revN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6496.1%
Applied rewrites96.1%
Taylor expanded in x around 0
Applied rewrites51.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (fabs y) (fabs x))))
(*
(copysign 1 x)
(*
(copysign 1 y)
(if (<=
(* (cosh (fabs x)) t_0)
50000000000000002216397832979173719250214483304318128040098968915481738541309455929792089182585038346225505444281420986050205132811653363414864588844456074162727639905052485516551288455999908458318119026366376053636438477835715215872973713965056)
(/ t_0 z)
(/ (fabs y) (* (fabs x) z)))))))double code(double x, double y, double z) {
double t_0 = fabs(y) / fabs(x);
double tmp;
if ((cosh(fabs(x)) * t_0) <= 5e+244) {
tmp = t_0 / z;
} else {
tmp = fabs(y) / (fabs(x) * z);
}
return copysign(1.0, x) * (copysign(1.0, y) * tmp);
}
public static double code(double x, double y, double z) {
double t_0 = Math.abs(y) / Math.abs(x);
double tmp;
if ((Math.cosh(Math.abs(x)) * t_0) <= 5e+244) {
tmp = t_0 / z;
} else {
tmp = Math.abs(y) / (Math.abs(x) * z);
}
return Math.copySign(1.0, x) * (Math.copySign(1.0, y) * tmp);
}
def code(x, y, z): t_0 = math.fabs(y) / math.fabs(x) tmp = 0 if (math.cosh(math.fabs(x)) * t_0) <= 5e+244: tmp = t_0 / z else: tmp = math.fabs(y) / (math.fabs(x) * z) return math.copysign(1.0, x) * (math.copysign(1.0, y) * tmp)
function code(x, y, z) t_0 = Float64(abs(y) / abs(x)) tmp = 0.0 if (Float64(cosh(abs(x)) * t_0) <= 5e+244) tmp = Float64(t_0 / z); else tmp = Float64(abs(y) / Float64(abs(x) * z)); end return Float64(copysign(1.0, x) * Float64(copysign(1.0, y) * tmp)) end
function tmp_2 = code(x, y, z) t_0 = abs(y) / abs(x); tmp = 0.0; if ((cosh(abs(x)) * t_0) <= 5e+244) tmp = t_0 / z; else tmp = abs(y) / (abs(x) * z); end tmp_2 = (sign(x) * abs(1.0)) * ((sign(y) * abs(1.0)) * tmp); end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Abs[y], $MachinePrecision] / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[Cosh[N[Abs[x], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], 50000000000000002216397832979173719250214483304318128040098968915481738541309455929792089182585038346225505444281420986050205132811653363414864588844456074162727639905052485516551288455999908458318119026366376053636438477835715215872973713965056], N[(t$95$0 / z), $MachinePrecision], N[(N[Abs[y], $MachinePrecision] / N[(N[Abs[x], $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{\left|y\right|}{\left|x\right|}\\
\mathsf{copysign}\left(1, x\right) \cdot \left(\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\cosh \left(\left|x\right|\right) \cdot t\_0 \leq 50000000000000002216397832979173719250214483304318128040098968915481738541309455929792089182585038346225505444281420986050205132811653363414864588844456074162727639905052485516551288455999908458318119026366376053636438477835715215872973713965056:\\
\;\;\;\;\frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left|y\right|}{\left|x\right| \cdot z}\\
\end{array}\right)
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 5.0000000000000002e244Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6448.0%
Applied rewrites48.0%
if 5.0000000000000002e244 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
(FPCore (x y z) :precision binary64 (/ y (* x z)))
double code(double x, double y, double z) {
return y / (x * z);
}
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, 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]
\frac{y}{x \cdot z}
Initial program 84.8%
Taylor expanded in x around 0
lower-/.f64N/A
lower-*.f6448.1%
Applied rewrites48.1%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
(/ (* (cosh x) (/ y x)) z))