
(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]
\frac{\sin x \cdot \sinh y}{x}
Herbie found 13 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]
\frac{\sin x \cdot \sinh y}{x}
(FPCore (x y) :precision binary64 (/ (sinh y) (/ x (sin x))))
double code(double x, double y) {
return sinh(y) / (x / sin(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) / (x / sin(x))
end function
public static double code(double x, double y) {
return Math.sinh(y) / (x / Math.sin(x));
}
def code(x, y): return math.sinh(y) / (x / math.sin(x))
function code(x, y) return Float64(sinh(y) / Float64(x / sin(x))) end
function tmp = code(x, y) tmp = sinh(y) / (x / sin(x)); end
code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{\sinh y}{\frac{x}{\sin x}}
Initial program 88.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-/r/N/A
div-flip-revN/A
mult-flipN/A
associate-*l/N/A
mult-flipN/A
div-flip-revN/A
lower-/.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y) :precision binary64 (* (/ (sin x) x) (sinh y)))
double code(double x, double y) {
return (sin(x) / x) * sinh(y);
}
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) / x) * sinh(y)
end function
public static double code(double x, double y) {
return (Math.sin(x) / x) * Math.sinh(y);
}
def code(x, y): return (math.sin(x) / x) * math.sinh(y)
function code(x, y) return Float64(Float64(sin(x) / x) * sinh(y)) end
function tmp = code(x, y) tmp = (sin(x) / x) * sinh(y); end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision]
\frac{\sin x}{x} \cdot \sinh y
Initial program 88.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6499.9
Applied rewrites99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))) (t_1 (/ (* (sin x) t_0) x)))
(*
(copysign 1.0 y)
(if (<= t_1 (- INFINITY))
(* (+ 1.0 (* -0.16666666666666666 (pow x 2.0))) t_0)
(if (<= t_1 1e-11)
(/ (fabs y) (/ x (sin x)))
(/ 1.0 (/ x (* x t_0))))))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double t_1 = (sin(x) * t_0) / x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.16666666666666666 * pow(x, 2.0))) * t_0;
} else if (t_1 <= 1e-11) {
tmp = fabs(y) / (x / sin(x));
} else {
tmp = 1.0 / (x / (x * t_0));
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double t_1 = (Math.sin(x) * t_0) / x;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0))) * t_0;
} else if (t_1 <= 1e-11) {
tmp = Math.abs(y) / (x / Math.sin(x));
} else {
tmp = 1.0 / (x / (x * t_0));
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) t_1 = (math.sin(x) * t_0) / x tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.16666666666666666 * math.pow(x, 2.0))) * t_0 elif t_1 <= 1e-11: tmp = math.fabs(y) / (x / math.sin(x)) else: tmp = 1.0 / (x / (x * t_0)) return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) t_1 = Float64(Float64(sin(x) * t_0) / x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0))) * t_0); elseif (t_1 <= 1e-11) tmp = Float64(abs(y) / Float64(x / sin(x))); else tmp = Float64(1.0 / Float64(x / Float64(x * t_0))); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); t_1 = (sin(x) * t_0) / x; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.16666666666666666 * (x ^ 2.0))) * t_0; elseif (t_1 <= 1e-11) tmp = abs(y) / (x / sin(x)); else tmp = 1.0 / (x / (x * t_0)); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, (-Infinity)], N[(N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 1e-11], N[(N[Abs[y], $MachinePrecision] / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
t_1 := \frac{\sin x \cdot t\_0}{x}\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot {x}^{2}\right) \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-11}:\\
\;\;\;\;\frac{\left|y\right|}{\frac{x}{\sin x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{x \cdot t\_0}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 88.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.0
Applied rewrites62.0%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 9.99999999999999939e-12Initial program 88.6%
Taylor expanded in y around 0
Applied rewrites41.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.9
Applied rewrites63.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
div-flip-revN/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6452.5
Applied rewrites52.5%
if 9.99999999999999939e-12 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6451.3
Applied rewrites51.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))) (t_1 (/ (* (sin x) t_0) x)))
(*
(copysign 1.0 y)
(if (<= t_1 (- INFINITY))
(* (+ 1.0 (* -0.16666666666666666 (pow x 2.0))) t_0)
(if (<= t_1 1e-11)
(* (/ (sin x) x) (fabs y))
(/ 1.0 (/ x (* x t_0))))))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double t_1 = (sin(x) * t_0) / x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.16666666666666666 * pow(x, 2.0))) * t_0;
} else if (t_1 <= 1e-11) {
tmp = (sin(x) / x) * fabs(y);
} else {
tmp = 1.0 / (x / (x * t_0));
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double t_1 = (Math.sin(x) * t_0) / x;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0))) * t_0;
} else if (t_1 <= 1e-11) {
tmp = (Math.sin(x) / x) * Math.abs(y);
} else {
tmp = 1.0 / (x / (x * t_0));
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) t_1 = (math.sin(x) * t_0) / x tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.16666666666666666 * math.pow(x, 2.0))) * t_0 elif t_1 <= 1e-11: tmp = (math.sin(x) / x) * math.fabs(y) else: tmp = 1.0 / (x / (x * t_0)) return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) t_1 = Float64(Float64(sin(x) * t_0) / x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0))) * t_0); elseif (t_1 <= 1e-11) tmp = Float64(Float64(sin(x) / x) * abs(y)); else tmp = Float64(1.0 / Float64(x / Float64(x * t_0))); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); t_1 = (sin(x) * t_0) / x; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.16666666666666666 * (x ^ 2.0))) * t_0; elseif (t_1 <= 1e-11) tmp = (sin(x) / x) * abs(y); else tmp = 1.0 / (x / (x * t_0)); end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, (-Infinity)], N[(N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 1e-11], N[(N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x / N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
t_1 := \frac{\sin x \cdot t\_0}{x}\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot {x}^{2}\right) \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-11}:\\
\;\;\;\;\frac{\sin x}{x} \cdot \left|y\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{x \cdot t\_0}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 88.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.0
Applied rewrites62.0%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 9.99999999999999939e-12Initial program 88.6%
Taylor expanded in y around 0
Applied rewrites41.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
if 9.99999999999999939e-12 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6451.3
Applied rewrites51.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))) (t_1 (/ (* (sin x) t_0) x)))
(*
(copysign 1.0 y)
(if (<= t_1 (- INFINITY))
(* (+ 1.0 (* -0.16666666666666666 (pow x 2.0))) t_0)
(if (<= t_1 2e-112) (* (/ (fabs y) x) (sin x)) t_0)))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double t_1 = (sin(x) * t_0) / x;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.16666666666666666 * pow(x, 2.0))) * t_0;
} else if (t_1 <= 2e-112) {
tmp = (fabs(y) / x) * sin(x);
} else {
tmp = t_0;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double t_1 = (Math.sin(x) * t_0) / x;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0))) * t_0;
} else if (t_1 <= 2e-112) {
tmp = (Math.abs(y) / x) * Math.sin(x);
} else {
tmp = t_0;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) t_1 = (math.sin(x) * t_0) / x tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.16666666666666666 * math.pow(x, 2.0))) * t_0 elif t_1 <= 2e-112: tmp = (math.fabs(y) / x) * math.sin(x) else: tmp = t_0 return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) t_1 = Float64(Float64(sin(x) * t_0) / x) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0))) * t_0); elseif (t_1 <= 2e-112) tmp = Float64(Float64(abs(y) / x) * sin(x)); else tmp = t_0; end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); t_1 = (sin(x) * t_0) / x; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.16666666666666666 * (x ^ 2.0))) * t_0; elseif (t_1 <= 2e-112) tmp = (abs(y) / x) * sin(x); else tmp = t_0; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$1, (-Infinity)], N[(N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[t$95$1, 2e-112], N[(N[(N[Abs[y], $MachinePrecision] / x), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], t$95$0]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
t_1 := \frac{\sin x \cdot t\_0}{x}\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot {x}^{2}\right) \cdot t\_0\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-112}:\\
\;\;\;\;\frac{\left|y\right|}{x} \cdot \sin x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -inf.0Initial program 88.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.0
Applied rewrites62.0%
if -inf.0 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < 1.9999999999999999e-112Initial program 88.6%
Taylor expanded in y around 0
Applied rewrites41.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6463.9
Applied rewrites63.9%
if 1.9999999999999999e-112 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-exp.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift--.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
rec-expN/A
sinh-defN/A
lift-sinh.f6462.6
Applied rewrites62.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))))
(*
(copysign 1.0 y)
(if (<= (/ (* (sin x) t_0) x) -2e-200)
(* (+ 1.0 (* -0.16666666666666666 (pow x 2.0))) t_0)
(* (/ t_0 x) x)))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double tmp;
if (((sin(x) * t_0) / x) <= -2e-200) {
tmp = (1.0 + (-0.16666666666666666 * pow(x, 2.0))) * t_0;
} else {
tmp = (t_0 / x) * x;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double tmp;
if (((Math.sin(x) * t_0) / x) <= -2e-200) {
tmp = (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0))) * t_0;
} else {
tmp = (t_0 / x) * x;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) tmp = 0 if ((math.sin(x) * t_0) / x) <= -2e-200: tmp = (1.0 + (-0.16666666666666666 * math.pow(x, 2.0))) * t_0 else: tmp = (t_0 / x) * x return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) tmp = 0.0 if (Float64(Float64(sin(x) * t_0) / x) <= -2e-200) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0))) * t_0); else tmp = Float64(Float64(t_0 / x) * x); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); tmp = 0.0; if (((sin(x) * t_0) / x) <= -2e-200) tmp = (1.0 + (-0.16666666666666666 * (x ^ 2.0))) * t_0; else tmp = (t_0 / x) * x; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision], -2e-200], N[(N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(t$95$0 / x), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin x \cdot t\_0}{x} \leq -2 \cdot 10^{-200}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot {x}^{2}\right) \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -2e-200Initial program 88.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
mult-flip-revN/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6462.0
Applied rewrites62.0%
if -2e-200 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))))
(*
(copysign 1.0 y)
(if (<= (/ (* (sin x) t_0) x) -2e-200)
(/ (* (* x (+ 1.0 (* -0.16666666666666666 (pow x 2.0)))) (fabs y)) x)
(* (/ t_0 x) x)))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double tmp;
if (((sin(x) * t_0) / x) <= -2e-200) {
tmp = ((x * (1.0 + (-0.16666666666666666 * pow(x, 2.0)))) * fabs(y)) / x;
} else {
tmp = (t_0 / x) * x;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double tmp;
if (((Math.sin(x) * t_0) / x) <= -2e-200) {
tmp = ((x * (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0)))) * Math.abs(y)) / x;
} else {
tmp = (t_0 / x) * x;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) tmp = 0 if ((math.sin(x) * t_0) / x) <= -2e-200: tmp = ((x * (1.0 + (-0.16666666666666666 * math.pow(x, 2.0)))) * math.fabs(y)) / x else: tmp = (t_0 / x) * x return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) tmp = 0.0 if (Float64(Float64(sin(x) * t_0) / x) <= -2e-200) tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0)))) * abs(y)) / x); else tmp = Float64(Float64(t_0 / x) * x); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); tmp = 0.0; if (((sin(x) * t_0) / x) <= -2e-200) tmp = ((x * (1.0 + (-0.16666666666666666 * (x ^ 2.0)))) * abs(y)) / x; else tmp = (t_0 / x) * x; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision], -2e-200], N[(N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(t$95$0 / x), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin x \cdot t\_0}{x} \leq -2 \cdot 10^{-200}:\\
\;\;\;\;\frac{\left(x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)\right) \cdot \left|y\right|}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -2e-200Initial program 88.6%
Taylor expanded in y around 0
Applied rewrites41.3%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6425.8
Applied rewrites25.8%
if -2e-200 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))))
(*
(copysign 1.0 y)
(if (<= (/ (* (sin x) t_0) x) -2e-200)
(* (/ (* x (+ 1.0 (* -0.16666666666666666 (pow x 2.0)))) x) (fabs y))
(* (/ t_0 x) x)))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double tmp;
if (((sin(x) * t_0) / x) <= -2e-200) {
tmp = ((x * (1.0 + (-0.16666666666666666 * pow(x, 2.0)))) / x) * fabs(y);
} else {
tmp = (t_0 / x) * x;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double tmp;
if (((Math.sin(x) * t_0) / x) <= -2e-200) {
tmp = ((x * (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0)))) / x) * Math.abs(y);
} else {
tmp = (t_0 / x) * x;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) tmp = 0 if ((math.sin(x) * t_0) / x) <= -2e-200: tmp = ((x * (1.0 + (-0.16666666666666666 * math.pow(x, 2.0)))) / x) * math.fabs(y) else: tmp = (t_0 / x) * x return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) tmp = 0.0 if (Float64(Float64(sin(x) * t_0) / x) <= -2e-200) tmp = Float64(Float64(Float64(x * Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0)))) / x) * abs(y)); else tmp = Float64(Float64(t_0 / x) * x); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); tmp = 0.0; if (((sin(x) * t_0) / x) <= -2e-200) tmp = ((x * (1.0 + (-0.16666666666666666 * (x ^ 2.0)))) / x) * abs(y); else tmp = (t_0 / x) * x; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision], -2e-200], N[(N[(N[(x * N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / x), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin x \cdot t\_0}{x} \leq -2 \cdot 10^{-200}:\\
\;\;\;\;\frac{x \cdot \left(1 + -0.16666666666666666 \cdot {x}^{2}\right)}{x} \cdot \left|y\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -2e-200Initial program 88.6%
Taylor expanded in y around 0
Applied rewrites41.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
Taylor expanded in x around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.4
Applied rewrites36.4%
if -2e-200 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (sinh (fabs y))))
(*
(copysign 1.0 y)
(if (<= (/ (* (sin x) t_0) x) -2e-200)
(* (+ 1.0 (* -0.16666666666666666 (pow x 2.0))) (fabs y))
(* (/ t_0 x) x)))))double code(double x, double y) {
double t_0 = sinh(fabs(y));
double tmp;
if (((sin(x) * t_0) / x) <= -2e-200) {
tmp = (1.0 + (-0.16666666666666666 * pow(x, 2.0))) * fabs(y);
} else {
tmp = (t_0 / x) * x;
}
return copysign(1.0, y) * tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(Math.abs(y));
double tmp;
if (((Math.sin(x) * t_0) / x) <= -2e-200) {
tmp = (1.0 + (-0.16666666666666666 * Math.pow(x, 2.0))) * Math.abs(y);
} else {
tmp = (t_0 / x) * x;
}
return Math.copySign(1.0, y) * tmp;
}
def code(x, y): t_0 = math.sinh(math.fabs(y)) tmp = 0 if ((math.sin(x) * t_0) / x) <= -2e-200: tmp = (1.0 + (-0.16666666666666666 * math.pow(x, 2.0))) * math.fabs(y) else: tmp = (t_0 / x) * x return math.copysign(1.0, y) * tmp
function code(x, y) t_0 = sinh(abs(y)) tmp = 0.0 if (Float64(Float64(sin(x) * t_0) / x) <= -2e-200) tmp = Float64(Float64(1.0 + Float64(-0.16666666666666666 * (x ^ 2.0))) * abs(y)); else tmp = Float64(Float64(t_0 / x) * x); end return Float64(copysign(1.0, y) * tmp) end
function tmp_2 = code(x, y) t_0 = sinh(abs(y)); tmp = 0.0; if (((sin(x) * t_0) / x) <= -2e-200) tmp = (1.0 + (-0.16666666666666666 * (x ^ 2.0))) * abs(y); else tmp = (t_0 / x) * x; end tmp_2 = (sign(y) * abs(1.0)) * tmp; end
code[x_, y_] := Block[{t$95$0 = N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[y]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision] / x), $MachinePrecision], -2e-200], N[(N[(1.0 + N[(-0.16666666666666666 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / x), $MachinePrecision] * x), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \sinh \left(\left|y\right|\right)\\
\mathsf{copysign}\left(1, y\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{\sin x \cdot t\_0}{x} \leq -2 \cdot 10^{-200}:\\
\;\;\;\;\left(1 + -0.16666666666666666 \cdot {x}^{2}\right) \cdot \left|y\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{x} \cdot x\\
\end{array}
\end{array}
if (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) < -2e-200Initial program 88.6%
Taylor expanded in y around 0
Applied rewrites41.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6452.5
Applied rewrites52.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6436.2
Applied rewrites36.2%
if -2e-200 < (/.f64 (*.f64 (sin.f64 x) (sinh.f64 y)) x) Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (x y) :precision binary64 (* (/ (sinh y) x) x))
double code(double x, double y) {
return (sinh(y) / 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) / x) * x
end function
public static double code(double x, double y) {
return (Math.sinh(y) / x) * x;
}
def code(x, y): return (math.sinh(y) / x) * x
function code(x, y) return Float64(Float64(sinh(y) / x) * x) end
function tmp = code(x, y) tmp = (sinh(y) / x) * x; end
code[x_, y_] := N[(N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision] * x), $MachinePrecision]
\frac{\sinh y}{x} \cdot x
Initial program 88.6%
Taylor expanded in x around 0
Applied rewrites51.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6473.1
Applied rewrites73.1%
(FPCore (x y) :precision binary64 (if (<= (fabs x) 9.2e+181) (sinh y) (* 0.5 (- (+ 1.0 y) (/ 1.0 (+ 1.0 y))))))
double code(double x, double y) {
double tmp;
if (fabs(x) <= 9.2e+181) {
tmp = sinh(y);
} else {
tmp = 0.5 * ((1.0 + y) - (1.0 / (1.0 + y)));
}
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) :: tmp
if (abs(x) <= 9.2d+181) then
tmp = sinh(y)
else
tmp = 0.5d0 * ((1.0d0 + y) - (1.0d0 / (1.0d0 + y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.abs(x) <= 9.2e+181) {
tmp = Math.sinh(y);
} else {
tmp = 0.5 * ((1.0 + y) - (1.0 / (1.0 + y)));
}
return tmp;
}
def code(x, y): tmp = 0 if math.fabs(x) <= 9.2e+181: tmp = math.sinh(y) else: tmp = 0.5 * ((1.0 + y) - (1.0 / (1.0 + y))) return tmp
function code(x, y) tmp = 0.0 if (abs(x) <= 9.2e+181) tmp = sinh(y); else tmp = Float64(0.5 * Float64(Float64(1.0 + y) - Float64(1.0 / Float64(1.0 + y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (abs(x) <= 9.2e+181) tmp = sinh(y); else tmp = 0.5 * ((1.0 + y) - (1.0 / (1.0 + y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Abs[x], $MachinePrecision], 9.2e+181], N[Sinh[y], $MachinePrecision], N[(0.5 * N[(N[(1.0 + y), $MachinePrecision] - N[(1.0 / N[(1.0 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|x\right| \leq 9.2 \cdot 10^{+181}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(1 + y\right) - \frac{1}{1 + y}\right)\\
\end{array}
if x < 9.1999999999999995e181Initial program 88.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-exp.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift--.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
rec-expN/A
sinh-defN/A
lift-sinh.f6462.6
Applied rewrites62.6%
if 9.1999999999999995e181 < x Initial program 88.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-exp.f6451.6
Applied rewrites51.6%
Taylor expanded in y around 0
lower-+.f6433.9
Applied rewrites33.9%
Taylor expanded in y around 0
lower-+.f6416.9
Applied rewrites16.9%
(FPCore (x y) :precision binary64 (sinh y))
double code(double x, double y) {
return sinh(y);
}
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)
end function
public static double code(double x, double y) {
return Math.sinh(y);
}
def code(x, y): return math.sinh(y)
function code(x, y) return sinh(y) end
function tmp = code(x, y) tmp = sinh(y); end
code[x_, y_] := N[Sinh[y], $MachinePrecision]
\sinh y
Initial program 88.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-exp.f6451.6
Applied rewrites51.6%
lift-*.f64N/A
*-commutativeN/A
metadata-evalN/A
mult-flipN/A
lift--.f64N/A
lift-exp.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
rec-expN/A
sinh-defN/A
lift-sinh.f6462.6
Applied rewrites62.6%
(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]
\left(y + y\right) \cdot 0.5
Initial program 88.6%
Taylor expanded in x around 0
lower-*.f64N/A
lower--.f64N/A
lower-exp.f64N/A
lower-/.f64N/A
lower-exp.f6451.6
Applied rewrites51.6%
Taylor expanded in y around 0
lower-*.f6428.0
Applied rewrites28.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6428.0
lift-*.f64N/A
count-2-revN/A
lower-+.f6428.0
Applied rewrites28.0%
herbie shell --seed 2025172
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
(/ (* (sin x) (sinh y)) x))