
(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 12 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}
(FPCore (x y) :precision binary64 (* (sinh y) (/ (sin x) x)))
double code(double x, double y) {
return sinh(y) * (sin(x) / 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 = sinh(y) * (sin(x) / x)
end function
public static double code(double x, double y) {
return Math.sinh(y) * (Math.sin(x) / x);
}
def code(x, y): return math.sinh(y) * (math.sin(x) / x)
function code(x, y) return Float64(sinh(y) * Float64(sin(x) / x)) end
function tmp = code(x, y) tmp = sinh(y) * (sin(x) / x); end
code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sinh y \cdot \frac{\sin x}{x}
\end{array}
Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 (- INFINITY))
(*
(/
(*
(* (* y y) 0.16666666666666666)
(* (fma -0.16666666666666666 (* x x) 1.0) x))
x)
y)
(if (<= t_0 4e-51)
(* (/ (* (sin x) (fma (* y y) 0.16666666666666666 1.0)) x) y)
(* (sinh y) 1.0)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((y * y) * 0.16666666666666666) * (fma(-0.16666666666666666, (x * x), 1.0) * x)) / x) * y;
} else if (t_0 <= 4e-51) {
tmp = ((sin(x) * fma((y * y), 0.16666666666666666, 1.0)) / x) * y;
} else {
tmp = sinh(y) * 1.0;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x)) / x) * y); elseif (t_0 <= 4e-51) tmp = Float64(Float64(Float64(sin(x) * fma(Float64(y * y), 0.16666666666666666, 1.0)) / x) * y); else tmp = Float64(sinh(y) * 1.0); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 4e-51], N[(N[(N[(N[Sin[x], $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right)}{x} \cdot y\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-51}:\\
\;\;\;\;\frac{\sin x \cdot \mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right)}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot 1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6453.8
Applied rewrites53.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6432.0
Applied rewrites32.0%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 4e-51Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-sin.f64N/A
*-commutativeN/A
+-commutativeN/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6480.7
Applied rewrites80.7%
if 4e-51 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites63.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 (- INFINITY))
(*
(/
(*
(* (* y y) 0.16666666666666666)
(* (fma -0.16666666666666666 (* x x) 1.0) x))
x)
y)
(if (<= t_0 4e-51) (* (/ (sin x) x) y) (* (sinh y) 1.0)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((((y * y) * 0.16666666666666666) * (fma(-0.16666666666666666, (x * x), 1.0) * x)) / x) * y;
} else if (t_0 <= 4e-51) {
tmp = (sin(x) / x) * y;
} else {
tmp = sinh(y) * 1.0;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x)) / x) * y); elseif (t_0 <= 4e-51) tmp = Float64(Float64(sin(x) / x) * y); else tmp = Float64(sinh(y) * 1.0); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 4e-51], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\frac{\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right)}{x} \cdot y\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{-51}:\\
\;\;\;\;\frac{\sin x}{x} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot 1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6453.8
Applied rewrites53.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6432.0
Applied rewrites32.0%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 4e-51Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f6451.8
Applied rewrites51.8%
if 4e-51 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites63.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -2e-310)
(*
(/
(*
(* (* y y) 0.16666666666666666)
(* (fma -0.16666666666666666 (* x x) 1.0) x))
x)
y)
(if (<= t_0 2e-263)
(* x (/ y x))
(*
(sinh y)
(fma
(- (* (* x x) 0.008333333333333333) 0.16666666666666666)
(* x x)
1.0))))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -2e-310) {
tmp = ((((y * y) * 0.16666666666666666) * (fma(-0.16666666666666666, (x * x), 1.0) * x)) / x) * y;
} else if (t_0 <= 2e-263) {
tmp = x * (y / x);
} else {
tmp = sinh(y) * fma((((x * x) * 0.008333333333333333) - 0.16666666666666666), (x * x), 1.0);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -2e-310) tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x)) / x) * y); elseif (t_0 <= 2e-263) tmp = Float64(x * Float64(y / x)); else tmp = Float64(sinh(y) * fma(Float64(Float64(Float64(x * x) * 0.008333333333333333) - 0.16666666666666666), Float64(x * x), 1.0)); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-310], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 2e-263], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * N[(N[(N[(N[(x * x), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right)}{x} \cdot y\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-263}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot \mathsf{fma}\left(\left(x \cdot x\right) \cdot 0.008333333333333333 - 0.16666666666666666, x \cdot x, 1\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.999999999999994e-310Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6453.8
Applied rewrites53.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6432.0
Applied rewrites32.0%
if -1.999999999999994e-310 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 2e-263Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 2e-263 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
*-commutativeN/A
pow2N/A
pow2N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-fma.f6462.4
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6462.4
Applied rewrites62.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -2e-310)
(*
(/
(*
(* (* y y) 0.16666666666666666)
(* (fma -0.16666666666666666 (* x x) 1.0) x))
x)
y)
(if (<= t_0 1e-314) (* x (/ y x)) (* (sinh y) 1.0)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -2e-310) {
tmp = ((((y * y) * 0.16666666666666666) * (fma(-0.16666666666666666, (x * x), 1.0) * x)) / x) * y;
} else if (t_0 <= 1e-314) {
tmp = x * (y / x);
} else {
tmp = sinh(y) * 1.0;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -2e-310) tmp = Float64(Float64(Float64(Float64(Float64(y * y) * 0.16666666666666666) * Float64(fma(-0.16666666666666666, Float64(x * x), 1.0) * x)) / x) * y); elseif (t_0 <= 1e-314) tmp = Float64(x * Float64(y / x)); else tmp = Float64(sinh(y) * 1.0); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-310], N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 1e-314], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{\left(\left(y \cdot y\right) \cdot 0.16666666666666666\right) \cdot \left(\mathsf{fma}\left(-0.16666666666666666, x \cdot x, 1\right) \cdot x\right)}{x} \cdot y\\
\mathbf{elif}\;t\_0 \leq 10^{-314}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot 1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.999999999999994e-310Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6453.8
Applied rewrites53.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6432.0
Applied rewrites32.0%
if -1.999999999999994e-310 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 9.9999999996e-315Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 9.9999999996e-315 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites63.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -2e-310)
(* (* (* (* y y) 0.3333333333333333) y) (* (* x x) -0.08333333333333333))
(if (<= t_0 1e-314) (* x (/ y x)) (* (sinh y) 1.0)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -2e-310) {
tmp = (((y * y) * 0.3333333333333333) * y) * ((x * x) * -0.08333333333333333);
} else if (t_0 <= 1e-314) {
tmp = x * (y / x);
} else {
tmp = sinh(y) * 1.0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = (sin(x) * sinh(y)) / x
if (t_0 <= (-2d-310)) then
tmp = (((y * y) * 0.3333333333333333d0) * y) * ((x * x) * (-0.08333333333333333d0))
else if (t_0 <= 1d-314) then
tmp = x * (y / x)
else
tmp = sinh(y) * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (Math.sin(x) * Math.sinh(y)) / x;
double tmp;
if (t_0 <= -2e-310) {
tmp = (((y * y) * 0.3333333333333333) * y) * ((x * x) * -0.08333333333333333);
} else if (t_0 <= 1e-314) {
tmp = x * (y / x);
} else {
tmp = Math.sinh(y) * 1.0;
}
return tmp;
}
def code(x, y): t_0 = (math.sin(x) * math.sinh(y)) / x tmp = 0 if t_0 <= -2e-310: tmp = (((y * y) * 0.3333333333333333) * y) * ((x * x) * -0.08333333333333333) elif t_0 <= 1e-314: tmp = x * (y / x) else: tmp = math.sinh(y) * 1.0 return tmp
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -2e-310) tmp = Float64(Float64(Float64(Float64(y * y) * 0.3333333333333333) * y) * Float64(Float64(x * x) * -0.08333333333333333)); elseif (t_0 <= 1e-314) tmp = Float64(x * Float64(y / x)); else tmp = Float64(sinh(y) * 1.0); end return tmp end
function tmp_2 = code(x, y) t_0 = (sin(x) * sinh(y)) / x; tmp = 0.0; if (t_0 <= -2e-310) tmp = (((y * y) * 0.3333333333333333) * y) * ((x * x) * -0.08333333333333333); elseif (t_0 <= 1e-314) tmp = x * (y / x); else tmp = sinh(y) * 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-310], N[(N[(N[(N[(y * y), $MachinePrecision] * 0.3333333333333333), $MachinePrecision] * y), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e-314], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(\left(y \cdot y\right) \cdot 0.3333333333333333\right) \cdot y\right) \cdot \left(\left(x \cdot x\right) \cdot -0.08333333333333333\right)\\
\mathbf{elif}\;t\_0 \leq 10^{-314}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot 1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -1.999999999999994e-310Initial program 89.1%
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-*.f6462.4
Applied rewrites62.4%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.6
Applied rewrites53.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6433.2
Applied rewrites33.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6415.9
Applied rewrites15.9%
if -1.999999999999994e-310 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 9.9999999996e-315Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 9.9999999996e-315 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites63.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -5e-210)
(/ (* (* (* (* x x) -0.16666666666666666) x) y) x)
(if (<= t_0 1e-314) (* x (/ y x)) (* (sinh y) 1.0)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -5e-210) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y) / x;
} else if (t_0 <= 1e-314) {
tmp = x * (y / x);
} else {
tmp = sinh(y) * 1.0;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: tmp
t_0 = (sin(x) * sinh(y)) / x
if (t_0 <= (-5d-210)) then
tmp = ((((x * x) * (-0.16666666666666666d0)) * x) * y) / x
else if (t_0 <= 1d-314) then
tmp = x * (y / x)
else
tmp = sinh(y) * 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (Math.sin(x) * Math.sinh(y)) / x;
double tmp;
if (t_0 <= -5e-210) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y) / x;
} else if (t_0 <= 1e-314) {
tmp = x * (y / x);
} else {
tmp = Math.sinh(y) * 1.0;
}
return tmp;
}
def code(x, y): t_0 = (math.sin(x) * math.sinh(y)) / x tmp = 0 if t_0 <= -5e-210: tmp = ((((x * x) * -0.16666666666666666) * x) * y) / x elif t_0 <= 1e-314: tmp = x * (y / x) else: tmp = math.sinh(y) * 1.0 return tmp
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -5e-210) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * -0.16666666666666666) * x) * y) / x); elseif (t_0 <= 1e-314) tmp = Float64(x * Float64(y / x)); else tmp = Float64(sinh(y) * 1.0); end return tmp end
function tmp_2 = code(x, y) t_0 = (sin(x) * sinh(y)) / x; tmp = 0.0; if (t_0 <= -5e-210) tmp = ((((x * x) * -0.16666666666666666) * x) * y) / x; elseif (t_0 <= 1e-314) tmp = x * (y / x); else tmp = sinh(y) * 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-210], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[t$95$0, 1e-314], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-210}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot x\right) \cdot y}{x}\\
\mathbf{elif}\;t\_0 \leq 10^{-314}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\sinh y \cdot 1\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -5.0000000000000002e-210Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6425.8
Applied rewrites25.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6412.5
Applied rewrites12.5%
if -5.0000000000000002e-210 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 9.9999999996e-315Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 9.9999999996e-315 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-sinh.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sinh.f64N/A
lower-/.f64N/A
lift-sin.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites63.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -5e-210)
(/ (* (* (* (* x x) -0.16666666666666666) x) y) x)
(if (<= t_0 2e-263)
(* x (/ y x))
(* (fma (* y y) 0.16666666666666666 1.0) y)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -5e-210) {
tmp = ((((x * x) * -0.16666666666666666) * x) * y) / x;
} else if (t_0 <= 2e-263) {
tmp = x * (y / x);
} else {
tmp = fma((y * y), 0.16666666666666666, 1.0) * y;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -5e-210) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * -0.16666666666666666) * x) * y) / x); elseif (t_0 <= 2e-263) tmp = Float64(x * Float64(y / x)); else tmp = Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) * y); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-210], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[t$95$0, 2e-263], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-210}:\\
\;\;\;\;\frac{\left(\left(\left(x \cdot x\right) \cdot -0.16666666666666666\right) \cdot x\right) \cdot y}{x}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-263}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right) \cdot y\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -5.0000000000000002e-210Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6425.8
Applied rewrites25.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6412.5
Applied rewrites12.5%
if -5.0000000000000002e-210 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 2e-263Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 2e-263 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6451.3
Applied rewrites51.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (sin x) (sinh y)) x)))
(if (<= t_0 -5e-210)
(* (+ y y) (fma (* x x) -0.08333333333333333 0.5))
(if (<= t_0 2e-263)
(* x (/ y x))
(* (fma (* y y) 0.16666666666666666 1.0) y)))))
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (t_0 <= -5e-210) {
tmp = (y + y) * fma((x * x), -0.08333333333333333, 0.5);
} else if (t_0 <= 2e-263) {
tmp = x * (y / x);
} else {
tmp = fma((y * y), 0.16666666666666666, 1.0) * y;
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (t_0 <= -5e-210) tmp = Float64(Float64(y + y) * fma(Float64(x * x), -0.08333333333333333, 0.5)); elseif (t_0 <= 2e-263) tmp = Float64(x * Float64(y / x)); else tmp = Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) * y); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-210], N[(N[(y + y), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-263], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-210}:\\
\;\;\;\;\left(y + y\right) \cdot \mathsf{fma}\left(x \cdot x, -0.08333333333333333, 0.5\right)\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-263}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right) \cdot y\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -5.0000000000000002e-210Initial program 89.1%
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-*.f6462.4
Applied rewrites62.4%
Taylor expanded in y around 0
count-2-revN/A
lower-+.f6435.6
Applied rewrites35.6%
if -5.0000000000000002e-210 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 2e-263Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 2e-263 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6451.3
Applied rewrites51.3%
(FPCore (x y) :precision binary64 (if (<= y 3.1e+97) (* x (/ y x)) (* (fma (* y y) 0.16666666666666666 1.0) y)))
double code(double x, double y) {
double tmp;
if (y <= 3.1e+97) {
tmp = x * (y / x);
} else {
tmp = fma((y * y), 0.16666666666666666, 1.0) * y;
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 3.1e+97) tmp = Float64(x * Float64(y / x)); else tmp = Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) * y); end return tmp end
code[x_, y_] := If[LessEqual[y, 3.1e+97], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.1 \cdot 10^{+97}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right) \cdot y\\
\end{array}
\end{array}
if y < 3.09999999999999981e97Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
if 3.09999999999999981e97 < y Initial program 89.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites80.7%
Taylor expanded in x around 0
*-commutativeN/A
pow2N/A
+-commutativeN/A
lift-fma.f64N/A
lift-*.f6451.3
Applied rewrites51.3%
(FPCore (x y) :precision binary64 (* x (/ y x)))
double code(double x, double y) {
return x * (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 = x * (y / x)
end function
public static double code(double x, double y) {
return x * (y / x);
}
def code(x, y): return x * (y / x)
function code(x, y) return Float64(x * Float64(y / x)) end
function tmp = code(x, y) tmp = x * (y / x); end
code[x_, y_] := N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{x}
\end{array}
Initial program 89.1%
Taylor expanded in y around 0
Applied rewrites41.0%
Taylor expanded in x around 0
Applied rewrites22.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6450.0
Applied rewrites50.0%
(FPCore (x y) :precision binary64 (* (+ y y) 0.5))
double code(double x, double y) {
return (y + y) * 0.5;
}
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 = (y + y) * 0.5d0
end function
public static double code(double x, double y) {
return (y + y) * 0.5;
}
def code(x, y): return (y + y) * 0.5
function code(x, y) return Float64(Float64(y + y) * 0.5) end
function tmp = code(x, y) tmp = (y + y) * 0.5; end
code[x_, y_] := N[(N[(y + y), $MachinePrecision] * 0.5), $MachinePrecision]
\begin{array}{l}
\\
\left(y + y\right) \cdot 0.5
\end{array}
Initial program 89.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
rec-expN/A
sinh-undefN/A
lower-*.f64N/A
lift-sinh.f6463.1
Applied rewrites63.1%
Taylor expanded in y around 0
count-2-revN/A
lower-+.f6427.6
Applied rewrites27.6%
herbie shell --seed 2025131
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
(/ (* (sin x) (sinh y)) x))