
(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 11 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))
(* (* 2.0 (sinh y_m)) (fma x (* x -0.08333333333333333) 0.5))
(if (<= t_0 5e-107) (* (/ (sin x) x) y_m) (sinh 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 <= -((double) INFINITY)) {
tmp = (2.0 * sinh(y_m)) * fma(x, (x * -0.08333333333333333), 0.5);
} else if (t_0 <= 5e-107) {
tmp = (sin(x) / x) * y_m;
} else {
tmp = sinh(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 <= Float64(-Inf)) tmp = Float64(Float64(2.0 * sinh(y_m)) * fma(x, Float64(x * -0.08333333333333333), 0.5)); elseif (t_0 <= 5e-107) tmp = Float64(Float64(sin(x) / x) * y_m); else tmp = sinh(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, (-Infinity)], N[(N[(2.0 * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] * N[(x * N[(x * -0.08333333333333333), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-107], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y$95$m), $MachinePrecision], N[Sinh[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 -\infty:\\
\;\;\;\;\left(2 \cdot \sinh y\_m\right) \cdot \mathsf{fma}\left(x, x \cdot -0.08333333333333333, 0.5\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-107}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\sinh y\_m\\
\end{array}
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 88.6%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites63.4%
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6463.4
Applied rewrites63.4%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 4.99999999999999971e-107Initial program 88.6%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6451.4
Applied rewrites51.4%
if 4.99999999999999971e-107 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.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 (* (/ (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
sinh-defN/A
rec-expN/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/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-231)
(* (* 2.0 (sinh y_m)) (fma x (* x -0.08333333333333333) 0.5))
(/ x (/ x (sinh y_m))))))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-231) {
tmp = (2.0 * sinh(y_m)) * fma(x, (x * -0.08333333333333333), 0.5);
} else {
tmp = x / (x / sinh(y_m));
}
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-231) tmp = Float64(Float64(2.0 * sinh(y_m)) * fma(x, Float64(x * -0.08333333333333333), 0.5)); else tmp = Float64(x / Float64(x / sinh(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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -1e-231], N[(N[(2.0 * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] * N[(x * N[(x * -0.08333333333333333), $MachinePrecision] + 0.5), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / N[Sinh[y$95$m], $MachinePrecision]), $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}\;\frac{\sin x \cdot \sinh y\_m}{x} \leq -1 \cdot 10^{-231}:\\
\;\;\;\;\left(2 \cdot \sinh y\_m\right) \cdot \mathsf{fma}\left(x, x \cdot -0.08333333333333333, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{\sinh y\_m}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.9999999999999999e-232Initial program 88.6%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites63.4%
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6463.4
Applied rewrites63.4%
if -9.9999999999999999e-232 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) 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
sinh-defN/A
rec-expN/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-sinh.f64N/A
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
lift-sinh.f6499.3
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
lift-/.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites74.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-231)
(*
(* (fma 0.3333333333333333 (* y_m y_m) 2.0) y_m)
(fma (* x x) -0.08333333333333333 0.5))
(/ x (/ x (sinh y_m))))))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-231) {
tmp = (fma(0.3333333333333333, (y_m * y_m), 2.0) * y_m) * fma((x * x), -0.08333333333333333, 0.5);
} else {
tmp = x / (x / sinh(y_m));
}
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-231) tmp = Float64(Float64(fma(0.3333333333333333, Float64(y_m * y_m), 2.0) * y_m) * fma(Float64(x * x), -0.08333333333333333, 0.5)); else tmp = Float64(x / Float64(x / sinh(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_] := N[(y$95$s * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y$95$m], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], -1e-231], N[(N[(N[(0.3333333333333333 * N[(y$95$m * y$95$m), $MachinePrecision] + 2.0), $MachinePrecision] * y$95$m), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(x / N[(x / N[Sinh[y$95$m], $MachinePrecision]), $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}\;\frac{\sin x \cdot \sinh y\_m}{x} \leq -1 \cdot 10^{-231}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.3333333333333333, y\_m \cdot y\_m, 2\right) \cdot y\_m\right) \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{\sinh y\_m}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.9999999999999999e-232Initial program 88.6%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites63.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6455.0
Applied rewrites55.0%
if -9.9999999999999999e-232 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) 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
sinh-defN/A
rec-expN/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-sinh.f64N/A
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
lift-sinh.f6499.3
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
lift-/.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites74.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-231)
(/ (* (* (* x x) (* x (+ y_m y_m))) -0.08333333333333333) x)
(/ x (/ x (sinh y_m))))))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-231) {
tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x;
} else {
tmp = x / (x / sinh(y_m));
}
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) <= (-1d-231)) then
tmp = (((x * x) * (x * (y_m + y_m))) * (-0.08333333333333333d0)) / x
else
tmp = x / (x / sinh(y_m))
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) <= -1e-231) {
tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x;
} else {
tmp = x / (x / Math.sinh(y_m));
}
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) <= -1e-231: tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x else: tmp = x / (x / math.sinh(y_m)) 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-231) tmp = Float64(Float64(Float64(Float64(x * x) * Float64(x * Float64(y_m + y_m))) * -0.08333333333333333) / x); else tmp = Float64(x / Float64(x / sinh(y_m))); 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) <= -1e-231) tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x; else tmp = x / (x / sinh(y_m)); 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], -1e-231], N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(y$95$m + y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.08333333333333333), $MachinePrecision] / x), $MachinePrecision], N[(x / N[(x / N[Sinh[y$95$m], $MachinePrecision]), $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}\;\frac{\sin x \cdot \sinh y\_m}{x} \leq -1 \cdot 10^{-231}:\\
\;\;\;\;\frac{\left(\left(x \cdot x\right) \cdot \left(x \cdot \left(y\_m + y\_m\right)\right)\right) \cdot -0.08333333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{x}{\sinh y\_m}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.9999999999999999e-232Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
rec-expN/A
sinh-undef-revN/A
lift-sinh.f64N/A
lift-*.f6414.9
Applied rewrites14.9%
Taylor expanded in y around 0
Applied rewrites13.0%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f6413.0
lift-*.f64N/A
count-2-revN/A
lower-+.f6413.0
Applied rewrites13.0%
if -9.9999999999999999e-232 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) 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
sinh-defN/A
rec-expN/A
mult-flipN/A
metadata-evalN/A
*-commutativeN/A
lower-/.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f64N/A
lift-sin.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-sinh.f64N/A
division-flipN/A
lower-special-/N/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
lift-sinh.f6499.3
Applied rewrites99.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-sinh.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
lift-/.f6499.4
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites74.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-231)
(/ (* (* (* x x) (* x (+ y_m y_m))) -0.08333333333333333) x)
(sinh y_m))))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-231) {
tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x;
} else {
tmp = sinh(y_m);
}
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) <= (-1d-231)) then
tmp = (((x * x) * (x * (y_m + y_m))) * (-0.08333333333333333d0)) / x
else
tmp = sinh(y_m)
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) <= -1e-231) {
tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x;
} else {
tmp = Math.sinh(y_m);
}
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) <= -1e-231: tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x else: tmp = math.sinh(y_m) 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-231) tmp = Float64(Float64(Float64(Float64(x * x) * Float64(x * Float64(y_m + y_m))) * -0.08333333333333333) / x); else tmp = sinh(y_m); 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) <= -1e-231) tmp = (((x * x) * (x * (y_m + y_m))) * -0.08333333333333333) / x; else tmp = sinh(y_m); 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], -1e-231], N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * N[(y$95$m + y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.08333333333333333), $MachinePrecision] / x), $MachinePrecision], N[Sinh[y$95$m], $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^{-231}:\\
\;\;\;\;\frac{\left(\left(x \cdot x\right) \cdot \left(x \cdot \left(y\_m + y\_m\right)\right)\right) \cdot -0.08333333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.9999999999999999e-232Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
rec-expN/A
sinh-undef-revN/A
lift-sinh.f64N/A
lift-*.f6414.9
Applied rewrites14.9%
Taylor expanded in y around 0
Applied rewrites13.0%
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
lower-*.f6413.0
lift-*.f64N/A
count-2-revN/A
lower-+.f6413.0
Applied rewrites13.0%
if -9.9999999999999999e-232 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.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) -1e-231)
(/ (* (* (* (* x x) x) -0.16666666666666666) y_m) x)
(sinh y_m))))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-231) {
tmp = ((((x * x) * x) * -0.16666666666666666) * y_m) / x;
} else {
tmp = sinh(y_m);
}
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) <= (-1d-231)) then
tmp = ((((x * x) * x) * (-0.16666666666666666d0)) * y_m) / x
else
tmp = sinh(y_m)
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) <= -1e-231) {
tmp = ((((x * x) * x) * -0.16666666666666666) * y_m) / x;
} else {
tmp = Math.sinh(y_m);
}
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) <= -1e-231: tmp = ((((x * x) * x) * -0.16666666666666666) * y_m) / x else: tmp = math.sinh(y_m) 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-231) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * x) * -0.16666666666666666) * y_m) / x); else tmp = sinh(y_m); 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) <= -1e-231) tmp = ((((x * x) * x) * -0.16666666666666666) * y_m) / x; else tmp = sinh(y_m); 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], -1e-231], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * y$95$m), $MachinePrecision] / x), $MachinePrecision], N[Sinh[y$95$m], $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^{-231}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot -0.16666666666666666\right) \cdot y\_m}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.9999999999999999e-232Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites52.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f64N/A
rec-expN/A
sinh-undef-revN/A
lift-sinh.f64N/A
lift-*.f6414.9
Applied rewrites14.9%
Taylor expanded in y around 0
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow3N/A
lift-*.f64N/A
lift-*.f6413.0
Applied rewrites13.0%
if -9.9999999999999999e-232 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.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) -1e-231)
(* (+ y_m y_m) (* (* x x) -0.08333333333333333))
(sinh y_m))))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-231) {
tmp = (y_m + y_m) * ((x * x) * -0.08333333333333333);
} else {
tmp = sinh(y_m);
}
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) <= (-1d-231)) then
tmp = (y_m + y_m) * ((x * x) * (-0.08333333333333333d0))
else
tmp = sinh(y_m)
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) <= -1e-231) {
tmp = (y_m + y_m) * ((x * x) * -0.08333333333333333);
} else {
tmp = Math.sinh(y_m);
}
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) <= -1e-231: tmp = (y_m + y_m) * ((x * x) * -0.08333333333333333) else: tmp = math.sinh(y_m) 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-231) tmp = Float64(Float64(y_m + y_m) * Float64(Float64(x * x) * -0.08333333333333333)); else tmp = sinh(y_m); 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) <= -1e-231) tmp = (y_m + y_m) * ((x * x) * -0.08333333333333333); else tmp = sinh(y_m); 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], -1e-231], N[(N[(y$95$m + y$95$m), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision], N[Sinh[y$95$m], $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^{-231}:\\
\;\;\;\;\left(y\_m + y\_m\right) \cdot \left(\left(x \cdot x\right) \cdot -0.08333333333333333\right)\\
\mathbf{else}:\\
\;\;\;\;\sinh y\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -9.9999999999999999e-232Initial program 88.6%
Taylor expanded in x around 0
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites63.4%
Taylor expanded in y around 0
count-2-revN/A
lower-+.f6436.5
Applied rewrites36.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6412.3
Applied rewrites12.3%
if -9.9999999999999999e-232 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.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 (<= x 122000000000.0)
(* (fma y_m (* y_m 0.16666666666666666) 1.0) y_m)
(* (* (* y_m y_m) y_m) 0.16666666666666666))))y\_m = fabs(y);
y\_s = copysign(1.0, y);
double code(double y_s, double x, double y_m) {
double tmp;
if (x <= 122000000000.0) {
tmp = fma(y_m, (y_m * 0.16666666666666666), 1.0) * y_m;
} else {
tmp = ((y_m * y_m) * y_m) * 0.16666666666666666;
}
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 (x <= 122000000000.0) tmp = Float64(fma(y_m, Float64(y_m * 0.16666666666666666), 1.0) * y_m); else tmp = Float64(Float64(Float64(y_m * y_m) * y_m) * 0.16666666666666666); 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[x, 122000000000.0], N[(N[(y$95$m * N[(y$95$m * 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * y$95$m), $MachinePrecision], N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.16666666666666666), $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 122000000000:\\
\;\;\;\;\mathsf{fma}\left(y\_m, y\_m \cdot 0.16666666666666666, 1\right) \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y\_m \cdot y\_m\right) \cdot y\_m\right) \cdot 0.16666666666666666\\
\end{array}
\end{array}
if x < 1.22e11Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.2
Applied rewrites52.2%
lift-*.f64N/A
lift-fma.f64N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f6452.2
Applied rewrites52.2%
if 1.22e11 < x Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6439.3
Applied rewrites39.3%
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) 4e-7)
(* 1.0 y_m)
(* (* (* y_m y_m) y_m) 0.16666666666666666))))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) <= 4e-7) {
tmp = 1.0 * y_m;
} else {
tmp = ((y_m * y_m) * y_m) * 0.16666666666666666;
}
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) <= 4d-7) then
tmp = 1.0d0 * y_m
else
tmp = ((y_m * y_m) * y_m) * 0.16666666666666666d0
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) <= 4e-7) {
tmp = 1.0 * y_m;
} else {
tmp = ((y_m * y_m) * y_m) * 0.16666666666666666;
}
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) <= 4e-7: tmp = 1.0 * y_m else: tmp = ((y_m * y_m) * y_m) * 0.16666666666666666 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) <= 4e-7) tmp = Float64(1.0 * y_m); else tmp = Float64(Float64(Float64(y_m * y_m) * y_m) * 0.16666666666666666); 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) <= 4e-7) tmp = 1.0 * y_m; else tmp = ((y_m * y_m) * y_m) * 0.16666666666666666; 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], 4e-7], N[(1.0 * y$95$m), $MachinePrecision], N[(N[(N[(y$95$m * y$95$m), $MachinePrecision] * y$95$m), $MachinePrecision] * 0.16666666666666666), $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 4 \cdot 10^{-7}:\\
\;\;\;\;1 \cdot y\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y\_m \cdot y\_m\right) \cdot y\_m\right) \cdot 0.16666666666666666\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 3.9999999999999998e-7Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in y around 0
Applied rewrites27.8%
if 3.9999999999999998e-7 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6439.3
Applied rewrites39.3%
y\_m = (fabs.f64 y) y\_s = (copysign.f64 #s(literal 1 binary64) y) (FPCore (y_s x y_m) :precision binary64 (* y_s (* 1.0 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 * (1.0 * 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 * (1.0d0 * 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 * (1.0 * y_m);
}
y\_m = math.fabs(y) y\_s = math.copysign(1.0, y) def code(y_s, x, y_m): return y_s * (1.0 * y_m)
y\_m = abs(y) y\_s = copysign(1.0, y) function code(y_s, x, y_m) return Float64(y_s * Float64(1.0 * 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 * (1.0 * 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 * N[(1.0 * y$95$m), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y\_m = \left|y\right|
\\
y\_s = \mathsf{copysign}\left(1, y\right)
\\
y\_s \cdot \left(1 \cdot y\_m\right)
\end{array}
Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
rec-expN/A
sinh-defN/A
lift-sinh.f6463.2
Applied rewrites63.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6452.2
Applied rewrites52.2%
Taylor expanded in y around 0
Applied rewrites27.8%
herbie shell --seed 2025132
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
(/ (* (sin x) (sinh y)) x))