
(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 16 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 5.5e+191)
(/ (/ (* (cosh x) y_m) x) z)
(/ (/ (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 (y_m <= 5.5e+191) {
tmp = ((cosh(x) * y_m) / x) / z;
} 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 (y_m <= 5.5e+191) tmp = Float64(Float64(Float64(cosh(x) * y_m) / x) / z); 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[y$95$m, 5.5e+191], N[(N[(N[(N[Cosh[x], $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision] / z), $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}\;y\_m \leq 5.5 \cdot 10^{+191}:\\
\;\;\;\;\frac{\frac{\cosh x \cdot y\_m}{x}}{z}\\
\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 y < 5.5000000000000002e191Initial program 83.2%
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-cosh.f6497.6
Applied rewrites97.6%
if 5.5000000000000002e191 < y Initial program 87.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-*.f6496.9
Applied rewrites96.9%
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 INFINITY) t_0 (/ (* y_m (/ (* (* x x) 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 t_0 = (cosh(x) * (y_m / x)) / z;
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = (y_m * (((x * x) * 0.5) / z)) / x;
}
return y_s * tmp;
}
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 t_0 = (Math.cosh(x) * (y_m / x)) / z;
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = (y_m * (((x * x) * 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): t_0 = (math.cosh(x) * (y_m / x)) / z tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = (y_m * (((x * x) * 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) t_0 = Float64(Float64(cosh(x) * Float64(y_m / x)) / z) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = Float64(Float64(y_m * Float64(Float64(Float64(x * x) * 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) t_0 = (cosh(x) * (y_m / x)) / z; tmp = 0.0; if (t_0 <= Inf) tmp = t_0; else tmp = (y_m * (((x * x) * 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_] := 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, Infinity], t$95$0, N[(N[(y$95$m * N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision]), $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 := \frac{\cosh x \cdot \frac{y\_m}{x}}{z}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\left(x \cdot x\right) \cdot 0.5}{z}}{x}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < +inf.0Initial program 95.1%
if +inf.0 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 0.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-*.f6480.1
Applied rewrites80.1%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6487.0
Applied rewrites87.0%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6487.0
Applied rewrites87.0%
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 7.5e-192)
(* (/ y_m x) (/ 1.0 z))
(if (<= x 2.3e+151)
(/ (* (cosh x) y_m) (* z x))
(/ (* y_m (/ (* (* x x) 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 <= 7.5e-192) {
tmp = (y_m / x) * (1.0 / z);
} else if (x <= 2.3e+151) {
tmp = (cosh(x) * y_m) / (z * x);
} else {
tmp = (y_m * (((x * x) * 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 <= 7.5d-192) then
tmp = (y_m / x) * (1.0d0 / z)
else if (x <= 2.3d+151) then
tmp = (cosh(x) * y_m) / (z * x)
else
tmp = (y_m * (((x * x) * 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 <= 7.5e-192) {
tmp = (y_m / x) * (1.0 / z);
} else if (x <= 2.3e+151) {
tmp = (Math.cosh(x) * y_m) / (z * x);
} else {
tmp = (y_m * (((x * x) * 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 <= 7.5e-192: tmp = (y_m / x) * (1.0 / z) elif x <= 2.3e+151: tmp = (math.cosh(x) * y_m) / (z * x) else: tmp = (y_m * (((x * x) * 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 <= 7.5e-192) tmp = Float64(Float64(y_m / x) * Float64(1.0 / z)); elseif (x <= 2.3e+151) tmp = Float64(Float64(cosh(x) * y_m) / Float64(z * x)); else tmp = Float64(Float64(y_m * Float64(Float64(Float64(x * x) * 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 <= 7.5e-192) tmp = (y_m / x) * (1.0 / z); elseif (x <= 2.3e+151) tmp = (cosh(x) * y_m) / (z * x); else tmp = (y_m * (((x * x) * 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, 7.5e-192], N[(N[(y$95$m / x), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e+151], N[(N[(N[Cosh[x], $MachinePrecision] * y$95$m), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision]), $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 7.5 \cdot 10^{-192}:\\
\;\;\;\;\frac{y\_m}{x} \cdot \frac{1}{z}\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+151}:\\
\;\;\;\;\frac{\cosh x \cdot y\_m}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\left(x \cdot x\right) \cdot 0.5}{z}}{x}\\
\end{array}
\end{array}
if x < 7.5000000000000001e-192Initial program 84.8%
lift-/.f64N/A
lift-*.f64N/A
lift-cosh.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f64N/A
lift-cosh.f6484.8
Applied rewrites84.8%
Taylor expanded in x around 0
Applied rewrites54.9%
if 7.5000000000000001e-192 < x < 2.3000000000000001e151Initial program 91.9%
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.2
Applied rewrites92.2%
if 2.3000000000000001e151 < x Initial program 64.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-*.f6499.4
Applied rewrites99.4%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6499.3
Applied rewrites99.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6499.3
Applied rewrites99.3%
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) 0.5 1.0)))
(*
y_s
(if (<= (* (cosh x) (/ y_m x)) 5e+135)
(/ (* t_0 (/ y_m x)) z)
(/ (* y_m (/ 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), 0.5, 1.0);
double tmp;
if ((cosh(x) * (y_m / x)) <= 5e+135) {
tmp = (t_0 * (y_m / x)) / z;
} else {
tmp = (y_m * (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(x * x), 0.5, 1.0) tmp = 0.0 if (Float64(cosh(x) * Float64(y_m / x)) <= 5e+135) tmp = Float64(Float64(t_0 * Float64(y_m / x)) / z); else tmp = Float64(Float64(y_m * 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[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], 5e+135], N[(N[(t$95$0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m * N[(t$95$0 / z), $MachinePrecision]), $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(x \cdot x, 0.5, 1\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\cosh x \cdot \frac{y\_m}{x} \leq 5 \cdot 10^{+135}:\\
\;\;\;\;\frac{t\_0 \cdot \frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{t\_0}{z}}{x}\\
\end{array}
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 5.00000000000000029e135Initial program 96.2%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.4
Applied rewrites81.4%
if 5.00000000000000029e135 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 69.2%
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.4
Applied rewrites80.4%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6481.6
Applied rewrites81.6%
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+135)
(/ (/ (fma (* (* x x) y_m) 0.5 y_m) x) z)
(/ (* y_m (/ (fma (* x x) 0.5 1.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 tmp;
if ((cosh(x) * (y_m / x)) <= 5e+135) {
tmp = (fma(((x * x) * y_m), 0.5, y_m) / x) / z;
} else {
tmp = (y_m * (fma((x * x), 0.5, 1.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) tmp = 0.0 if (Float64(cosh(x) * Float64(y_m / x)) <= 5e+135) tmp = Float64(Float64(fma(Float64(Float64(x * x) * y_m), 0.5, y_m) / x) / z); else tmp = Float64(Float64(y_m * Float64(fma(Float64(x * x), 0.5, 1.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_] := N[(y$95$s * If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], 5e+135], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.5 + y$95$m), $MachinePrecision] / x), $MachinePrecision] / z), $MachinePrecision], N[(N[(y$95$m * N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] / z), $MachinePrecision]), $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}\;\cosh x \cdot \frac{y\_m}{x} \leq 5 \cdot 10^{+135}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(\left(x \cdot x\right) \cdot y\_m, 0.5, y\_m\right)}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right)}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 5.00000000000000029e135Initial program 96.2%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.6
Applied rewrites83.6%
if 5.00000000000000029e135 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 69.2%
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.4
Applied rewrites80.4%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6481.6
Applied rewrites81.6%
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) 0.5 1.0)))
(*
y_s
(if (<= (/ (* (cosh x) (/ y_m x)) z) 5e-49)
(* (/ t_0 (* z x)) y_m)
(/ (* y_m (/ 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), 0.5, 1.0);
double tmp;
if (((cosh(x) * (y_m / x)) / z) <= 5e-49) {
tmp = (t_0 / (z * x)) * y_m;
} else {
tmp = (y_m * (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(x * x), 0.5, 1.0) tmp = 0.0 if (Float64(Float64(cosh(x) * Float64(y_m / x)) / z) <= 5e-49) tmp = Float64(Float64(t_0 / Float64(z * x)) * y_m); else tmp = Float64(Float64(y_m * 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[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision]}, N[(y$95$s * If[LessEqual[N[(N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], 5e-49], N[(N[(t$95$0 / N[(z * x), $MachinePrecision]), $MachinePrecision] * y$95$m), $MachinePrecision], N[(N[(y$95$m * N[(t$95$0 / z), $MachinePrecision]), $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(x \cdot x, 0.5, 1\right)\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{\cosh x \cdot \frac{y\_m}{x}}{z} \leq 5 \cdot 10^{-49}:\\
\;\;\;\;\frac{t\_0}{z \cdot x} \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{t\_0}{z}}{x}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) < 4.9999999999999999e-49Initial program 96.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-*.f6480.7
Applied rewrites80.7%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites73.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6473.2
Applied rewrites73.2%
if 4.9999999999999999e-49 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 72.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-*.f6482.1
Applied rewrites82.1%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6483.0
Applied rewrites83.0%
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)) 2e+197)
(/ (/ y_m x) z)
(* y_m (/ (/ (fma (* x x) 0.5 1.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 tmp;
if ((cosh(x) * (y_m / x)) <= 2e+197) {
tmp = (y_m / x) / z;
} else {
tmp = y_m * ((fma((x * x), 0.5, 1.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) tmp = 0.0 if (Float64(cosh(x) * Float64(y_m / x)) <= 2e+197) tmp = Float64(Float64(y_m / x) / z); else tmp = Float64(y_m * Float64(Float64(fma(Float64(x * x), 0.5, 1.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_] := N[(y$95$s * If[LessEqual[N[(N[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], 2e+197], N[(N[(y$95$m / x), $MachinePrecision] / z), $MachinePrecision], N[(y$95$m * N[(N[(N[(N[(x * x), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] / z), $MachinePrecision] / 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}\;\cosh x \cdot \frac{y\_m}{x} \leq 2 \cdot 10^{+197}:\\
\;\;\;\;\frac{\frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \frac{\frac{\mathsf{fma}\left(x \cdot x, 0.5, 1\right)}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 1.9999999999999999e197Initial program 96.3%
Taylor expanded in x around 0
lift-/.f6465.5
Applied rewrites65.5%
if 1.9999999999999999e197 < (*.f64 (cosh.f64 x) (/.f64 y 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-*.f6479.6
Applied rewrites79.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites60.4%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
associate-/r*N/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lower-/.f64N/A
lift-fma.f64N/A
lift-*.f6479.1
Applied rewrites79.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 1000000.0)
(* (fma 0.5 x (/ 1.0 x)) (/ y_m z))
(/ (* y_m (/ (* (* x x) 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 <= 1000000.0) {
tmp = fma(0.5, x, (1.0 / x)) * (y_m / z);
} else {
tmp = (y_m * (((x * x) * 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 <= 1000000.0) tmp = Float64(fma(0.5, x, Float64(1.0 / x)) * Float64(y_m / z)); else tmp = Float64(Float64(y_m * Float64(Float64(Float64(x * x) * 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, 1000000.0], N[(N[(0.5 * x + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], N[(N[(y$95$m * N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / z), $MachinePrecision]), $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 1000000:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, \frac{1}{x}\right) \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m \cdot \frac{\left(x \cdot x\right) \cdot 0.5}{z}}{x}\\
\end{array}
\end{array}
if x < 1e6Initial program 86.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-*.f6484.7
Applied rewrites84.7%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
pow-flipN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
inv-powN/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
if 1e6 < x Initial program 76.2%
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-*.f6471.6
Applied rewrites71.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6472.2
Applied rewrites72.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6472.2
Applied rewrites72.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 250000.0)
(* (fma 0.5 x (/ 1.0 x)) (/ y_m z))
(if (<= x 6.5e+198)
(* y_m (/ (* (* x x) 0.5) (* 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 <= 250000.0) {
tmp = fma(0.5, x, (1.0 / x)) * (y_m / z);
} else if (x <= 6.5e+198) {
tmp = y_m * (((x * x) * 0.5) / (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 <= 250000.0) tmp = Float64(fma(0.5, x, Float64(1.0 / x)) * Float64(y_m / z)); elseif (x <= 6.5e+198) tmp = Float64(y_m * Float64(Float64(Float64(x * x) * 0.5) / Float64(z * x))); else tmp = Float64(Float64(Float64(0.5 * x) * y_m) / z); 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, 250000.0], N[(N[(0.5 * x + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.5e+198], N[(y$95$m * N[(N[(N[(x * x), $MachinePrecision] * 0.5), $MachinePrecision] / N[(z * x), $MachinePrecision]), $MachinePrecision]), $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 250000:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, \frac{1}{x}\right) \cdot \frac{y\_m}{z}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+198}:\\
\;\;\;\;y\_m \cdot \frac{\left(x \cdot x\right) \cdot 0.5}{z \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot x\right) \cdot y\_m}{z}\\
\end{array}
\end{array}
if x < 2.5e5Initial program 86.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-*.f6484.8
Applied rewrites84.8%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
pow-flipN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
inv-powN/A
lower-fma.f64N/A
lower-/.f6472.2
Applied rewrites72.2%
if 2.5e5 < x < 6.5000000000000003e198Initial 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-*.f6454.0
Applied rewrites54.0%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites35.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6435.9
Applied rewrites35.9%
if 6.5000000000000003e198 < x Initial program 60.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-*.f64100.0
Applied rewrites100.0%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites89.4%
Taylor expanded in x around inf
lower-*.f6444.0
Applied rewrites44.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6456.2
Applied rewrites56.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 420000.0)
(* (fma 0.5 x (/ 1.0 x)) (/ y_m z))
(/ (* (* 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 <= 420000.0) {
tmp = fma(0.5, x, (1.0 / x)) * (y_m / z);
} 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 <= 420000.0) tmp = Float64(fma(0.5, x, Float64(1.0 / x)) * Float64(y_m / z)); else tmp = Float64(Float64(Float64(0.5 * x) * y_m) / z); 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, 420000.0], N[(N[(0.5 * x + N[(1.0 / x), $MachinePrecision]), $MachinePrecision] * N[(y$95$m / z), $MachinePrecision]), $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 420000:\\
\;\;\;\;\mathsf{fma}\left(0.5, x, \frac{1}{x}\right) \cdot \frac{y\_m}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot x\right) \cdot y\_m}{z}\\
\end{array}
\end{array}
if x < 4.2e5Initial program 86.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-*.f6484.8
Applied rewrites84.8%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites79.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
pow-flipN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
inv-powN/A
lower-fma.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
if 4.2e5 < x Initial program 76.2%
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-*.f6471.5
Applied rewrites71.5%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites57.0%
Taylor expanded in x around inf
lower-*.f6432.4
Applied rewrites32.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6441.2
Applied rewrites41.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 x) z) (/ (* (* 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 / x) / z;
} 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 / x) / z
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 / x) / z;
} 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 / x) / z 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 / x) / z); 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 / x) / z; 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 / x), $MachinePrecision] / z), $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}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(0.5 \cdot x\right) \cdot y\_m}{z}\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 86.7%
Taylor expanded in x around 0
lift-/.f6463.0
Applied rewrites63.0%
if 1.3999999999999999 < x Initial program 76.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-*.f6470.6
Applied rewrites70.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites56.4%
Taylor expanded in x around inf
lower-*.f6432.3
Applied rewrites32.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f6440.9
Applied rewrites40.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 (<= x 1.4) (/ (/ y_m x) z) (* y_m (* (/ x 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 / x) / z;
} else {
tmp = y_m * ((x / 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 / x) / z
else
tmp = y_m * ((x / 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 / x) / z;
} else {
tmp = y_m * ((x / 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 / x) / z else: tmp = y_m * ((x / 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 / x) / z); else tmp = Float64(y_m * Float64(Float64(x / 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 / x) / z; else tmp = y_m * ((x / 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 / x), $MachinePrecision] / z), $MachinePrecision], N[(y$95$m * N[(N[(x / z), $MachinePrecision] * 0.5), $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}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;y\_m \cdot \left(\frac{x}{z} \cdot 0.5\right)\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 86.7%
Taylor expanded in x around 0
lift-/.f6463.0
Applied rewrites63.0%
if 1.3999999999999999 < x Initial program 76.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-*.f6470.6
Applied rewrites70.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-/.f64N/A
associate-/l/N/A
*-commutativeN/A
*-commutativeN/A
pow2N/A
associate-*r*N/A
distribute-lft1-inN/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites44.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.4
Applied rewrites39.4%
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 x) z) (* (* 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 / x) / z;
} 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 / x) / z
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 / x) / z;
} 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 / x) / z 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 / x) / z); 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 / x) / z; 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 / x), $MachinePrecision] / z), $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}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{y\_m}{z}\right) \cdot 0.5\\
\end{array}
\end{array}
if x < 1.3999999999999999Initial program 86.7%
Taylor expanded in x around 0
lift-/.f6463.0
Applied rewrites63.0%
if 1.3999999999999999 < x Initial program 76.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-*.f6470.6
Applied rewrites70.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6432.3
Applied rewrites32.3%
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)) 1e+107) (/ (/ 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)) <= 1e+107) {
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)) <= 1d+107) 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)) <= 1e+107) {
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)) <= 1e+107: 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(cosh(x) * Float64(y_m / x)) <= 1e+107) 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)) <= 1e+107) 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[Cosh[x], $MachinePrecision] * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision], 1e+107], 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}\;\cosh x \cdot \frac{y\_m}{x} \leq 10^{+107}:\\
\;\;\;\;\frac{\frac{y\_m}{x}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y\_m}{z}}{x}\\
\end{array}
\end{array}
if (*.f64 (cosh.f64 x) (/.f64 y x)) < 9.9999999999999997e106Initial program 96.1%
Taylor expanded in x around 0
lift-/.f6463.3
Applied rewrites63.3%
if 9.9999999999999997e106 < (*.f64 (cosh.f64 x) (/.f64 y x)) Initial program 70.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-*.f6480.7
Applied rewrites80.7%
Taylor expanded in x around 0
Applied rewrites39.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) 1e-50)
(/ 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) <= 1e-50) {
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) <= 1d-50) 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) <= 1e-50) {
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) <= 1e-50: 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) <= 1e-50) 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) <= 1e-50) 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], 1e-50], 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 10^{-50}:\\
\;\;\;\;\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) < 1.00000000000000001e-50Initial program 96.0%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6460.0
Applied rewrites60.0%
if 1.00000000000000001e-50 < (/.f64 (*.f64 (cosh.f64 x) (/.f64 y x)) z) Initial program 72.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-*.f6482.1
Applied rewrites82.1%
Taylor expanded in x around 0
Applied rewrites45.6%
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 84.1%
Taylor expanded in x around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6449.2
Applied rewrites49.2%
herbie shell --seed 2025119
(FPCore (x y z)
:name "Linear.Quaternion:$ctan from linear-1.19.1.3"
:precision binary64
(/ (* (cosh x) (/ y x)) z))