
(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]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
Herbie found 19 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]
\begin{array}{l}
\\
\frac{\cosh x \cdot \frac{y}{x}}{z}
\end{array}
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= y_m 2e+16)
(/ (/ (* (cosh x) y_m) x) z)
(* (/ (cosh x) x) (/ y_m z)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2e+16) {
tmp = ((cosh(x) * y_m) / x) / z;
} else {
tmp = (cosh(x) / x) * (y_m / z);
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (y_m <= 2d+16) then
tmp = ((cosh(x) * y_m) / x) / z
else
tmp = (cosh(x) / x) * (y_m / z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (y_m <= 2e+16) {
tmp = ((Math.cosh(x) * y_m) / x) / z;
} else {
tmp = (Math.cosh(x) / x) * (y_m / z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if y_m <= 2e+16: tmp = ((math.cosh(x) * y_m) / x) / z else: tmp = (math.cosh(x) / x) * (y_m / z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (y_m <= 2e+16) tmp = Float64(Float64(Float64(cosh(x) * y_m) / x) / z); else tmp = Float64(Float64(cosh(x) / x) * Float64(y_m / z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (y_m <= 2e+16) tmp = ((cosh(x) * y_m) / x) / z; else tmp = (cosh(x) / x) * (y_m / z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[y$95$m, 2e+16], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;y\_m \leq 2 \cdot 10^{+16}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y\_m}{z}\\
\end{array}
\end{array}
if y < 2e16Initial program 79.1%
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f6499.8
Applied rewrites99.8%
if 2e16 < y Initial program 92.1%
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f6492.1
Applied rewrites92.1%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
associate-/l/N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-cosh.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (* (cosh x) (/ y_m x)) z)))
(*
y_s
(if (<= t_0 1e+118)
t_0
(if (<= t_0 INFINITY)
(* (/ (cosh x) x) (/ y_m z))
(* (* (/ (/ (fma x x 2.0) z) x) y_m) 0.5))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (cosh(x) * (y_m / x)) / z;
double tmp;
if (t_0 <= 1e+118) {
tmp = t_0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = (cosh(x) / x) * (y_m / z);
} else {
tmp = (((fma(x, x, 2.0) / z) / x) * y_m) * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(cosh(x) * Float64(y_m / x)) / z) tmp = 0.0 if (t_0 <= 1e+118) tmp = t_0; elseif (t_0 <= Inf) tmp = Float64(Float64(cosh(x) / x) * Float64(y_m / z)); else tmp = Float64(Float64(Float64(Float64(fma(x, x, 2.0) / z) / x) * y_m) * 0.5); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 1e+118], t$95$0, If[LessEqual[t$95$0, Infinity], N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x + 2.0), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\cosh x \cdot \frac{y\_m}{x}}{z}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{\mathsf{fma}\left(x, x, 2\right)}{z}}{x} \cdot y\_m\right) \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 9.99999999999999967e117Initial program 96.5%
if 9.99999999999999967e117 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 94.2%
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f6494.2
Applied rewrites94.2%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
associate-/l/N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-cosh.f64N/A
lower-/.f6496.8
Applied rewrites96.8%
if +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 0.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
cosh-undefN/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6486.8
Applied rewrites86.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (/ (* (cosh x) (/ y_m x)) z)))
(*
y_s
(if (<= t_0 100000000.0)
(/ (* (cosh x) y_m) (* z x))
(if (<= t_0 INFINITY)
(* (/ (cosh x) x) (/ y_m z))
(* (* (/ (/ (fma x x 2.0) z) x) y_m) 0.5))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (cosh(x) * (y_m / x)) / z;
double tmp;
if (t_0 <= 100000000.0) {
tmp = (cosh(x) * y_m) / (z * x);
} else if (t_0 <= ((double) INFINITY)) {
tmp = (cosh(x) / x) * (y_m / z);
} else {
tmp = (((fma(x, x, 2.0) / z) / x) * y_m) * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(cosh(x) * Float64(y_m / x)) / z) tmp = 0.0 if (t_0 <= 100000000.0) tmp = Float64(Float64(cosh(x) * y_m) / Float64(z * x)); elseif (t_0 <= Inf) tmp = Float64(Float64(cosh(x) / x) * Float64(y_m / z)); else tmp = Float64(Float64(Float64(Float64(fma(x, x, 2.0) / z) / x) * y_m) * 0.5); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, 100000000.0], N[(N[(N[Cosh[x], $MachinePrecision] * y$95$m), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(N[(N[Cosh[x], $MachinePrecision] / x), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x + 2.0), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\cosh x \cdot \frac{y\_m}{x}}{z}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq 100000000:\\
\;\;\;\;\frac{\cosh x \cdot y\_m}{z \cdot x}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\frac{\cosh x}{x} \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{\mathsf{fma}\left(x, x, 2\right)}{z}}{x} \cdot y\_m\right) \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 1e8Initial program 96.3%
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6488.2
Applied rewrites88.2%
if 1e8 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 94.7%
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f6494.7
Applied rewrites94.7%
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
associate-/l/N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lift-cosh.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
if +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 0.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
cosh-undefN/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6468.1
Applied rewrites68.1%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6486.8
Applied rewrites86.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 4.5e-183)
(/ (/ y_m z) x)
(if (<= x 1.1e+138)
(/ (* (cosh x) y_m) (* z x))
(/ (/ (fma (* (* x x) y_m) 0.5 y_m) z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 4.5e-183) {
tmp = (y_m / z) / x;
} else if (x <= 1.1e+138) {
tmp = (cosh(x) * y_m) / (z * x);
} else {
tmp = (fma(((x * x) * y_m), 0.5, y_m) / z) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 4.5e-183) tmp = Float64(Float64(y_m / z) / x); elseif (x <= 1.1e+138) tmp = Float64(Float64(cosh(x) * y_m) / Float64(z * x)); else tmp = Float64(Float64(fma(Float64(Float64(x * x) * y_m), 0.5, y_m) / z) / x); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 4.5e-183], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.1e+138], N[(N[(N[Cosh[x], $MachinePrecision] * y$95$m), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5 + y$95$m), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-183}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+138}:\\
\;\;\;\;\frac{\cosh x \cdot y\_m}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(x \cdot x\right) \cdot y\_m, 0.5, y\_m\right)}{z}}{x}\\
\end{array}
\end{array}
if x < 4.49999999999999971e-183Initial program 85.9%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
Taylor expanded in x around 0
Applied rewrites58.8%
if 4.49999999999999971e-183 < x < 1.1e138Initial program 93.4%
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6492.6
Applied rewrites92.6%
if 1.1e138 < x Initial program 67.4%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6496.5
Applied rewrites96.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 4.5e-183)
(/ (/ y_m z) x)
(if (<= x 2.5e+129)
(* (/ y_m (* z x)) (cosh x))
(/ (/ (fma (* (* x x) y_m) 0.5 y_m) z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 4.5e-183) {
tmp = (y_m / z) / x;
} else if (x <= 2.5e+129) {
tmp = (y_m / (z * x)) * cosh(x);
} else {
tmp = (fma(((x * x) * y_m), 0.5, y_m) / z) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 4.5e-183) tmp = Float64(Float64(y_m / z) / x); elseif (x <= 2.5e+129) tmp = Float64(Float64(y_m / Float64(z * x)) * cosh(x)); else tmp = Float64(Float64(fma(Float64(Float64(x * x) * y_m), 0.5, y_m) / z) / x); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 4.5e-183], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 2.5e+129], N[(N[(y$95$m / N[(z * x), $MachinePrecision]), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5 + y$95$m), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-183}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{y\_m}{z \cdot x} \cdot \cosh x\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(x \cdot x\right) \cdot y\_m, 0.5, y\_m\right)}{z}}{x}\\
\end{array}
\end{array}
if x < 4.49999999999999971e-183Initial program 85.9%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
Taylor expanded in x around 0
Applied rewrites58.8%
if 4.49999999999999971e-183 < x < 2.5000000000000001e129Initial program 93.8%
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-/l*N/A
associate-/r*N/A
*-commutativeN/A
associate-/r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cosh.f6488.2
Applied rewrites88.2%
if 2.5000000000000001e129 < x Initial program 67.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6494.5
Applied rewrites94.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (* (* (/ (/ (fma x x 2.0) z) x) y_m) 0.5))
(t_1 (/ (* (cosh x) (/ y_m x)) z)))
(*
y_s
(if (<= t_1 5e-94)
t_0
(if (<= t_1 INFINITY) (/ (/ (fma (* x (* y_m x)) 0.5 y_m) z) x) t_0)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = (((fma(x, x, 2.0) / z) / x) * y_m) * 0.5;
double t_1 = (cosh(x) * (y_m / x)) / z;
double tmp;
if (t_1 <= 5e-94) {
tmp = t_0;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (fma((x * (y_m * x)), 0.5, y_m) / z) / x;
} else {
tmp = t_0;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = Float64(Float64(Float64(Float64(fma(x, x, 2.0) / z) / x) * y_m) * 0.5) t_1 = Float64(Float64(cosh(x) * Float64(y_m / x)) / z) tmp = 0.0 if (t_1 <= 5e-94) tmp = t_0; elseif (t_1 <= Inf) tmp = Float64(Float64(fma(Float64(x * Float64(y_m * x)), 0.5, y_m) / z) / x); else tmp = t_0; end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(N[(N[(x * x + 2.0), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$1, 5e-94], t$95$0, If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[(x * N[(y$95$m * x), $MachinePrecision]), $MachinePrecision] * 0.5 + y$95$m), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision], t$95$0]]), $MachinePrecision]]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \left(\frac{\frac{\mathsf{fma}\left(x, x, 2\right)}{z}}{x} \cdot y\_m\right) \cdot 0.5\\
t_1 := \frac{\cosh x \cdot \frac{y\_m}{x}}{z}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-94}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(x \cdot \left(y\_m \cdot x\right), 0.5, y\_m\right)}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 4.9999999999999995e-94 or +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 79.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
cosh-undefN/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6483.9
Applied rewrites83.9%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6481.7
Applied rewrites81.7%
if 4.9999999999999995e-94 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 95.0%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.7
Applied rewrites82.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6482.0
Applied rewrites82.0%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(let* ((t_0 (fma (* (* x x) y_m) 0.5 y_m)))
(*
y_s
(if (<= (/ (* (cosh x) (/ y_m x)) z) 1e+81)
(/ (/ t_0 x) z)
(/ (/ t_0 z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double t_0 = fma(((x * x) * y_m), 0.5, y_m);
double tmp;
if (((cosh(x) * (y_m / x)) / z) <= 1e+81) {
tmp = (t_0 / x) / z;
} else {
tmp = (t_0 / z) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) t_0 = fma(Float64(Float64(x * x) * y_m), 0.5, y_m) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y_m / x)) / z) <= 1e+81) tmp = Float64(Float64(t_0 / x) / z); else tmp = Float64(Float64(t_0 / z) / x); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5 + y$95$m), $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1e+81], N[(N[(t$95$0 / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(t$95$0 / z), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\left(x \cdot x\right) \cdot y\_m, 0.5, y\_m\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y\_m}{x}}{z} \leq 10^{+81}:\\
\;\;\;\;\frac{\frac{t\_0}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t\_0}{z}}{x}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 9.99999999999999921e80Initial program 96.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.2
Applied rewrites83.2%
if 9.99999999999999921e80 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 71.9%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.5
Applied rewrites80.5%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (/ (* (cosh x) (/ y_m x)) z) 5e-94)
(* (* (/ (/ (fma x x 2.0) z) x) y_m) 0.5)
(/ (/ (fma (* (* x x) y_m) 0.5 y_m) z) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((cosh(x) * (y_m / x)) / z) <= 5e-94) {
tmp = (((fma(x, x, 2.0) / z) / x) * y_m) * 0.5;
} else {
tmp = (fma(((x * x) * y_m), 0.5, y_m) / z) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y_m / x)) / z) <= 5e-94) tmp = Float64(Float64(Float64(Float64(fma(x, x, 2.0) / z) / x) * y_m) * 0.5); else tmp = Float64(Float64(fma(Float64(Float64(x * x) * y_m), 0.5, y_m) / z) / x); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 5e-94], N[(N[(N[(N[(N[(x * x + 2.0), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5 + y$95$m), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y\_m}{x}}{z} \leq 5 \cdot 10^{-94}:\\
\;\;\;\;\left(\frac{\frac{\mathsf{fma}\left(x, x, 2\right)}{z}}{x} \cdot y\_m\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(x \cdot x\right) \cdot y\_m, 0.5, y\_m\right)}{z}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 4.9999999999999995e-94Initial program 96.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
cosh-undefN/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6480.6
Applied rewrites80.6%
if 4.9999999999999995e-94 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 74.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (* (cosh x) (/ y_m x)) 5e+185)
(/ (/ y_m x) z)
(* (* (/ (/ (fma x x 2.0) z) x) y_m) 0.5))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if ((cosh(x) * (y_m / x)) <= 5e+185) {
tmp = (y_m / x) / z;
} else {
tmp = (((fma(x, x, 2.0) / z) / x) * y_m) * 0.5;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(cosh(x) * Float64(y_m / x)) <= 5e+185) tmp = Float64(Float64(y_m / x) / z); else tmp = Float64(Float64(Float64(Float64(fma(x, x, 2.0) / z) / x) * y_m) * 0.5); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], 5e+185], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(N[(N[(N[(x * x + 2.0), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y\_m}{x} \leq 5 \cdot 10^{+185}:\\
\;\;\;\;\frac{\frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\frac{\mathsf{fma}\left(x, x, 2\right)}{z}}{x} \cdot y\_m\right) \cdot 0.5\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 4.9999999999999999e185Initial program 96.9%
Taylor expanded in x around 0
lift-/.f6465.0
Applied rewrites65.0%
if 4.9999999999999999e185 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 69.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
cosh-undefN/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6481.8
Applied rewrites81.8%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
pow2N/A
lower-fma.f6478.7
Applied rewrites78.7%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 4.5e-183)
(/ (/ y_m z) x)
(if (<= x 1.2e+40)
(/ (fma (* (* x x) 0.5) y_m y_m) (* z x))
(/ (/ (* (* (* x x) y_m) 0.5) z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 4.5e-183) {
tmp = (y_m / z) / x;
} else if (x <= 1.2e+40) {
tmp = fma(((x * x) * 0.5), y_m, y_m) / (z * x);
} else {
tmp = ((((x * x) * y_m) * 0.5) / z) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 4.5e-183) tmp = Float64(Float64(y_m / z) / x); elseif (x <= 1.2e+40) tmp = Float64(fma(Float64(Float64(x * x) * 0.5), y_m, y_m) / Float64(z * x)); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * y_m) * 0.5) / z) / x); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 4.5e-183], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 1.2e+40], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] * y$95$m + y$95$m), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-183}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{+40}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(x \cdot x\right) \cdot 0.5, y\_m, y\_m\right)}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\left(x \cdot x\right) \cdot y\_m\right) \cdot 0.5}{z}}{x}\\
\end{array}
\end{array}
if x < 4.49999999999999971e-183Initial program 85.9%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.0
Applied rewrites82.0%
Taylor expanded in x around 0
Applied rewrites58.8%
if 4.49999999999999971e-183 < x < 1.2e40Initial program 95.3%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.0
Applied rewrites80.0%
associate-*r/80.0
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6480.1
Applied rewrites80.1%
if 1.2e40 < x Initial program 75.7%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.1
Applied rewrites77.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6477.1
Applied rewrites77.1%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= x 9.5e-114)
(/ (/ y_m z) x)
(if (<= x 50000.0)
(* (* (/ (fma x x 2.0) (* z x)) y_m) 0.5)
(/ (/ (* (* (* x x) y_m) 0.5) z) x)))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 9.5e-114) {
tmp = (y_m / z) / x;
} else if (x <= 50000.0) {
tmp = ((fma(x, x, 2.0) / (z * x)) * y_m) * 0.5;
} else {
tmp = ((((x * x) * y_m) * 0.5) / z) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 9.5e-114) tmp = Float64(Float64(y_m / z) / x); elseif (x <= 50000.0) tmp = Float64(Float64(Float64(fma(x, x, 2.0) / Float64(z * x)) * y_m) * 0.5); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * y_m) * 0.5) / z) / x); end return Float64(y_s * tmp) end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 9.5e-114], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[x, 50000.0], N[(N[(N[(N[(x * x + 2.0), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 9.5 \cdot 10^{-114}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{elif}\;x \leq 50000:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(x, x, 2\right)}{z \cdot x} \cdot y\_m\right) \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\left(x \cdot x\right) \cdot y\_m\right) \cdot 0.5}{z}}{x}\\
\end{array}
\end{array}
if x < 9.49999999999999958e-114Initial program 86.5%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6482.9
Applied rewrites82.9%
Taylor expanded in x around 0
Applied rewrites61.6%
if 9.49999999999999958e-114 < x < 5e4Initial program 96.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
cosh-undefN/A
lower-*.f64N/A
lift-cosh.f64N/A
*-commutativeN/A
lower-*.f6496.3
Applied rewrites96.3%
Taylor expanded in x around 0
+-commutativeN/A
pow2N/A
lower-fma.f6491.9
Applied rewrites91.9%
if 5e4 < x Initial program 78.5%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.5
Applied rewrites70.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6470.5
Applied rewrites70.5%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.4) (/ (/ y_m z) x) (/ (/ (* (* (* x x) y_m) 0.5) z) x))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = ((((x * x) * y_m) * 0.5) / z) / x;
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.4d0) then
tmp = (y_m / z) / x
else
tmp = ((((x * x) * y_m) * 0.5d0) / z) / x
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = ((((x * x) * y_m) * 0.5) / z) / x;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.4: tmp = (y_m / z) / x else: tmp = ((((x * x) * y_m) * 0.5) / z) / x return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * y_m) * 0.5) / z) / x); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.4) tmp = (y_m / z) / x; else tmp = ((((x * x) * y_m) * 0.5) / z) / x; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.4], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\left(\left(x \cdot x\right) \cdot y\_m\right) \cdot 0.5}{z}}{x}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 87.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
Taylor expanded in x around 0
Applied rewrites65.4%
if 1.3999999999999999 < x Initial program 78.7%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6469.7
Applied rewrites69.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.4) (/ (/ y_m z) x) (/ (* (* (* x x) 0.5) y_m) (* z x)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = (((x * x) * 0.5) * y_m) / (z * x);
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.4d0) then
tmp = (y_m / z) / x
else
tmp = (((x * x) * 0.5d0) * y_m) / (z * x)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = (((x * x) * 0.5) * y_m) / (z * x);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.4: tmp = (y_m / z) / x else: tmp = (((x * x) * 0.5) * y_m) / (z * x) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(Float64(Float64(x * x) * 0.5) * y_m) / Float64(z * x)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.4) tmp = (y_m / z) / x; else tmp = (((x * x) * 0.5) * y_m) / (z * x); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.4], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] * y$95$m), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(x \cdot x\right) \cdot 0.5\right) \cdot y\_m}{z \cdot x}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 87.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
Taylor expanded in x around 0
Applied rewrites65.4%
if 1.3999999999999999 < x Initial program 78.7%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f6469.7
Applied rewrites69.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites49.2%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.4) (/ (/ y_m z) x) (/ (* (* 0.5 x) y_m) z))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = ((0.5 * x) * y_m) / z;
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.4d0) then
tmp = (y_m / z) / x
else
tmp = ((0.5d0 * x) * y_m) / z
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = ((0.5 * x) * y_m) / z;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.4: tmp = (y_m / z) / x else: tmp = ((0.5 * x) * y_m) / z return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(Float64(0.5 * x) * y_m) / z); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.4) tmp = (y_m / z) / x; else tmp = ((0.5 * x) * y_m) / z; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.4], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(0.5 * x), $MachinePrecision] * y$95$m), $MachinePrecision] / z), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot x\right) \cdot y\_m}{z}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 87.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
Taylor expanded in x around 0
Applied rewrites65.4%
if 1.3999999999999999 < x Initial program 78.7%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6432.9
Applied rewrites32.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.1
Applied rewrites40.1%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.4) (/ (/ y_m z) x) (* (* y_m x) (/ 0.5 z)))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = (y_m * x) * (0.5 / z);
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.4d0) then
tmp = (y_m / z) / x
else
tmp = (y_m * x) * (0.5d0 / z)
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = (y_m * x) * (0.5 / z);
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.4: tmp = (y_m / z) / x else: tmp = (y_m * x) * (0.5 / z) return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(y_m * x) * Float64(0.5 / z)); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.4) tmp = (y_m / z) / x; else tmp = (y_m * x) * (0.5 / z); end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.4], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(y$95$m * x), $MachinePrecision] * N[(0.5 / z), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(y\_m \cdot x\right) \cdot \frac{0.5}{z}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 87.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
Taylor expanded in x around 0
Applied rewrites65.4%
if 1.3999999999999999 < x Initial program 78.7%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6432.9
Applied rewrites32.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-*r/N/A
associate-*r/N/A
lower-/.f64N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6440.1
Applied rewrites40.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-/l*N/A
metadata-evalN/A
associate-*r/N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6440.1
Applied rewrites40.1%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (if (<= x 1.4) (/ (/ y_m z) x) (* (* x (/ y_m z)) 0.5))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = (x * (y_m / z)) * 0.5;
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.4d0) then
tmp = (y_m / z) / x
else
tmp = (x * (y_m / z)) * 0.5d0
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (x <= 1.4) {
tmp = (y_m / z) / x;
} else {
tmp = (x * (y_m / z)) * 0.5;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if x <= 1.4: tmp = (y_m / z) / x else: tmp = (x * (y_m / z)) * 0.5 return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (x <= 1.4) tmp = Float64(Float64(y_m / z) / x); else tmp = Float64(Float64(x * Float64(y_m / z)) * 0.5); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (x <= 1.4) tmp = (y_m / z) / x; else tmp = (x * (y_m / z)) * 0.5; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[x, 1.4], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision], N[(N[(x * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;x \leq 1.4:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{y\_m}{z}\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 87.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6484.3
Applied rewrites84.3%
Taylor expanded in x around 0
Applied rewrites65.4%
if 1.3999999999999999 < x Initial program 78.7%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.7
Applied rewrites69.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6432.9
Applied rewrites32.9%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (/ (* (cosh x) (/ y_m x)) z) 1e+81)
(/ (/ y_m x) z)
(/ (/ y_m z) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((cosh(x) * (y_m / x)) / z) <= 1e+81) {
tmp = (y_m / x) / z;
} else {
tmp = (y_m / z) / x;
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (((cosh(x) * (y_m / x)) / z) <= 1d+81) then
tmp = (y_m / x) / z
else
tmp = (y_m / z) / x
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((Math.cosh(x) * (y_m / x)) / z) <= 1e+81) {
tmp = (y_m / x) / z;
} else {
tmp = (y_m / z) / x;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if ((math.cosh(x) * (y_m / x)) / z) <= 1e+81: tmp = (y_m / x) / z else: tmp = (y_m / z) / x return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y_m / x)) / z) <= 1e+81) tmp = Float64(Float64(y_m / x) / z); else tmp = Float64(Float64(y_m / z) / x); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (((cosh(x) * (y_m / x)) / z) <= 1e+81) tmp = (y_m / x) / z; else tmp = (y_m / z) / x; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 1e+81], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y\_m}{x}}{z} \leq 10^{+81}:\\
\;\;\;\;\frac{\frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 9.99999999999999921e80Initial program 96.4%
Taylor expanded in x around 0
lift-/.f6461.7
Applied rewrites61.7%
if 9.99999999999999921e80 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 71.9%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.5
Applied rewrites80.5%
Taylor expanded in x around 0
Applied rewrites41.8%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m z)
:precision binary64
(*
y_s
(if (<= (/ (* (cosh x) (/ y_m x)) z) 5e-94)
(/ y_m (* z x))
(/ (/ y_m z) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((cosh(x) * (y_m / x)) / z) <= 5e-94) {
tmp = y_m / (z * x);
} else {
tmp = (y_m / z) / x;
}
return y_s * tmp;
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8) :: tmp
if (((cosh(x) * (y_m / x)) / z) <= 5d-94) then
tmp = y_m / (z * x)
else
tmp = (y_m / z) / x
end if
code = y_s * tmp
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
double tmp;
if (((Math.cosh(x) * (y_m / x)) / z) <= 5e-94) {
tmp = y_m / (z * x);
} else {
tmp = (y_m / z) / x;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): tmp = 0 if ((math.cosh(x) * (y_m / x)) / z) <= 5e-94: tmp = y_m / (z * x) else: tmp = (y_m / z) / x return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y_m / x)) / z) <= 5e-94) tmp = Float64(y_m / Float64(z * x)); else tmp = Float64(Float64(y_m / z) / x); end return Float64(y_s * tmp) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp_2 = code(y_s, x, y_m, z) tmp = 0.0; if (((cosh(x) * (y_m / x)) / z) <= 5e-94) tmp = y_m / (z * x); else tmp = (y_m / z) / x; end tmp_2 = y_s * tmp; end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 5e-94], N[(y$95$m / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m / z), $MachinePrecision] / x), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y\_m}{x}}{z} \leq 5 \cdot 10^{-94}:\\
\;\;\;\;\frac{y\_m}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 4.9999999999999995e-94Initial program 96.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6458.6
Applied rewrites58.6%
if 4.9999999999999995e-94 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 74.6%
Taylor expanded in x around 0
lower-/.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
Taylor expanded in x around 0
Applied rewrites46.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m z) :precision binary64 (* y_s (/ y_m (* z x))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m / (z * x));
}
y\_m = private
y\_s = private
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(y_s, x, y_m, z)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
code = y_s * (y_m / (z * x))
end function
y\_m = Math.abs(y);
y\_s = Math.copySign(1.0, y);
public static double code(double y_s, double x, double y_m, double z) {
return y_s * (y_m / (z * x));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m, z): return y_s * (y_m / (z * x))
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m, z) return Float64(y_s * Float64(y_m / Float64(z * x))) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m, z) tmp = y_s * (y_m / (z * x)); end
y\_m = N[Abs[y], $MachinePrecision]
y\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[y$95$s_, x_, y$95$m_, z_] := N[(y$95$s * N[(y$95$m / N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \frac{y\_m}{z \cdot x}
\end{array}
Initial program 85.4%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6449.2
Applied rewrites49.2%
herbie shell --seed 2025115
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
(/ (* (cosh x) (/ y x)) z))