
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y_m)) x)))
(*
y_s
(if (<= t_0 (- INFINITY))
(*
(* (* (* y_m y_m) 0.3333333333333333) y_m)
(fma (* x x) -0.08333333333333333 0.5))
(if (<= t_0 2e-87)
(* (/ (sin x) x) y_m)
(/
(*
(*
(fma
(- (* 0.008333333333333333 (* x x)) 0.16666666666666666)
(* x x)
1.0)
x)
(sinh y_m))
x))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double t_0 = (sin(x) * sinh(y_m)) / x;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (((y_m * y_m) * 0.3333333333333333) * y_m) * fma((x * x), -0.08333333333333333, 0.5);
} else if (t_0 <= 2e-87) {
tmp = (sin(x) / x) * y_m;
} else {
tmp = ((fma(((0.008333333333333333 * (x * x)) - 0.16666666666666666), (x * x), 1.0) * x) * sinh(y_m)) / x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) t_0 = Float64(Float64(sin(x) * sinh(y_m)) / x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(y_m * y_m) * 0.3333333333333333) * y_m) * fma(Float64(x * x), -0.08333333333333333, 0.5)); elseif (t_0 <= 2e-87) tmp = Float64(Float64(sin(x) / x) * y_m); else tmp = Float64(Float64(Float64(fma(Float64(Float64(0.008333333333333333 * Float64(x * x)) - 0.16666666666666666), Float64(x * x), 1.0) * x) * sinh(y_m)) / 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_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * y$95$m), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-87], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.008333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision] * N[Sinh[y$95$m], $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{\sin x \cdot \sinh y\_m}{x}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(\left(y\_m \cdot y\_m\right) \cdot 0.3333333333333333\right) \cdot y\_m\right) \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-87}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(x \cdot x\right) - 0.16666666666666666, x \cdot x, 1\right) \cdot x\right) \cdot \sinh y\_m}{x}\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 99.9%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6499.9
Applied rewrites99.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6493.0
Applied rewrites93.0%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6493.0
Applied rewrites93.0%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 2.00000000000000004e-87Initial program 74.0%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6498.9
Applied rewrites98.9%
if 2.00000000000000004e-87 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.7
Applied rewrites98.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m) :precision binary64 (* y_s (* (/ (sinh y_m) x) (sin x))))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
return y_s * ((sinh(y_m) / x) * sin(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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = y_s * ((sinh(y_m) / x) * sin(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) {
return y_s * ((Math.sinh(y_m) / x) * Math.sin(x));
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): return y_s * ((math.sinh(y_m) / x) * math.sin(x))
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) return Float64(y_s * Float64(Float64(sinh(y_m) / x) * sin(x))) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m) tmp = y_s * ((sinh(y_m) / x) * sin(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_] := N[(y$95$s * N[(N[(N[Sinh[y$95$m], $MachinePrecision] / x), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(\frac{\sinh y\_m}{x} \cdot \sin x\right)
\end{array}
Initial program 88.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.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)
:precision binary64
(*
y_s
(if (<= (/ (* (sin x) (sinh y_m)) x) -1e-300)
(*
(* (* (* y_m y_m) 0.3333333333333333) y_m)
(fma (* x x) -0.08333333333333333 0.5))
(* (* (/ (* 2.0 (sinh y_m)) x) 0.5) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double tmp;
if (((sin(x) * sinh(y_m)) / x) <= -1e-300) {
tmp = (((y_m * y_m) * 0.3333333333333333) * y_m) * fma((x * x), -0.08333333333333333, 0.5);
} else {
tmp = (((2.0 * sinh(y_m)) / x) * 0.5) * x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) tmp = 0.0 if (Float64(Float64(sin(x) * sinh(y_m)) / x) <= -1e-300) tmp = Float64(Float64(Float64(Float64(y_m * y_m) * 0.3333333333333333) * y_m) * fma(Float64(x * x), -0.08333333333333333, 0.5)); else tmp = Float64(Float64(Float64(Float64(2.0 * sinh(y_m)) / x) * 0.5) * 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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -1e-300], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * y$95$m), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(2.0 * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * 0.5), $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{\sin x \cdot \sinh y\_m}{x} \leq -1 \cdot 10^{-300}:\\
\;\;\;\;\left(\left(\left(y\_m \cdot y\_m\right) \cdot 0.3333333333333333\right) \cdot y\_m\right) \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2 \cdot \sinh y\_m}{x} \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.00000000000000003e-300Initial program 99.8%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.0
Applied rewrites68.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6463.8
Applied rewrites63.8%
if -1.00000000000000003e-300 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 86.2%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites91.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6491.1
Applied rewrites91.1%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(*
y_s
(if (<= (/ (* (sin x) (sinh y_m)) x) -1e-300)
(*
(* (* (* y_m y_m) 0.3333333333333333) y_m)
(fma (* x x) -0.08333333333333333 0.5))
(* (/ (sinh y_m) x) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double tmp;
if (((sin(x) * sinh(y_m)) / x) <= -1e-300) {
tmp = (((y_m * y_m) * 0.3333333333333333) * y_m) * fma((x * x), -0.08333333333333333, 0.5);
} else {
tmp = (sinh(y_m) / x) * x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) tmp = 0.0 if (Float64(Float64(sin(x) * sinh(y_m)) / x) <= -1e-300) tmp = Float64(Float64(Float64(Float64(y_m * y_m) * 0.3333333333333333) * y_m) * fma(Float64(x * x), -0.08333333333333333, 0.5)); else tmp = Float64(Float64(sinh(y_m) / x) * 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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -1e-300], N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * y$95$m), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[y$95$m], $MachinePrecision] / x), $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{\sin x \cdot \sinh y\_m}{x} \leq -1 \cdot 10^{-300}:\\
\;\;\;\;\left(\left(\left(y\_m \cdot y\_m\right) \cdot 0.3333333333333333\right) \cdot y\_m\right) \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sinh y\_m}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.00000000000000003e-300Initial program 99.8%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.0
Applied rewrites68.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6463.8
Applied rewrites63.8%
if -1.00000000000000003e-300 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 86.2%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites91.1%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y_m)) x)))
(*
y_s
(if (<= t_0 -2e-213)
(/ (* (* (* (* x x) -0.16666666666666666) x) y_m) x)
(if (<= t_0 0.0)
(* (* (/ (+ y_m y_m) x) 0.5) x)
(* (* 2.0 (sinh 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 t_0 = (sin(x) * sinh(y_m)) / x;
double tmp;
if (t_0 <= -2e-213) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x;
} else if (t_0 <= 0.0) {
tmp = (((y_m + y_m) / x) * 0.5) * x;
} else {
tmp = (2.0 * sinh(y_m)) * 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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: tmp
t_0 = (sin(x) * sinh(y_m)) / x
if (t_0 <= (-2d-213)) then
tmp = ((((x * x) * (-0.16666666666666666d0)) * x) * y_m) / x
else if (t_0 <= 0.0d0) then
tmp = (((y_m + y_m) / x) * 0.5d0) * x
else
tmp = (2.0d0 * sinh(y_m)) * 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 t_0 = (Math.sin(x) * Math.sinh(y_m)) / x;
double tmp;
if (t_0 <= -2e-213) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x;
} else if (t_0 <= 0.0) {
tmp = (((y_m + y_m) / x) * 0.5) * x;
} else {
tmp = (2.0 * Math.sinh(y_m)) * 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): t_0 = (math.sin(x) * math.sinh(y_m)) / x tmp = 0 if t_0 <= -2e-213: tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x elif t_0 <= 0.0: tmp = (((y_m + y_m) / x) * 0.5) * x else: tmp = (2.0 * math.sinh(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) t_0 = Float64(Float64(sin(x) * sinh(y_m)) / x) tmp = 0.0 if (t_0 <= -2e-213) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * -0.16666666666666666) * x) * y_m) / x); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(Float64(y_m + y_m) / x) * 0.5) * x); else tmp = Float64(Float64(2.0 * sinh(y_m)) * 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) t_0 = (sin(x) * sinh(y_m)) / x; tmp = 0.0; if (t_0 <= -2e-213) tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x; elseif (t_0 <= 0.0) tmp = (((y_m + y_m) / x) * 0.5) * x; else tmp = (2.0 * sinh(y_m)) * 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_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, -2e-213], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(y$95$m + y$95$m), $MachinePrecision] / x), $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], N[(N[(2.0 * N[Sinh[y$95$m], $MachinePrecision]), $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{\sin x \cdot \sinh y\_m}{x}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot x\right) \cdot y\_m}{x}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\frac{y\_m + y\_m}{x} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(2 \cdot \sinh y\_m\right) \cdot 0.5\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
Taylor expanded in y around 0
Applied rewrites68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.1
Applied rewrites68.1%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 0.0Initial program 59.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
associate-*r/N/A
lower-/.f64N/A
count-2-revN/A
lift-+.f6484.9
Applied rewrites84.9%
if 0.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 98.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(*
y_s
(if (<= (/ (* (sin x) (sinh y_m)) x) -2e-213)
(/ (* (* (* (* x x) -0.16666666666666666) x) y_m) x)
(* (/ (sinh y_m) x) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double tmp;
if (((sin(x) * sinh(y_m)) / x) <= -2e-213) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x;
} else {
tmp = (sinh(y_m) / x) * 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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if (((sin(x) * sinh(y_m)) / x) <= (-2d-213)) then
tmp = ((((x * x) * (-0.16666666666666666d0)) * x) * y_m) / x
else
tmp = (sinh(y_m) / x) * 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 tmp;
if (((Math.sin(x) * Math.sinh(y_m)) / x) <= -2e-213) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x;
} else {
tmp = (Math.sinh(y_m) / x) * x;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): tmp = 0 if ((math.sin(x) * math.sinh(y_m)) / x) <= -2e-213: tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x else: tmp = (math.sinh(y_m) / x) * x return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) tmp = 0.0 if (Float64(Float64(sin(x) * sinh(y_m)) / x) <= -2e-213) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * -0.16666666666666666) * x) * y_m) / x); else tmp = Float64(Float64(sinh(y_m) / x) * 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) tmp = 0.0; if (((sin(x) * sinh(y_m)) / x) <= -2e-213) tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x; else tmp = (sinh(y_m) / x) * 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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -2e-213], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Sinh[y$95$m], $MachinePrecision] / x), $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{\sin x \cdot \sinh y\_m}{x} \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot x\right) \cdot y\_m}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sinh y\_m}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
Taylor expanded in y around 0
Applied rewrites68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.1
Applied rewrites68.1%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 86.7%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites87.7%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(*
y_s
(if (<= (/ (* (sin x) (sinh y_m)) x) -2e-213)
(/ (* (* (* (* x x) -0.16666666666666666) x) y_m) x)
(* (* (/ (fma (* y_m y_m) 0.16666666666666666 1.0) x) y_m) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double tmp;
if (((sin(x) * sinh(y_m)) / x) <= -2e-213) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x;
} else {
tmp = ((fma((y_m * y_m), 0.16666666666666666, 1.0) / x) * y_m) * x;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) tmp = 0.0 if (Float64(Float64(sin(x) * sinh(y_m)) / x) <= -2e-213) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * -0.16666666666666666) * x) * y_m) / x); else tmp = Float64(Float64(Float64(fma(Float64(y_m * y_m), 0.16666666666666666, 1.0) / x) * y_m) * 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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -2e-213], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] / x), $MachinePrecision] * y$95$m), $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{\sin x \cdot \sinh y\_m}{x} \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot x\right) \cdot y\_m}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(y\_m \cdot y\_m, 0.16666666666666666, 1\right)}{x} \cdot y\_m\right) \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
Taylor expanded in y around 0
Applied rewrites68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.1
Applied rewrites68.1%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 86.7%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites87.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
div-add-revN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.2
Applied rewrites78.2%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y_m)) x)))
(*
y_s
(if (<= t_0 -2e-213)
(/ (* (* (* (* x x) -0.16666666666666666) x) y_m) x)
(if (<= t_0 0.0)
(* (* (/ (+ y_m y_m) x) 0.5) x)
(* (fma (* y_m y_m) 0.16666666666666666 1.0) y_m))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double t_0 = (sin(x) * sinh(y_m)) / x;
double tmp;
if (t_0 <= -2e-213) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y_m) / x;
} else if (t_0 <= 0.0) {
tmp = (((y_m + y_m) / x) * 0.5) * x;
} else {
tmp = fma((y_m * y_m), 0.16666666666666666, 1.0) * y_m;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) t_0 = Float64(Float64(sin(x) * sinh(y_m)) / x) tmp = 0.0 if (t_0 <= -2e-213) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * -0.16666666666666666) * x) * y_m) / x); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(Float64(y_m + y_m) / x) * 0.5) * x); else tmp = Float64(fma(Float64(y_m * y_m), 0.16666666666666666, 1.0) * y_m); 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_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, -2e-213], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(y$95$m + y$95$m), $MachinePrecision] / x), $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y$95$m), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y\_m}{x}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot x\right) \cdot y\_m}{x}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\frac{y\_m + y\_m}{x} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y\_m \cdot y\_m, 0.16666666666666666, 1\right) \cdot y\_m\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
Taylor expanded in y around 0
Applied rewrites68.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.1
Applied rewrites68.1%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 0.0Initial program 59.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
associate-*r/N/A
lower-/.f64N/A
count-2-revN/A
lift-+.f6484.9
Applied rewrites84.9%
if 0.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 98.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.2
Applied rewrites68.2%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y_m)) x)))
(*
y_s
(if (<= t_0 -2e-213)
(* (* (* x x) -0.16666666666666666) y_m)
(if (<= t_0 0.0)
(* (* (/ (+ y_m y_m) x) 0.5) x)
(* (fma (* y_m y_m) 0.16666666666666666 1.0) y_m))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double t_0 = (sin(x) * sinh(y_m)) / x;
double tmp;
if (t_0 <= -2e-213) {
tmp = ((x * x) * -0.16666666666666666) * y_m;
} else if (t_0 <= 0.0) {
tmp = (((y_m + y_m) / x) * 0.5) * x;
} else {
tmp = fma((y_m * y_m), 0.16666666666666666, 1.0) * y_m;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) t_0 = Float64(Float64(sin(x) * sinh(y_m)) / x) tmp = 0.0 if (t_0 <= -2e-213) tmp = Float64(Float64(Float64(x * x) * -0.16666666666666666) * y_m); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(Float64(y_m + y_m) / x) * 0.5) * x); else tmp = Float64(fma(Float64(y_m * y_m), 0.16666666666666666, 1.0) * y_m); 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_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, -2e-213], N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * y$95$m), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(y$95$m + y$95$m), $MachinePrecision] / x), $MachinePrecision] * 0.5), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y$95$m), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y\_m}{x}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot y\_m\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\frac{y\_m + y\_m}{x} \cdot 0.5\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y\_m \cdot y\_m, 0.16666666666666666, 1\right) \cdot y\_m\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6420.8
Applied rewrites20.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6463.2
Applied rewrites63.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6463.2
Applied rewrites63.2%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 0.0Initial program 59.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6484.9
Applied rewrites84.9%
Taylor expanded in y around 0
associate-*r/N/A
lower-/.f64N/A
count-2-revN/A
lift-+.f6484.9
Applied rewrites84.9%
if 0.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 98.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.2
Applied rewrites68.2%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y_m)) x)))
(*
y_s
(if (<= t_0 -2e-213)
(* (* (* x x) -0.16666666666666666) y_m)
(if (<= t_0 0.0)
(* (/ y_m x) x)
(* (fma (* y_m y_m) 0.16666666666666666 1.0) y_m))))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double t_0 = (sin(x) * sinh(y_m)) / x;
double tmp;
if (t_0 <= -2e-213) {
tmp = ((x * x) * -0.16666666666666666) * y_m;
} else if (t_0 <= 0.0) {
tmp = (y_m / x) * x;
} else {
tmp = fma((y_m * y_m), 0.16666666666666666, 1.0) * y_m;
}
return y_s * tmp;
}
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) t_0 = Float64(Float64(sin(x) * sinh(y_m)) / x) tmp = 0.0 if (t_0 <= -2e-213) tmp = Float64(Float64(Float64(x * x) * -0.16666666666666666) * y_m); elseif (t_0 <= 0.0) tmp = Float64(Float64(y_m / x) * x); else tmp = Float64(fma(Float64(y_m * y_m), 0.16666666666666666, 1.0) * y_m); 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_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, N[(y$95$s * If[LessEqual[t$95$0, -2e-213], N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * y$95$m), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(y$95$m / x), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y$95$m), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y\_m}{x}\\
y\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot y\_m\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{y\_m}{x} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y\_m \cdot y\_m, 0.16666666666666666, 1\right) \cdot y\_m\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6420.8
Applied rewrites20.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6463.2
Applied rewrites63.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6463.2
Applied rewrites63.2%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 0.0Initial program 59.8%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites84.8%
Taylor expanded in y around 0
Applied rewrites84.8%
if 0.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 98.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6489.2
Applied rewrites89.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.2
Applied rewrites68.2%
y\_m = (fabs.f64 y)
y\_s = (copysign.f64 #s(literal 1 binary64) y)
(FPCore (y_s x y_m)
:precision binary64
(*
y_s
(if (<= (/ (* (sin x) (sinh y_m)) x) -2e-213)
(* (* (* x x) -0.16666666666666666) y_m)
(* (/ y_m x) x))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double tmp;
if (((sin(x) * sinh(y_m)) / x) <= -2e-213) {
tmp = ((x * x) * -0.16666666666666666) * y_m;
} else {
tmp = (y_m / x) * 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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if (((sin(x) * sinh(y_m)) / x) <= (-2d-213)) then
tmp = ((x * x) * (-0.16666666666666666d0)) * y_m
else
tmp = (y_m / x) * 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 tmp;
if (((Math.sin(x) * Math.sinh(y_m)) / x) <= -2e-213) {
tmp = ((x * x) * -0.16666666666666666) * y_m;
} else {
tmp = (y_m / x) * x;
}
return y_s * tmp;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): tmp = 0 if ((math.sin(x) * math.sinh(y_m)) / x) <= -2e-213: tmp = ((x * x) * -0.16666666666666666) * y_m else: tmp = (y_m / x) * x return y_s * tmp
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) tmp = 0.0 if (Float64(Float64(sin(x) * sinh(y_m)) / x) <= -2e-213) tmp = Float64(Float64(Float64(x * x) * -0.16666666666666666) * y_m); else tmp = Float64(Float64(y_m / x) * 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) tmp = 0.0; if (((sin(x) * sinh(y_m)) / x) <= -2e-213) tmp = ((x * x) * -0.16666666666666666) * y_m; else tmp = (y_m / x) * 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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -2e-213], N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * y$95$m), $MachinePrecision], N[(N[(y$95$m / x), $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{\sin x \cdot \sinh y\_m}{x} \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{y\_m}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.9999999999999999e-213Initial program 99.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6420.8
Applied rewrites20.8%
Taylor expanded in x around 0
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6463.2
Applied rewrites63.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6463.2
Applied rewrites63.2%
if -1.9999999999999999e-213 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 86.7%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites87.7%
Taylor expanded in y around 0
Applied rewrites60.0%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m) :precision binary64 (* y_s (* (/ y_m x) x)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
return y_s * ((y_m / x) * 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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = y_s * ((y_m / x) * 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) {
return y_s * ((y_m / x) * x);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): return y_s * ((y_m / x) * x)
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) return Float64(y_s * Float64(Float64(y_m / x) * x)) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m) tmp = y_s * ((y_m / x) * 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_] := N[(y$95$s * N[(N[(y$95$m / x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(\frac{y\_m}{x} \cdot x\right)
\end{array}
Initial program 88.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
Taylor expanded in x around 0
Applied rewrites74.6%
Taylor expanded in y around 0
Applied rewrites51.1%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m) :precision binary64 (* y_s (* (+ y_m y_m) 0.5)))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
return y_s * ((y_m + y_m) * 0.5);
}
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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = y_s * ((y_m + y_m) * 0.5d0)
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) {
return y_s * ((y_m + y_m) * 0.5);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): return y_s * ((y_m + y_m) * 0.5)
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) return Float64(y_s * Float64(Float64(y_m + y_m) * 0.5)) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m) tmp = y_s * ((y_m + y_m) * 0.5); 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_] := N[(y$95$s * N[(N[(y$95$m + 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 \left(\left(y\_m + y\_m\right) \cdot 0.5\right)
\end{array}
Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6464.4
Applied rewrites64.4%
Taylor expanded in y around 0
count-2-revN/A
lower-+.f6428.7
Applied rewrites28.7%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m) :precision binary64 (* y_s y_m))
y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
return y_s * y_m;
}
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)
use fmin_fmax_functions
real(8), intent (in) :: y_s
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = y_s * y_m
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) {
return y_s * y_m;
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): return y_s * y_m
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) return Float64(y_s * y_m) end
y\_m = abs(y); y\_s = sign(y) * abs(1.0); function tmp = code(y_s, x, y_m) tmp = y_s * y_m; 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_] := N[(y$95$s * y$95$m), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot y\_m
\end{array}
Initial program 88.6%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6451.6
Applied rewrites51.6%
Taylor expanded in x around 0
Applied rewrites28.7%
herbie shell --seed 2025120
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
(/ (* (sin x) (sinh y)) x))