
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 94.1%
Applied rewrites99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (/ (* (sin ky) th) (hypot (sin ky) (sin kx))))
(t_3 (* (/ ky (hypot ky (sin kx))) (sin th))))
(if (<= t_1 -0.9995)
(* (/ (sin ky) (hypot (sin ky) kx)) (sin th))
(if (<= t_1 -0.05)
t_2
(if (<= t_1 0.1) t_3 (if (<= t_1 0.98) t_2 t_3))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = (sin(ky) * th) / hypot(sin(ky), sin(kx));
double t_3 = (ky / hypot(ky, sin(kx))) * sin(th);
double tmp;
if (t_1 <= -0.9995) {
tmp = (sin(ky) / hypot(sin(ky), kx)) * sin(th);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 0.1) {
tmp = t_3;
} else if (t_1 <= 0.98) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double t_2 = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
double t_3 = (ky / Math.hypot(ky, Math.sin(kx))) * Math.sin(th);
double tmp;
if (t_1 <= -0.9995) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), kx)) * Math.sin(th);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 0.1) {
tmp = t_3;
} else if (t_1 <= 0.98) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) t_2 = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) t_3 = (ky / math.hypot(ky, math.sin(kx))) * math.sin(th) tmp = 0 if t_1 <= -0.9995: tmp = (math.sin(ky) / math.hypot(math.sin(ky), kx)) * math.sin(th) elif t_1 <= -0.05: tmp = t_2 elif t_1 <= 0.1: tmp = t_3 elif t_1 <= 0.98: tmp = t_2 else: tmp = t_3 return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))) t_3 = Float64(Float64(ky / hypot(ky, sin(kx))) * sin(th)) tmp = 0.0 if (t_1 <= -0.9995) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), kx)) * sin(th)); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 0.1) tmp = t_3; elseif (t_1 <= 0.98) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); t_2 = (sin(ky) * th) / hypot(sin(ky), sin(kx)); t_3 = (ky / hypot(ky, sin(kx))) * sin(th); tmp = 0.0; if (t_1 <= -0.9995) tmp = (sin(ky) / hypot(sin(ky), kx)) * sin(th); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 0.1) tmp = t_3; elseif (t_1 <= 0.98) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.9995], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.05], t$95$2, If[LessEqual[t$95$1, 0.1], t$95$3, If[LessEqual[t$95$1, 0.98], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
t_3 := \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot \sin th\\
\mathbf{if}\;t\_1 \leq -0.9995:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, kx\right)} \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0.98:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99950000000000006Initial program 94.1%
Applied rewrites99.7%
Taylor expanded in kx around 0
Applied rewrites58.7%
if -0.99950000000000006 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003 or 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.97999999999999998Initial program 94.1%
Applied rewrites99.7%
Applied rewrites96.4%
Taylor expanded in th around 0
Applied rewrites48.2%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001 or 0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites51.6%
Taylor expanded in ky around 0
Applied rewrites65.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (/ (* (sin ky) th) (hypot (sin ky) (sin kx))))
(t_3 (* (/ ky (hypot ky (sin kx))) (sin th))))
(if (<= t_1 -0.9995)
(/ (* (sin ky) (sin th)) (hypot (sin ky) kx))
(if (<= t_1 -0.05)
t_2
(if (<= t_1 0.1) t_3 (if (<= t_1 0.98) t_2 t_3))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = (sin(ky) * th) / hypot(sin(ky), sin(kx));
double t_3 = (ky / hypot(ky, sin(kx))) * sin(th);
double tmp;
if (t_1 <= -0.9995) {
tmp = (sin(ky) * sin(th)) / hypot(sin(ky), kx);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 0.1) {
tmp = t_3;
} else if (t_1 <= 0.98) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double t_2 = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
double t_3 = (ky / Math.hypot(ky, Math.sin(kx))) * Math.sin(th);
double tmp;
if (t_1 <= -0.9995) {
tmp = (Math.sin(ky) * Math.sin(th)) / Math.hypot(Math.sin(ky), kx);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 0.1) {
tmp = t_3;
} else if (t_1 <= 0.98) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) t_2 = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) t_3 = (ky / math.hypot(ky, math.sin(kx))) * math.sin(th) tmp = 0 if t_1 <= -0.9995: tmp = (math.sin(ky) * math.sin(th)) / math.hypot(math.sin(ky), kx) elif t_1 <= -0.05: tmp = t_2 elif t_1 <= 0.1: tmp = t_3 elif t_1 <= 0.98: tmp = t_2 else: tmp = t_3 return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))) t_3 = Float64(Float64(ky / hypot(ky, sin(kx))) * sin(th)) tmp = 0.0 if (t_1 <= -0.9995) tmp = Float64(Float64(sin(ky) * sin(th)) / hypot(sin(ky), kx)); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 0.1) tmp = t_3; elseif (t_1 <= 0.98) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); t_2 = (sin(ky) * th) / hypot(sin(ky), sin(kx)); t_3 = (ky / hypot(ky, sin(kx))) * sin(th); tmp = 0.0; if (t_1 <= -0.9995) tmp = (sin(ky) * sin(th)) / hypot(sin(ky), kx); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 0.1) tmp = t_3; elseif (t_1 <= 0.98) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.9995], N[(N[(N[Sin[ky], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.05], t$95$2, If[LessEqual[t$95$1, 0.1], t$95$3, If[LessEqual[t$95$1, 0.98], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
t_3 := \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot \sin th\\
\mathbf{if}\;t\_1 \leq -0.9995:\\
\;\;\;\;\frac{\sin ky \cdot \sin th}{\mathsf{hypot}\left(\sin ky, kx\right)}\\
\mathbf{elif}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0.98:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99950000000000006Initial program 94.1%
Applied rewrites99.7%
Applied rewrites96.4%
Taylor expanded in kx around 0
Applied rewrites55.4%
if -0.99950000000000006 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003 or 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.97999999999999998Initial program 94.1%
Applied rewrites99.7%
Applied rewrites96.4%
Taylor expanded in th around 0
Applied rewrites48.2%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001 or 0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites51.6%
Taylor expanded in ky around 0
Applied rewrites65.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))))
(t_2 (/ (* (sin ky) th) (hypot (sin ky) (sin kx))))
(t_3 (* (/ ky (hypot ky (sin kx))) (sin th))))
(if (<= t_1 -0.9995)
(* (copysign 1.0 (sin ky)) (sin th))
(if (<= t_1 -0.05)
t_2
(if (<= t_1 0.1) t_3 (if (<= t_1 0.98) t_2 t_3))))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double t_2 = (sin(ky) * th) / hypot(sin(ky), sin(kx));
double t_3 = (ky / hypot(ky, sin(kx))) * sin(th);
double tmp;
if (t_1 <= -0.9995) {
tmp = copysign(1.0, sin(ky)) * sin(th);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 0.1) {
tmp = t_3;
} else if (t_1 <= 0.98) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double t_2 = (Math.sin(ky) * th) / Math.hypot(Math.sin(ky), Math.sin(kx));
double t_3 = (ky / Math.hypot(ky, Math.sin(kx))) * Math.sin(th);
double tmp;
if (t_1 <= -0.9995) {
tmp = Math.copySign(1.0, Math.sin(ky)) * Math.sin(th);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 0.1) {
tmp = t_3;
} else if (t_1 <= 0.98) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) t_2 = (math.sin(ky) * th) / math.hypot(math.sin(ky), math.sin(kx)) t_3 = (ky / math.hypot(ky, math.sin(kx))) * math.sin(th) tmp = 0 if t_1 <= -0.9995: tmp = math.copysign(1.0, math.sin(ky)) * math.sin(th) elif t_1 <= -0.05: tmp = t_2 elif t_1 <= 0.1: tmp = t_3 elif t_1 <= 0.98: tmp = t_2 else: tmp = t_3 return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) t_2 = Float64(Float64(sin(ky) * th) / hypot(sin(ky), sin(kx))) t_3 = Float64(Float64(ky / hypot(ky, sin(kx))) * sin(th)) tmp = 0.0 if (t_1 <= -0.9995) tmp = Float64(copysign(1.0, sin(ky)) * sin(th)); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 0.1) tmp = t_3; elseif (t_1 <= 0.98) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); t_2 = (sin(ky) * th) / hypot(sin(ky), sin(kx)); t_3 = (ky / hypot(ky, sin(kx))) * sin(th); tmp = 0.0; if (t_1 <= -0.9995) tmp = (sign(sin(ky)) * abs(1.0)) * sin(th); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 0.1) tmp = t_3; elseif (t_1 <= 0.98) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.9995], N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.05], t$95$2, If[LessEqual[t$95$1, 0.1], t$95$3, If[LessEqual[t$95$1, 0.98], t$95$2, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
t_2 := \frac{\sin ky \cdot th}{\mathsf{hypot}\left(\sin ky, \sin kx\right)}\\
t_3 := \frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot \sin th\\
\mathbf{if}\;t\_1 \leq -0.9995:\\
\;\;\;\;\mathsf{copysign}\left(1, \sin ky\right) \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0.98:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99950000000000006Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Applied rewrites31.2%
Applied rewrites44.4%
if -0.99950000000000006 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003 or 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.97999999999999998Initial program 94.1%
Applied rewrites99.7%
Applied rewrites96.4%
Taylor expanded in th around 0
Applied rewrites48.2%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001 or 0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites51.6%
Taylor expanded in ky around 0
Applied rewrites65.8%
(FPCore (kx ky th) :precision binary64 (if (<= th 7.5e-5) (* (/ (sin ky) (hypot (sin ky) (sin kx))) th) (* (/ ky (hypot ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 7.5e-5) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = (ky / hypot(ky, sin(kx))) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 7.5e-5) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = (ky / Math.hypot(ky, Math.sin(kx))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 7.5e-5: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = (ky / math.hypot(ky, math.sin(kx))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 7.5e-5) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(Float64(ky / hypot(ky, sin(kx))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 7.5e-5) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = (ky / hypot(ky, sin(kx))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 7.5e-5], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 7.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if th < 7.49999999999999934e-5Initial program 94.1%
Taylor expanded in th around 0
Applied rewrites48.9%
Applied rewrites51.5%
if 7.49999999999999934e-5 < th Initial program 94.1%
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites51.6%
Taylor expanded in ky around 0
Applied rewrites65.8%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) -0.05) (* (copysign 1.0 (sin ky)) (sin th)) (* (/ ky (hypot ky (sin kx))) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= -0.05) {
tmp = copysign(1.0, sin(ky)) * sin(th);
} else {
tmp = (ky / hypot(ky, sin(kx))) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= -0.05) {
tmp = Math.copySign(1.0, Math.sin(ky)) * Math.sin(th);
} else {
tmp = (ky / Math.hypot(ky, Math.sin(kx))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= -0.05: tmp = math.copysign(1.0, math.sin(ky)) * math.sin(th) else: tmp = (ky / math.hypot(ky, math.sin(kx))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= -0.05) tmp = Float64(copysign(1.0, sin(ky)) * sin(th)); else tmp = Float64(Float64(ky / hypot(ky, sin(kx))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= -0.05) tmp = (sign(sin(ky)) * abs(1.0)) * sin(th); else tmp = (ky / hypot(ky, sin(kx))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.05], N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq -0.05:\\
\;\;\;\;\mathsf{copysign}\left(1, \sin ky\right) \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Applied rewrites31.2%
Applied rewrites44.4%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites51.6%
Taylor expanded in ky around 0
Applied rewrites65.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(* (copysign 1.0 (sin ky)) (sin th))
(if (<= t_1 0.1) (* (/ ky (fabs (sin kx))) (sin th)) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = copysign(1.0, sin(ky)) * sin(th);
} else if (t_1 <= 0.1) {
tmp = (ky / fabs(sin(kx))) * sin(th);
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = Math.copySign(1.0, Math.sin(ky)) * Math.sin(th);
} else if (t_1 <= 0.1) {
tmp = (ky / Math.abs(Math.sin(kx))) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.05: tmp = math.copysign(1.0, math.sin(ky)) * math.sin(th) elif t_1 <= 0.1: tmp = (ky / math.fabs(math.sin(kx))) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(copysign(1.0, sin(ky)) * sin(th)); elseif (t_1 <= 0.1) tmp = Float64(Float64(ky / abs(sin(kx))) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.05) tmp = (sign(sin(ky)) * abs(1.0)) * sin(th); elseif (t_1 <= 0.1) tmp = (ky / abs(sin(kx))) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.1], N[(N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;\mathsf{copysign}\left(1, \sin ky\right) \cdot \sin th\\
\mathbf{elif}\;t\_1 \leq 0.1:\\
\;\;\;\;\frac{ky}{\left|\sin kx\right|} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Applied rewrites31.2%
Applied rewrites44.4%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 94.1%
Taylor expanded in ky around 0
Applied rewrites36.8%
Applied rewrites27.6%
Applied rewrites40.0%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0))
(t_2 (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0))))))
(if (<= t_2 -0.05)
(* (copysign 1.0 (sin ky)) (sin th))
(if (<= t_2 2e-12) (* (/ ky (sqrt t_1)) th) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double t_2 = sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = copysign(1.0, sin(ky)) * sin(th);
} else if (t_2 <= 2e-12) {
tmp = (ky / sqrt(t_1)) * th;
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.pow(Math.sin(kx), 2.0);
double t_2 = Math.sin(ky) / Math.sqrt((t_1 + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = Math.copySign(1.0, Math.sin(ky)) * Math.sin(th);
} else if (t_2 <= 2e-12) {
tmp = (ky / Math.sqrt(t_1)) * th;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.pow(math.sin(kx), 2.0) t_2 = math.sin(ky) / math.sqrt((t_1 + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_2 <= -0.05: tmp = math.copysign(1.0, math.sin(ky)) * math.sin(th) elif t_2 <= 2e-12: tmp = (ky / math.sqrt(t_1)) * th else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 t_2 = Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(copysign(1.0, sin(ky)) * sin(th)); elseif (t_2 <= 2e-12) tmp = Float64(Float64(ky / sqrt(t_1)) * th); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(kx) ^ 2.0; t_2 = sin(ky) / sqrt((t_1 + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_2 <= -0.05) tmp = (sign(sin(ky)) * abs(1.0)) * sin(th); elseif (t_2 <= 2e-12) tmp = (ky / sqrt(t_1)) * th; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -0.05], N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e-12], N[(N[(ky / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
t_2 := \frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\mathsf{copysign}\left(1, \sin ky\right) \cdot \sin th\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{ky}{\sqrt{t\_1}} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Applied rewrites31.2%
Applied rewrites44.4%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.99999999999999996e-12Initial program 94.1%
Taylor expanded in th around 0
Applied rewrites48.9%
Taylor expanded in ky around 0
Applied rewrites24.5%
Taylor expanded in ky around 0
Applied rewrites28.6%
Taylor expanded in ky around 0
Applied rewrites19.8%
if 1.99999999999999996e-12 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (pow (sin kx) 2.0)))
(if (<= (/ (sin ky) (sqrt (+ t_1 (pow (sin ky) 2.0)))) 2e-12)
(* (/ ky (sqrt t_1)) th)
(sin th))))
double code(double kx, double ky, double th) {
double t_1 = pow(sin(kx), 2.0);
double tmp;
if ((sin(ky) / sqrt((t_1 + pow(sin(ky), 2.0)))) <= 2e-12) {
tmp = (ky / sqrt(t_1)) * th;
} else {
tmp = sin(th);
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: t_1
real(8) :: tmp
t_1 = sin(kx) ** 2.0d0
if ((sin(ky) / sqrt((t_1 + (sin(ky) ** 2.0d0)))) <= 2d-12) then
tmp = (ky / sqrt(t_1)) * th
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.pow(Math.sin(kx), 2.0);
double tmp;
if ((Math.sin(ky) / Math.sqrt((t_1 + Math.pow(Math.sin(ky), 2.0)))) <= 2e-12) {
tmp = (ky / Math.sqrt(t_1)) * th;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.pow(math.sin(kx), 2.0) tmp = 0 if (math.sin(ky) / math.sqrt((t_1 + math.pow(math.sin(ky), 2.0)))) <= 2e-12: tmp = (ky / math.sqrt(t_1)) * th else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = sin(kx) ^ 2.0 tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64(t_1 + (sin(ky) ^ 2.0)))) <= 2e-12) tmp = Float64(Float64(ky / sqrt(t_1)) * th); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(kx) ^ 2.0; tmp = 0.0; if ((sin(ky) / sqrt((t_1 + (sin(ky) ^ 2.0)))) <= 2e-12) tmp = (ky / sqrt(t_1)) * th; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(t$95$1 + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-12], N[(N[(ky / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[Sin[th], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\sin kx}^{2}\\
\mathbf{if}\;\frac{\sin ky}{\sqrt{t\_1 + {\sin ky}^{2}}} \leq 2 \cdot 10^{-12}:\\
\;\;\;\;\frac{ky}{\sqrt{t\_1}} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.99999999999999996e-12Initial program 94.1%
Taylor expanded in th around 0
Applied rewrites48.9%
Taylor expanded in ky around 0
Applied rewrites24.5%
Taylor expanded in ky around 0
Applied rewrites28.6%
Taylor expanded in ky around 0
Applied rewrites19.8%
if 1.99999999999999996e-12 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.1) (* (/ ky (sqrt (pow kx 2.0))) (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.1) {
tmp = (ky / sqrt(pow(kx, 2.0))) * sin(th);
} else {
tmp = sin(th);
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.1d0) then
tmp = (ky / sqrt((kx ** 2.0d0))) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.1) {
tmp = (ky / Math.sqrt(Math.pow(kx, 2.0))) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.1: tmp = (ky / math.sqrt(math.pow(kx, 2.0))) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.1) tmp = Float64(Float64(ky / sqrt((kx ^ 2.0))) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.1) tmp = (ky / sqrt((kx ^ 2.0))) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.1], N[(N[(ky / N[Sqrt[N[Power[kx, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.1:\\
\;\;\;\;\frac{ky}{\sqrt{{kx}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 94.1%
Taylor expanded in ky around 0
Applied rewrites36.8%
Taylor expanded in kx around 0
Applied rewrites19.1%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 0.1) (* (/ ky kx) (sin th)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 0.1) {
tmp = (ky / kx) * sin(th);
} else {
tmp = sin(th);
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 0.1d0) then
tmp = (ky / kx) * sin(th)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 0.1) {
tmp = (ky / kx) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 0.1: tmp = (ky / kx) * math.sin(th) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.1) tmp = Float64(Float64(ky / kx) * sin(th)); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 0.1) tmp = (ky / kx) * sin(th); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.1], N[(N[(ky / kx), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 0.1:\\
\;\;\;\;\frac{ky}{kx} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 94.1%
Taylor expanded in ky around 0
Applied rewrites36.8%
Taylor expanded in kx around 0
Applied rewrites17.0%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
(FPCore (kx ky th) :precision binary64 (sin th))
double code(double kx, double ky, double th) {
return sin(th);
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = sin(th)
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th);
}
def code(kx, ky, th): return math.sin(th)
function code(kx, ky, th) return sin(th) end
function tmp = code(kx, ky, th) tmp = sin(th); end
code[kx_, ky_, th_] := N[Sin[th], $MachinePrecision]
\begin{array}{l}
\\
\sin th
\end{array}
Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
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(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.1%
Taylor expanded in kx around 0
Applied rewrites41.8%
Taylor expanded in ky around 0
Applied rewrites23.7%
Taylor expanded in th around 0
Applied rewrites13.8%
herbie shell --seed 2025161
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))