
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / 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 = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\cos x \cdot \frac{\sinh y}{y}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / 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 = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\cos x \cdot \frac{\sinh y}{y}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)) (t_1 (* (cos x) t_0)))
(if (<= t_1 (- INFINITY))
(*
(+ 1 (* -1/2 (pow x 2)))
(- (* (sqrt (* (* (* y y) y) y)) 1/6) -1))
(if (<= t_1 9007199254740991/9007199254740992)
(*
(cos x)
(/ (- (* (* 1/36 (* y y)) (* y y)) 1) (- (* (* y y) 1/6) 1)))
(* 1 t_0)))))double code(double x, double y) {
double t_0 = sinh(y) / y;
double t_1 = cos(x) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.5 * pow(x, 2.0))) * ((sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0);
} else if (t_1 <= 0.9999999999999999) {
tmp = cos(x) * ((((0.027777777777777776 * (y * y)) * (y * y)) - 1.0) / (((y * y) * 0.16666666666666666) - 1.0));
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double t_1 = Math.cos(x) * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.5 * Math.pow(x, 2.0))) * ((Math.sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0);
} else if (t_1 <= 0.9999999999999999) {
tmp = Math.cos(x) * ((((0.027777777777777776 * (y * y)) * (y * y)) - 1.0) / (((y * y) * 0.16666666666666666) - 1.0));
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y t_1 = math.cos(x) * t_0 tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.5 * math.pow(x, 2.0))) * ((math.sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0) elif t_1 <= 0.9999999999999999: tmp = math.cos(x) * ((((0.027777777777777776 * (y * y)) * (y * y)) - 1.0) / (((y * y) * 0.16666666666666666) - 1.0)) else: tmp = 1.0 * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(cos(x) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.5 * (x ^ 2.0))) * Float64(Float64(sqrt(Float64(Float64(Float64(y * y) * y) * y)) * 0.16666666666666666) - -1.0)); elseif (t_1 <= 0.9999999999999999) tmp = Float64(cos(x) * Float64(Float64(Float64(Float64(0.027777777777777776 * Float64(y * y)) * Float64(y * y)) - 1.0) / Float64(Float64(Float64(y * y) * 0.16666666666666666) - 1.0))); else tmp = Float64(1.0 * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; t_1 = cos(x) * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.5 * (x ^ 2.0))) * ((sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0); elseif (t_1 <= 0.9999999999999999) tmp = cos(x) * ((((0.027777777777777776 * (y * y)) * (y * y)) - 1.0) / (((y * y) * 0.16666666666666666) - 1.0)); else tmp = 1.0 * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(1 + N[(-1/2 * N[Power[x, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 9007199254740991/9007199254740992], N[(N[Cos[x], $MachinePrecision] * N[(N[(N[(N[(1/36 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision] - 1), $MachinePrecision] / N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
t_1 := \cos x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \left(\sqrt{\left(\left(y \cdot y\right) \cdot y\right) \cdot y} \cdot \frac{1}{6} - -1\right)\\
\mathbf{elif}\;t\_1 \leq \frac{9007199254740991}{9007199254740992}:\\
\;\;\;\;\cos x \cdot \frac{\left(\frac{1}{36} \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot y\right) - 1}{\left(y \cdot y\right) \cdot \frac{1}{6} - 1}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_0\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow3N/A
cube-unmultN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
cube-unmultN/A
pow3N/A
lift-*.f64N/A
lower-*.f6456.3%
Applied rewrites56.3%
if -inf.0 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < 0.99999999999999989Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lower-unsound--.f6462.6%
Applied rewrites62.6%
lower-unsound-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
metadata-evalN/A
lower-unsound-*.f6462.6%
lift-*.f64N/A
metadata-eval62.6%
Applied rewrites62.6%
if 0.99999999999999989 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* 1/36 (* y y)) (* y y)))
(t_1 (/ (sinh y) y))
(t_2 (* (cos x) t_1)))
(if (<= t_2 (- INFINITY))
(*
(+ 1 (* -1/2 (pow x 2)))
(- (* (sqrt (* (* (* y y) y) y)) 1/6) -1))
(if (<= t_2 9007199254740991/9007199254740992)
(*
(cos x)
(/ (- (sqrt (* t_0 t_0)) (* 1 1)) (- (* (* y y) 1/6) 1)))
(* 1 t_1)))))double code(double x, double y) {
double t_0 = (0.027777777777777776 * (y * y)) * (y * y);
double t_1 = sinh(y) / y;
double t_2 = cos(x) * t_1;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.5 * pow(x, 2.0))) * ((sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0);
} else if (t_2 <= 0.9999999999999999) {
tmp = cos(x) * ((sqrt((t_0 * t_0)) - (1.0 * 1.0)) / (((y * y) * 0.16666666666666666) - 1.0));
} else {
tmp = 1.0 * t_1;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = (0.027777777777777776 * (y * y)) * (y * y);
double t_1 = Math.sinh(y) / y;
double t_2 = Math.cos(x) * t_1;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.5 * Math.pow(x, 2.0))) * ((Math.sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0);
} else if (t_2 <= 0.9999999999999999) {
tmp = Math.cos(x) * ((Math.sqrt((t_0 * t_0)) - (1.0 * 1.0)) / (((y * y) * 0.16666666666666666) - 1.0));
} else {
tmp = 1.0 * t_1;
}
return tmp;
}
def code(x, y): t_0 = (0.027777777777777776 * (y * y)) * (y * y) t_1 = math.sinh(y) / y t_2 = math.cos(x) * t_1 tmp = 0 if t_2 <= -math.inf: tmp = (1.0 + (-0.5 * math.pow(x, 2.0))) * ((math.sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0) elif t_2 <= 0.9999999999999999: tmp = math.cos(x) * ((math.sqrt((t_0 * t_0)) - (1.0 * 1.0)) / (((y * y) * 0.16666666666666666) - 1.0)) else: tmp = 1.0 * t_1 return tmp
function code(x, y) t_0 = Float64(Float64(0.027777777777777776 * Float64(y * y)) * Float64(y * y)) t_1 = Float64(sinh(y) / y) t_2 = Float64(cos(x) * t_1) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.5 * (x ^ 2.0))) * Float64(Float64(sqrt(Float64(Float64(Float64(y * y) * y) * y)) * 0.16666666666666666) - -1.0)); elseif (t_2 <= 0.9999999999999999) tmp = Float64(cos(x) * Float64(Float64(sqrt(Float64(t_0 * t_0)) - Float64(1.0 * 1.0)) / Float64(Float64(Float64(y * y) * 0.16666666666666666) - 1.0))); else tmp = Float64(1.0 * t_1); end return tmp end
function tmp_2 = code(x, y) t_0 = (0.027777777777777776 * (y * y)) * (y * y); t_1 = sinh(y) / y; t_2 = cos(x) * t_1; tmp = 0.0; if (t_2 <= -Inf) tmp = (1.0 + (-0.5 * (x ^ 2.0))) * ((sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0); elseif (t_2 <= 0.9999999999999999) tmp = cos(x) * ((sqrt((t_0 * t_0)) - (1.0 * 1.0)) / (((y * y) * 0.16666666666666666) - 1.0)); else tmp = 1.0 * t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(1/36 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[x], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(N[(1 + N[(-1/2 * N[Power[x, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 9007199254740991/9007199254740992], N[(N[Cos[x], $MachinePrecision] * N[(N[(N[Sqrt[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision] - N[(1 * 1), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1 * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \left(\frac{1}{36} \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot y\right)\\
t_1 := \frac{\sinh y}{y}\\
t_2 := \cos x \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \left(\sqrt{\left(\left(y \cdot y\right) \cdot y\right) \cdot y} \cdot \frac{1}{6} - -1\right)\\
\mathbf{elif}\;t\_2 \leq \frac{9007199254740991}{9007199254740992}:\\
\;\;\;\;\cos x \cdot \frac{\sqrt{t\_0 \cdot t\_0} - 1 \cdot 1}{\left(y \cdot y\right) \cdot \frac{1}{6} - 1}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_1\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow3N/A
cube-unmultN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
cube-unmultN/A
pow3N/A
lift-*.f64N/A
lower-*.f6456.3%
Applied rewrites56.3%
if -inf.0 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < 0.99999999999999989Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
flip-+N/A
lower-unsound-/.f64N/A
lower-unsound--.f64N/A
lower-unsound-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lower-unsound-*.f64N/A
lower-unsound--.f6462.6%
Applied rewrites62.6%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-sqrt.f64N/A
lower-unsound-*.f6468.2%
Applied rewrites68.2%
if 0.99999999999999989 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)) (t_1 (* (cos x) t_0)))
(if (<= t_1 (- INFINITY))
(*
(+ 1 (* -1/2 (pow x 2)))
(- (* (sqrt (* (* (* y y) y) y)) 1/6) -1))
(if (<= t_1 9007199254740991/9007199254740992)
(* (cos x) (- (* (* y y) 1/6) -1))
(* 1 t_0)))))double code(double x, double y) {
double t_0 = sinh(y) / y;
double t_1 = cos(x) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.5 * pow(x, 2.0))) * ((sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0);
} else if (t_1 <= 0.9999999999999999) {
tmp = cos(x) * (((y * y) * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double t_1 = Math.cos(x) * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.5 * Math.pow(x, 2.0))) * ((Math.sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0);
} else if (t_1 <= 0.9999999999999999) {
tmp = Math.cos(x) * (((y * y) * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y t_1 = math.cos(x) * t_0 tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.5 * math.pow(x, 2.0))) * ((math.sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0) elif t_1 <= 0.9999999999999999: tmp = math.cos(x) * (((y * y) * 0.16666666666666666) - -1.0) else: tmp = 1.0 * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(cos(x) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.5 * (x ^ 2.0))) * Float64(Float64(sqrt(Float64(Float64(Float64(y * y) * y) * y)) * 0.16666666666666666) - -1.0)); elseif (t_1 <= 0.9999999999999999) tmp = Float64(cos(x) * Float64(Float64(Float64(y * y) * 0.16666666666666666) - -1.0)); else tmp = Float64(1.0 * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; t_1 = cos(x) * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.5 * (x ^ 2.0))) * ((sqrt((((y * y) * y) * y)) * 0.16666666666666666) - -1.0); elseif (t_1 <= 0.9999999999999999) tmp = cos(x) * (((y * y) * 0.16666666666666666) - -1.0); else tmp = 1.0 * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(1 + N[(-1/2 * N[Power[x, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[Sqrt[N[(N[(N[(y * y), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 9007199254740991/9007199254740992], N[(N[Cos[x], $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
t_1 := \cos x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot {x}^{2}\right) \cdot \left(\sqrt{\left(\left(y \cdot y\right) \cdot y\right) \cdot y} \cdot \frac{1}{6} - -1\right)\\
\mathbf{elif}\;t\_1 \leq \frac{9007199254740991}{9007199254740992}:\\
\;\;\;\;\cos x \cdot \left(\left(y \cdot y\right) \cdot \frac{1}{6} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_0\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
pow3N/A
cube-unmultN/A
lift-*.f64N/A
lower-*.f64N/A
lift-*.f64N/A
cube-unmultN/A
pow3N/A
lift-*.f64N/A
lower-*.f6456.3%
Applied rewrites56.3%
if -inf.0 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < 0.99999999999999989Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
if 0.99999999999999989 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (sinh y) y))
(t_1 (* (cos x) t_0))
(t_2 (- (* (* y y) 1/6) -1)))
(if (<= t_1 (- INFINITY))
(* (+ 1 (* -1/2 (sqrt (* (* x x) (* x x))))) t_2)
(if (<= t_1 9007199254740991/9007199254740992)
(* (cos x) t_2)
(* 1 t_0)))))double code(double x, double y) {
double t_0 = sinh(y) / y;
double t_1 = cos(x) * t_0;
double t_2 = ((y * y) * 0.16666666666666666) - -1.0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * t_2;
} else if (t_1 <= 0.9999999999999999) {
tmp = cos(x) * t_2;
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double t_1 = Math.cos(x) * t_0;
double t_2 = ((y * y) * 0.16666666666666666) - -1.0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.5 * Math.sqrt(((x * x) * (x * x))))) * t_2;
} else if (t_1 <= 0.9999999999999999) {
tmp = Math.cos(x) * t_2;
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y t_1 = math.cos(x) * t_0 t_2 = ((y * y) * 0.16666666666666666) - -1.0 tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.5 * math.sqrt(((x * x) * (x * x))))) * t_2 elif t_1 <= 0.9999999999999999: tmp = math.cos(x) * t_2 else: tmp = 1.0 * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(cos(x) * t_0) t_2 = Float64(Float64(Float64(y * y) * 0.16666666666666666) - -1.0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.5 * sqrt(Float64(Float64(x * x) * Float64(x * x))))) * t_2); elseif (t_1 <= 0.9999999999999999) tmp = Float64(cos(x) * t_2); else tmp = Float64(1.0 * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; t_1 = cos(x) * t_0; t_2 = ((y * y) * 0.16666666666666666) - -1.0; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * t_2; elseif (t_1 <= 0.9999999999999999) tmp = cos(x) * t_2; else tmp = 1.0 * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(1 + N[(-1/2 * N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 9007199254740991/9007199254740992], N[(N[Cos[x], $MachinePrecision] * t$95$2), $MachinePrecision], N[(1 * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
t_1 := \cos x \cdot t\_0\\
t_2 := \left(y \cdot y\right) \cdot \frac{1}{6} - -1\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right) \cdot t\_2\\
\mathbf{elif}\;t\_1 \leq \frac{9007199254740991}{9007199254740992}:\\
\;\;\;\;\cos x \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_0\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
Applied rewrites50.8%
if -inf.0 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < 0.99999999999999989Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
if 0.99999999999999989 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)) (t_1 (* (cos x) t_0)))
(if (<= t_1 (- INFINITY))
(*
(+ 1 (* -1/2 (sqrt (* (* x x) (* x x)))))
(- (* (* y y) 1/6) -1))
(if (<= t_1 9007199254740991/9007199254740992)
(/ (* y (cos x)) y)
(* 1 t_0)))))double code(double x, double y) {
double t_0 = sinh(y) / y;
double t_1 = cos(x) * t_0;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0);
} else if (t_1 <= 0.9999999999999999) {
tmp = (y * cos(x)) / y;
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double t_1 = Math.cos(x) * t_0;
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = (1.0 + (-0.5 * Math.sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0);
} else if (t_1 <= 0.9999999999999999) {
tmp = (y * Math.cos(x)) / y;
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y t_1 = math.cos(x) * t_0 tmp = 0 if t_1 <= -math.inf: tmp = (1.0 + (-0.5 * math.sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0) elif t_1 <= 0.9999999999999999: tmp = (y * math.cos(x)) / y else: tmp = 1.0 * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) t_1 = Float64(cos(x) * t_0) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(1.0 + Float64(-0.5 * sqrt(Float64(Float64(x * x) * Float64(x * x))))) * Float64(Float64(Float64(y * y) * 0.16666666666666666) - -1.0)); elseif (t_1 <= 0.9999999999999999) tmp = Float64(Float64(y * cos(x)) / y); else tmp = Float64(1.0 * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; t_1 = cos(x) * t_0; tmp = 0.0; if (t_1 <= -Inf) tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0); elseif (t_1 <= 0.9999999999999999) tmp = (y * cos(x)) / y; else tmp = 1.0 * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(1 + N[(-1/2 * N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 9007199254740991/9007199254740992], N[(N[(y * N[Cos[x], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(1 * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
t_1 := \cos x \cdot t\_0\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right) \cdot \left(\left(y \cdot y\right) \cdot \frac{1}{6} - -1\right)\\
\mathbf{elif}\;t\_1 \leq \frac{9007199254740991}{9007199254740992}:\\
\;\;\;\;\frac{y \cdot \cos x}{y}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_0\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -inf.0Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
Applied rewrites50.8%
if -inf.0 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < 0.99999999999999989Initial program 100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9%
Applied rewrites99.9%
Taylor expanded in y around 0
lower-*.f64N/A
lower-cos.f6451.6%
Applied rewrites51.6%
if 0.99999999999999989 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (sinh y) y)))
(if (<= (* (cos x) t_0) -3602879701896397/72057594037927936)
(*
(+ 1 (* -1/2 (sqrt (* (* x x) (* x x)))))
(- (* (* y y) 1/6) -1))
(* 1 t_0))))double code(double x, double y) {
double t_0 = sinh(y) / y;
double tmp;
if ((cos(x) * t_0) <= -0.05) {
tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * t_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 = sinh(y) / y
if ((cos(x) * t_0) <= (-0.05d0)) then
tmp = (1.0d0 + ((-0.5d0) * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666d0) - (-1.0d0))
else
tmp = 1.0d0 * t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double tmp;
if ((Math.cos(x) * t_0) <= -0.05) {
tmp = (1.0 + (-0.5 * Math.sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y tmp = 0 if (math.cos(x) * t_0) <= -0.05: tmp = (1.0 + (-0.5 * math.sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0) else: tmp = 1.0 * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) tmp = 0.0 if (Float64(cos(x) * t_0) <= -0.05) tmp = Float64(Float64(1.0 + Float64(-0.5 * sqrt(Float64(Float64(x * x) * Float64(x * x))))) * Float64(Float64(Float64(y * y) * 0.16666666666666666) - -1.0)); else tmp = Float64(1.0 * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; tmp = 0.0; if ((cos(x) * t_0) <= -0.05) tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0); else tmp = 1.0 * t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision], -3602879701896397/72057594037927936], N[(N[(1 + N[(-1/2 * N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 * t$95$0), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
\mathbf{if}\;\cos x \cdot t\_0 \leq \frac{-3602879701896397}{72057594037927936}:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right) \cdot \left(\left(y \cdot y\right) \cdot \frac{1}{6} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_0\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
Applied rewrites50.8%
if -0.050000000000000003 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (fabs y) (fabs y))) (t_1 (* (* t_0 1/36) (fabs y))))
(if (<=
(* (cos x) (/ (sinh (fabs y)) (fabs y)))
-3602879701896397/72057594037927936)
(* (+ 1 (* -1/2 (sqrt (* (* x x) (* x x))))) (- (* t_0 1/6) -1))
(* 1 (+ 1 (* (sqrt (fabs y)) (sqrt (sqrt (* t_1 t_1)))))))))double code(double x, double y) {
double t_0 = fabs(y) * fabs(y);
double t_1 = (t_0 * 0.027777777777777776) * fabs(y);
double tmp;
if ((cos(x) * (sinh(fabs(y)) / fabs(y))) <= -0.05) {
tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * ((t_0 * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * (1.0 + (sqrt(fabs(y)) * sqrt(sqrt((t_1 * t_1)))));
}
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) :: t_1
real(8) :: tmp
t_0 = abs(y) * abs(y)
t_1 = (t_0 * 0.027777777777777776d0) * abs(y)
if ((cos(x) * (sinh(abs(y)) / abs(y))) <= (-0.05d0)) then
tmp = (1.0d0 + ((-0.5d0) * sqrt(((x * x) * (x * x))))) * ((t_0 * 0.16666666666666666d0) - (-1.0d0))
else
tmp = 1.0d0 * (1.0d0 + (sqrt(abs(y)) * sqrt(sqrt((t_1 * t_1)))))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.abs(y) * Math.abs(y);
double t_1 = (t_0 * 0.027777777777777776) * Math.abs(y);
double tmp;
if ((Math.cos(x) * (Math.sinh(Math.abs(y)) / Math.abs(y))) <= -0.05) {
tmp = (1.0 + (-0.5 * Math.sqrt(((x * x) * (x * x))))) * ((t_0 * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * (1.0 + (Math.sqrt(Math.abs(y)) * Math.sqrt(Math.sqrt((t_1 * t_1)))));
}
return tmp;
}
def code(x, y): t_0 = math.fabs(y) * math.fabs(y) t_1 = (t_0 * 0.027777777777777776) * math.fabs(y) tmp = 0 if (math.cos(x) * (math.sinh(math.fabs(y)) / math.fabs(y))) <= -0.05: tmp = (1.0 + (-0.5 * math.sqrt(((x * x) * (x * x))))) * ((t_0 * 0.16666666666666666) - -1.0) else: tmp = 1.0 * (1.0 + (math.sqrt(math.fabs(y)) * math.sqrt(math.sqrt((t_1 * t_1))))) return tmp
function code(x, y) t_0 = Float64(abs(y) * abs(y)) t_1 = Float64(Float64(t_0 * 0.027777777777777776) * abs(y)) tmp = 0.0 if (Float64(cos(x) * Float64(sinh(abs(y)) / abs(y))) <= -0.05) tmp = Float64(Float64(1.0 + Float64(-0.5 * sqrt(Float64(Float64(x * x) * Float64(x * x))))) * Float64(Float64(t_0 * 0.16666666666666666) - -1.0)); else tmp = Float64(1.0 * Float64(1.0 + Float64(sqrt(abs(y)) * sqrt(sqrt(Float64(t_1 * t_1)))))); end return tmp end
function tmp_2 = code(x, y) t_0 = abs(y) * abs(y); t_1 = (t_0 * 0.027777777777777776) * abs(y); tmp = 0.0; if ((cos(x) * (sinh(abs(y)) / abs(y))) <= -0.05) tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * ((t_0 * 0.16666666666666666) - -1.0); else tmp = 1.0 * (1.0 + (sqrt(abs(y)) * sqrt(sqrt((t_1 * t_1))))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Abs[y], $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 * 1/36), $MachinePrecision] * N[Abs[y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[N[Abs[y], $MachinePrecision]], $MachinePrecision] / N[Abs[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -3602879701896397/72057594037927936], N[(N[(1 + N[(-1/2 * N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t$95$0 * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 * N[(1 + N[(N[Sqrt[N[Abs[y], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Sqrt[N[(t$95$1 * t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left|y\right| \cdot \left|y\right|\\
t_1 := \left(t\_0 \cdot \frac{1}{36}\right) \cdot \left|y\right|\\
\mathbf{if}\;\cos x \cdot \frac{\sinh \left(\left|y\right|\right)}{\left|y\right|} \leq \frac{-3602879701896397}{72057594037927936}:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right) \cdot \left(t\_0 \cdot \frac{1}{6} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 + \sqrt{\left|y\right|} \cdot \sqrt{\sqrt{t\_1 \cdot t\_1}}\right)\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
Applied rewrites50.8%
if -0.050000000000000003 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
fabs-sqrN/A
lift-*.f64N/A
fabs-mulN/A
*-commutativeN/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
sqrt-prodN/A
lower-unsound-*.f64N/A
lower-unsound-sqrt.f64N/A
lower-unsound-sqrt.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval27.3%
Applied rewrites27.3%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6430.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6430.0%
Applied rewrites30.0%
(FPCore (x y)
:precision binary64
(if (<=
(* (cos x) (/ (sinh y) y))
-3602879701896397/72057594037927936)
(* (+ 1 (* -1/2 (sqrt (* (* x x) (* x x))))) (- (* (* y y) 1/6) -1))
(* 1 (+ 1 (sqrt (* (* 1/36 (* y y)) (* y y)))))))double code(double x, double y) {
double tmp;
if ((cos(x) * (sinh(y) / y)) <= -0.05) {
tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * (1.0 + sqrt(((0.027777777777777776 * (y * y)) * (y * 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 ((cos(x) * (sinh(y) / y)) <= (-0.05d0)) then
tmp = (1.0d0 + ((-0.5d0) * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666d0) - (-1.0d0))
else
tmp = 1.0d0 * (1.0d0 + sqrt(((0.027777777777777776d0 * (y * y)) * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((Math.cos(x) * (Math.sinh(y) / y)) <= -0.05) {
tmp = (1.0 + (-0.5 * Math.sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0);
} else {
tmp = 1.0 * (1.0 + Math.sqrt(((0.027777777777777776 * (y * y)) * (y * y))));
}
return tmp;
}
def code(x, y): tmp = 0 if (math.cos(x) * (math.sinh(y) / y)) <= -0.05: tmp = (1.0 + (-0.5 * math.sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0) else: tmp = 1.0 * (1.0 + math.sqrt(((0.027777777777777776 * (y * y)) * (y * y)))) return tmp
function code(x, y) tmp = 0.0 if (Float64(cos(x) * Float64(sinh(y) / y)) <= -0.05) tmp = Float64(Float64(1.0 + Float64(-0.5 * sqrt(Float64(Float64(x * x) * Float64(x * x))))) * Float64(Float64(Float64(y * y) * 0.16666666666666666) - -1.0)); else tmp = Float64(1.0 * Float64(1.0 + sqrt(Float64(Float64(0.027777777777777776 * Float64(y * y)) * Float64(y * y))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((cos(x) * (sinh(y) / y)) <= -0.05) tmp = (1.0 + (-0.5 * sqrt(((x * x) * (x * x))))) * (((y * y) * 0.16666666666666666) - -1.0); else tmp = 1.0 * (1.0 + sqrt(((0.027777777777777776 * (y * y)) * (y * y)))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -3602879701896397/72057594037927936], N[(N[(1 + N[(-1/2 * N[Sqrt[N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(y * y), $MachinePrecision] * 1/6), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 * N[(1 + N[Sqrt[N[(N[(1/36 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq \frac{-3602879701896397}{72057594037927936}:\\
\;\;\;\;\left(1 + \frac{-1}{2} \cdot \sqrt{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}\right) \cdot \left(\left(y \cdot y\right) \cdot \frac{1}{6} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 + \sqrt{\left(\frac{1}{36} \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot y\right)}\right)\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
rem-square-sqrtN/A
sqrt-unprodN/A
lower-sqrt.f64N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
lift-pow.f64N/A
unpow2N/A
lower-*.f6450.8%
Applied rewrites50.8%
if -0.050000000000000003 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
fabs-sqrN/A
lift-*.f64N/A
fabs-mulN/A
*-commutativeN/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lower-sqrt.f6456.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval56.0%
Applied rewrites56.0%
(FPCore (x y)
:precision binary64
(if (<=
(* (cos x) (/ (sinh y) y))
-3602879701896397/72057594037927936)
(* (- (* 1/6 (* y y)) -1) (- (* (* x x) -1/2) -1))
(* 1 (+ 1 (sqrt (* (* 1/36 (* y y)) (* y y)))))))double code(double x, double y) {
double tmp;
if ((cos(x) * (sinh(y) / y)) <= -0.05) {
tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0);
} else {
tmp = 1.0 * (1.0 + sqrt(((0.027777777777777776 * (y * y)) * (y * 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 ((cos(x) * (sinh(y) / y)) <= (-0.05d0)) then
tmp = ((0.16666666666666666d0 * (y * y)) - (-1.0d0)) * (((x * x) * (-0.5d0)) - (-1.0d0))
else
tmp = 1.0d0 * (1.0d0 + sqrt(((0.027777777777777776d0 * (y * y)) * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((Math.cos(x) * (Math.sinh(y) / y)) <= -0.05) {
tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0);
} else {
tmp = 1.0 * (1.0 + Math.sqrt(((0.027777777777777776 * (y * y)) * (y * y))));
}
return tmp;
}
def code(x, y): tmp = 0 if (math.cos(x) * (math.sinh(y) / y)) <= -0.05: tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0) else: tmp = 1.0 * (1.0 + math.sqrt(((0.027777777777777776 * (y * y)) * (y * y)))) return tmp
function code(x, y) tmp = 0.0 if (Float64(cos(x) * Float64(sinh(y) / y)) <= -0.05) tmp = Float64(Float64(Float64(0.16666666666666666 * Float64(y * y)) - -1.0) * Float64(Float64(Float64(x * x) * -0.5) - -1.0)); else tmp = Float64(1.0 * Float64(1.0 + sqrt(Float64(Float64(0.027777777777777776 * Float64(y * y)) * Float64(y * y))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((cos(x) * (sinh(y) / y)) <= -0.05) tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0); else tmp = 1.0 * (1.0 + sqrt(((0.027777777777777776 * (y * y)) * (y * y)))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], -3602879701896397/72057594037927936], N[(N[(N[(1/6 * N[(y * y), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * -1/2), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 * N[(1 + N[Sqrt[N[(N[(1/36 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\cos x \cdot \frac{\sinh y}{y} \leq \frac{-3602879701896397}{72057594037927936}:\\
\;\;\;\;\left(\frac{1}{6} \cdot \left(y \cdot y\right) - -1\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{2} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 + \sqrt{\left(\frac{1}{36} \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot y\right)}\right)\\
\end{array}
if (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.5%
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites50.5%
if -0.050000000000000003 < (*.f64 (cos.f64 x) (/.f64 (sinh.f64 y) y)) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
metadata-evalN/A
lift-pow.f64N/A
pow2N/A
fabs-sqrN/A
lift-*.f64N/A
fabs-mulN/A
*-commutativeN/A
lift-*.f64N/A
rem-sqrt-square-revN/A
lift-*.f64N/A
lower-sqrt.f6456.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
metadata-eval56.0%
Applied rewrites56.0%
(FPCore (x y) :precision binary64 (if (<= (cos x) -3602879701896397/72057594037927936) (* (- (* 1/6 (* y y)) -1) (- (* (* x x) -1/2) -1)) (* 1 (+ 1 (* (* 1/6 y) y)))))
double code(double x, double y) {
double tmp;
if (cos(x) <= -0.05) {
tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0);
} else {
tmp = 1.0 * (1.0 + ((0.16666666666666666 * y) * 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 (cos(x) <= (-0.05d0)) then
tmp = ((0.16666666666666666d0 * (y * y)) - (-1.0d0)) * (((x * x) * (-0.5d0)) - (-1.0d0))
else
tmp = 1.0d0 * (1.0d0 + ((0.16666666666666666d0 * y) * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (Math.cos(x) <= -0.05) {
tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0);
} else {
tmp = 1.0 * (1.0 + ((0.16666666666666666 * y) * y));
}
return tmp;
}
def code(x, y): tmp = 0 if math.cos(x) <= -0.05: tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0) else: tmp = 1.0 * (1.0 + ((0.16666666666666666 * y) * y)) return tmp
function code(x, y) tmp = 0.0 if (cos(x) <= -0.05) tmp = Float64(Float64(Float64(0.16666666666666666 * Float64(y * y)) - -1.0) * Float64(Float64(Float64(x * x) * -0.5) - -1.0)); else tmp = Float64(1.0 * Float64(1.0 + Float64(Float64(0.16666666666666666 * y) * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (cos(x) <= -0.05) tmp = ((0.16666666666666666 * (y * y)) - -1.0) * (((x * x) * -0.5) - -1.0); else tmp = 1.0 * (1.0 + ((0.16666666666666666 * y) * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Cos[x], $MachinePrecision], -3602879701896397/72057594037927936], N[(N[(N[(1/6 * N[(y * y), $MachinePrecision]), $MachinePrecision] - -1), $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * -1/2), $MachinePrecision] - -1), $MachinePrecision]), $MachinePrecision], N[(1 * N[(1 + N[(N[(1/6 * y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\cos x \leq \frac{-3602879701896397}{72057594037927936}:\\
\;\;\;\;\left(\frac{1}{6} \cdot \left(y \cdot y\right) - -1\right) \cdot \left(\left(x \cdot x\right) \cdot \frac{-1}{2} - -1\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(1 + \left(\frac{1}{6} \cdot y\right) \cdot y\right)\\
\end{array}
if (cos.f64 x) < -0.050000000000000003Initial program 100.0%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6477.5%
Applied rewrites77.5%
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
metadata-evalN/A
lower--.f6477.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6477.5%
lift-pow.f64N/A
unpow2N/A
lower-*.f6477.5%
Applied rewrites77.5%
Taylor expanded in x around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.5%
Applied rewrites50.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6450.5%
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites50.5%
if -0.050000000000000003 < (cos.f64 x) Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6447.8%
Applied rewrites47.8%
(FPCore (x y) :precision binary64 (* 1 (+ 1 (* (* 1/6 y) y))))
double code(double x, double y) {
return 1.0 * (1.0 + ((0.16666666666666666 * y) * 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 = 1.0d0 * (1.0d0 + ((0.16666666666666666d0 * y) * y))
end function
public static double code(double x, double y) {
return 1.0 * (1.0 + ((0.16666666666666666 * y) * y));
}
def code(x, y): return 1.0 * (1.0 + ((0.16666666666666666 * y) * y))
function code(x, y) return Float64(1.0 * Float64(1.0 + Float64(Float64(0.16666666666666666 * y) * y))) end
function tmp = code(x, y) tmp = 1.0 * (1.0 + ((0.16666666666666666 * y) * y)); end
code[x_, y_] := N[(1 * N[(1 + N[(N[(1/6 * y), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
1 \cdot \left(1 + \left(\frac{1}{6} \cdot y\right) \cdot y\right)
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites64.4%
Taylor expanded in y around 0
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6447.9%
Applied rewrites47.9%
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6447.8%
Applied rewrites47.8%
(FPCore (x y) :precision binary64 (/ y y))
double code(double x, double y) {
return y / 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 = y / y
end function
public static double code(double x, double y) {
return y / y;
}
def code(x, y): return y / y
function code(x, y) return Float64(y / y) end
function tmp = code(x, y) tmp = y / y; end
code[x_, y_] := N[(y / y), $MachinePrecision]
\frac{y}{y}
Initial program 100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9%
Applied rewrites99.9%
Taylor expanded in y around 0
lower-*.f64N/A
lower-cos.f6451.6%
Applied rewrites51.6%
Taylor expanded in x around 0
Applied rewrites28.9%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))