
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (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], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (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], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (pow t_1 2))
(t_3 (pow (sin kx) 2))
(t_4 (sin (+ (- (fabs ky)) PI))))
(*
(copysign 1 ky)
(if (<= (/ t_1 (sqrt (+ t_3 t_2))) 2)
(*
(/ t_1 (sqrt (+ (/ (pow (sin kx) 1) (pow (sin kx) -1)) t_2)))
(sin th))
(* (/ t_4 (sqrt (+ t_3 (pow t_4 2)))) (sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = pow(t_1, 2.0);
double t_3 = pow(sin(kx), 2.0);
double t_4 = sin((-fabs(ky) + ((double) M_PI)));
double tmp;
if ((t_1 / sqrt((t_3 + t_2))) <= 2.0) {
tmp = (t_1 / sqrt(((pow(sin(kx), 1.0) / pow(sin(kx), -1.0)) + t_2))) * sin(th);
} else {
tmp = (t_4 / sqrt((t_3 + pow(t_4, 2.0)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.pow(t_1, 2.0);
double t_3 = Math.pow(Math.sin(kx), 2.0);
double t_4 = Math.sin((-Math.abs(ky) + Math.PI));
double tmp;
if ((t_1 / Math.sqrt((t_3 + t_2))) <= 2.0) {
tmp = (t_1 / Math.sqrt(((Math.pow(Math.sin(kx), 1.0) / Math.pow(Math.sin(kx), -1.0)) + t_2))) * Math.sin(th);
} else {
tmp = (t_4 / Math.sqrt((t_3 + Math.pow(t_4, 2.0)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.pow(t_1, 2.0) t_3 = math.pow(math.sin(kx), 2.0) t_4 = math.sin((-math.fabs(ky) + math.pi)) tmp = 0 if (t_1 / math.sqrt((t_3 + t_2))) <= 2.0: tmp = (t_1 / math.sqrt(((math.pow(math.sin(kx), 1.0) / math.pow(math.sin(kx), -1.0)) + t_2))) * math.sin(th) else: tmp = (t_4 / math.sqrt((t_3 + math.pow(t_4, 2.0)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = t_1 ^ 2.0 t_3 = sin(kx) ^ 2.0 t_4 = sin(Float64(Float64(-abs(ky)) + pi)) tmp = 0.0 if (Float64(t_1 / sqrt(Float64(t_3 + t_2))) <= 2.0) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64((sin(kx) ^ 1.0) / (sin(kx) ^ -1.0)) + t_2))) * sin(th)); else tmp = Float64(Float64(t_4 / sqrt(Float64(t_3 + (t_4 ^ 2.0)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = t_1 ^ 2.0; t_3 = sin(kx) ^ 2.0; t_4 = sin((-abs(ky) + pi)); tmp = 0.0; if ((t_1 / sqrt((t_3 + t_2))) <= 2.0) tmp = (t_1 / sqrt((((sin(kx) ^ 1.0) / (sin(kx) ^ -1.0)) + t_2))) * sin(th); else tmp = (t_4 / sqrt((t_3 + (t_4 ^ 2.0)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 2], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2], $MachinePrecision]}, Block[{t$95$4 = N[Sin[N[((-N[Abs[ky], $MachinePrecision]) + Pi), $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 / N[Sqrt[N[(t$95$3 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Power[N[Sin[kx], $MachinePrecision], 1], $MachinePrecision] / N[Power[N[Sin[kx], $MachinePrecision], -1], $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 / N[Sqrt[N[(t$95$3 + N[Power[t$95$4, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := {t\_1}^{2}\\
t_3 := {\sin kx}^{2}\\
t_4 := \sin \left(\left(-\left|ky\right|\right) + \pi\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_1}{\sqrt{t\_3 + t\_2}} \leq 2:\\
\;\;\;\;\frac{t\_1}{\sqrt{\frac{{\sin kx}^{1}}{{\sin kx}^{-1}} + t\_2}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_4}{\sqrt{t\_3 + {t\_4}^{2}}} \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))))) < 2Initial program 94.3%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lower-unsound-pow.f6494.3%
Applied rewrites94.3%
if 2 < (/.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.3%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-PI.f646.8%
Applied rewrites6.8%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-PI.f6412.8%
Applied rewrites12.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (+ (- (fabs ky)) PI)))
(t_2 (sin (fabs ky)))
(t_3 (pow (sin kx) 2))
(t_4 (/ t_2 (sqrt (+ t_3 (pow t_2 2))))))
(*
(copysign 1 ky)
(if (<= t_4 2)
(* t_4 (sin th))
(* (/ t_1 (sqrt (+ t_3 (pow t_1 2)))) (sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin((-fabs(ky) + ((double) M_PI)));
double t_2 = sin(fabs(ky));
double t_3 = pow(sin(kx), 2.0);
double t_4 = t_2 / sqrt((t_3 + pow(t_2, 2.0)));
double tmp;
if (t_4 <= 2.0) {
tmp = t_4 * sin(th);
} else {
tmp = (t_1 / sqrt((t_3 + pow(t_1, 2.0)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin((-Math.abs(ky) + Math.PI));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = Math.pow(Math.sin(kx), 2.0);
double t_4 = t_2 / Math.sqrt((t_3 + Math.pow(t_2, 2.0)));
double tmp;
if (t_4 <= 2.0) {
tmp = t_4 * Math.sin(th);
} else {
tmp = (t_1 / Math.sqrt((t_3 + Math.pow(t_1, 2.0)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin((-math.fabs(ky) + math.pi)) t_2 = math.sin(math.fabs(ky)) t_3 = math.pow(math.sin(kx), 2.0) t_4 = t_2 / math.sqrt((t_3 + math.pow(t_2, 2.0))) tmp = 0 if t_4 <= 2.0: tmp = t_4 * math.sin(th) else: tmp = (t_1 / math.sqrt((t_3 + math.pow(t_1, 2.0)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(Float64(Float64(-abs(ky)) + pi)) t_2 = sin(abs(ky)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(t_2 / sqrt(Float64(t_3 + (t_2 ^ 2.0)))) tmp = 0.0 if (t_4 <= 2.0) tmp = Float64(t_4 * sin(th)); else tmp = Float64(Float64(t_1 / sqrt(Float64(t_3 + (t_1 ^ 2.0)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin((-abs(ky) + pi)); t_2 = sin(abs(ky)); t_3 = sin(kx) ^ 2.0; t_4 = t_2 / sqrt((t_3 + (t_2 ^ 2.0))); tmp = 0.0; if (t_4 <= 2.0) tmp = t_4 * sin(th); else tmp = (t_1 / sqrt((t_3 + (t_1 ^ 2.0)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[((-N[Abs[ky], $MachinePrecision]) + Pi), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[Power[t$95$2, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$4, 2], N[(t$95$4 * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(t$95$3 + N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \sin \left(\left(-\left|ky\right|\right) + \pi\right)\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{t\_2}{\sqrt{t\_3 + {t\_2}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_4 \leq 2:\\
\;\;\;\;t\_4 \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_3 + {t\_1}^{2}}} \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))))) < 2Initial program 94.3%
if 2 < (/.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.3%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-PI.f646.8%
Applied rewrites6.8%
remove-double-negN/A
lift-sin.f64N/A
sin-neg-revN/A
sin-+PI-revN/A
lower-sin.f64N/A
lower-+.f64N/A
lower-neg.f64N/A
lower-PI.f6412.8%
Applied rewrites12.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
3943168458671679/67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(* (/ t_1 (sqrt (+ (pow (sin kx) 2) (pow t_1 2)))) (sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 5.8e-170) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else {
tmp = (t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 5.8e-170) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else {
tmp = (t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 5.8e-170: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) else: tmp = (t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 5.8e-170) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); else tmp = Float64(Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 5.8e-170) tmp = (sin(th) / abs(sin(kx))) * abs(ky); else tmp = (t_1 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 3943168458671679/67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2], $MachinePrecision] + N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{3943168458671679}{67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 5.8000000000000001e-170Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 5.8000000000000001e-170 < ky Initial program 94.3%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))) (t_2 (pow (sin kx) 2)))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
3943168458671679/67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<=
(fabs ky)
7136238463529799/1427247692705959881058285969449495136382746624)
(* (/ t_1 (sqrt (+ t_2 (pow (fabs ky) 2)))) (sin th))
(/ (* t_1 (sin th)) (sqrt (+ t_2 (pow t_1 2)))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = pow(sin(kx), 2.0);
double tmp;
if (fabs(ky) <= 5.8e-170) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 5e-30) {
tmp = (t_1 / sqrt((t_2 + pow(fabs(ky), 2.0)))) * sin(th);
} else {
tmp = (t_1 * sin(th)) / sqrt((t_2 + pow(t_1, 2.0)));
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.pow(Math.sin(kx), 2.0);
double tmp;
if (Math.abs(ky) <= 5.8e-170) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 5e-30) {
tmp = (t_1 / Math.sqrt((t_2 + Math.pow(Math.abs(ky), 2.0)))) * Math.sin(th);
} else {
tmp = (t_1 * Math.sin(th)) / Math.sqrt((t_2 + Math.pow(t_1, 2.0)));
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.pow(math.sin(kx), 2.0) tmp = 0 if math.fabs(ky) <= 5.8e-170: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 5e-30: tmp = (t_1 / math.sqrt((t_2 + math.pow(math.fabs(ky), 2.0)))) * math.sin(th) else: tmp = (t_1 * math.sin(th)) / math.sqrt((t_2 + math.pow(t_1, 2.0))) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = sin(kx) ^ 2.0 tmp = 0.0 if (abs(ky) <= 5.8e-170) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 5e-30) tmp = Float64(Float64(t_1 / sqrt(Float64(t_2 + (abs(ky) ^ 2.0)))) * sin(th)); else tmp = Float64(Float64(t_1 * sin(th)) / sqrt(Float64(t_2 + (t_1 ^ 2.0)))); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = sin(kx) ^ 2.0; tmp = 0.0; if (abs(ky) <= 5.8e-170) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 5e-30) tmp = (t_1 / sqrt((t_2 + (abs(ky) ^ 2.0)))) * sin(th); else tmp = (t_1 * sin(th)) / sqrt((t_2 + (t_1 ^ 2.0))); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[kx], $MachinePrecision], 2], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 3943168458671679/67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 7136238463529799/1427247692705959881058285969449495136382746624], N[(N[(t$95$1 / N[Sqrt[N[(t$95$2 + N[Power[N[Abs[ky], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(t$95$2 + N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := {\sin kx}^{2}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{3943168458671679}{67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{7136238463529799}{1427247692705959881058285969449495136382746624}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_2 + {\left(\left|ky\right|\right)}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 \cdot \sin th}{\sqrt{t\_2 + {t\_1}^{2}}}\\
\end{array}
\end{array}
if ky < 5.8000000000000001e-170Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 5.8000000000000001e-170 < ky < 4.9999999999999997e-30Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
if 4.9999999999999997e-30 < ky Initial program 94.3%
Taylor expanded in kx around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6492.5%
Applied rewrites92.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
3943168458671679/67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<= (fabs ky) 6800207735332289/151115727451828646838272)
(*
(/ t_1 (sqrt (+ (pow (sin kx) 2) (pow (fabs ky) 2))))
(sin th))
(*
(/
(sin th)
(sqrt
(-
1/2
(*
(- (cos (+ kx kx)) (- 1 (cos (+ (fabs ky) (fabs ky)))))
1/2))))
t_1))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 5.8e-170) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 4.5e-8) {
tmp = (t_1 / sqrt((pow(sin(kx), 2.0) + pow(fabs(ky), 2.0)))) * sin(th);
} else {
tmp = (sin(th) / sqrt((0.5 - ((cos((kx + kx)) - (1.0 - cos((fabs(ky) + fabs(ky))))) * 0.5)))) * t_1;
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 5.8e-170) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 4.5e-8) {
tmp = (t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.abs(ky), 2.0)))) * Math.sin(th);
} else {
tmp = (Math.sin(th) / Math.sqrt((0.5 - ((Math.cos((kx + kx)) - (1.0 - Math.cos((Math.abs(ky) + Math.abs(ky))))) * 0.5)))) * t_1;
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 5.8e-170: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 4.5e-8: tmp = (t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.fabs(ky), 2.0)))) * math.sin(th) else: tmp = (math.sin(th) / math.sqrt((0.5 - ((math.cos((kx + kx)) - (1.0 - math.cos((math.fabs(ky) + math.fabs(ky))))) * 0.5)))) * t_1 return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 5.8e-170) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 4.5e-8) tmp = Float64(Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (abs(ky) ^ 2.0)))) * sin(th)); else tmp = Float64(Float64(sin(th) / sqrt(Float64(0.5 - Float64(Float64(cos(Float64(kx + kx)) - Float64(1.0 - cos(Float64(abs(ky) + abs(ky))))) * 0.5)))) * t_1); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 5.8e-170) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 4.5e-8) tmp = (t_1 / sqrt(((sin(kx) ^ 2.0) + (abs(ky) ^ 2.0)))) * sin(th); else tmp = (sin(th) / sqrt((0.5 - ((cos((kx + kx)) - (1.0 - cos((abs(ky) + abs(ky))))) * 0.5)))) * t_1; end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 3943168458671679/67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 6800207735332289/151115727451828646838272], N[(N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2], $MachinePrecision] + N[Power[N[Abs[ky], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(1/2 - N[(N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] - N[(1 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{3943168458671679}{67985663080546188632267290438715984298187919069060086169528849689651655662189087070612800289949348565617834174239552129964362155219546526644418557282123181048810402666930332036061200384}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{6800207735332289}{151115727451828646838272}:\\
\;\;\;\;\frac{t\_1}{\sqrt{{\sin kx}^{2} + {\left(\left|ky\right|\right)}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\sqrt{\frac{1}{2} - \left(\cos \left(kx + kx\right) - \left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right)\right)\right) \cdot \frac{1}{2}}} \cdot t\_1\\
\end{array}
\end{array}
if ky < 5.8000000000000001e-170Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 5.8000000000000001e-170 < ky < 4.4999999999999999e-8Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
if 4.4999999999999999e-8 < ky Initial program 94.3%
Taylor expanded in kx around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6492.5%
Applied rewrites92.5%
Applied rewrites76.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
8811145552479349/15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<= (fabs ky) 6800207735332289/151115727451828646838272)
(/
(* t_1 (sin th))
(sqrt (+ (pow (sin kx) 2) (pow (fabs ky) 2))))
(*
(/
(sin th)
(sqrt
(-
1/2
(*
(- (cos (+ kx kx)) (- 1 (cos (+ (fabs ky) (fabs ky)))))
1/2))))
t_1))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 5.7e-157) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 4.5e-8) {
tmp = (t_1 * sin(th)) / sqrt((pow(sin(kx), 2.0) + pow(fabs(ky), 2.0)));
} else {
tmp = (sin(th) / sqrt((0.5 - ((cos((kx + kx)) - (1.0 - cos((fabs(ky) + fabs(ky))))) * 0.5)))) * t_1;
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 5.7e-157) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 4.5e-8) {
tmp = (t_1 * Math.sin(th)) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.abs(ky), 2.0)));
} else {
tmp = (Math.sin(th) / Math.sqrt((0.5 - ((Math.cos((kx + kx)) - (1.0 - Math.cos((Math.abs(ky) + Math.abs(ky))))) * 0.5)))) * t_1;
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 5.7e-157: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 4.5e-8: tmp = (t_1 * math.sin(th)) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.fabs(ky), 2.0))) else: tmp = (math.sin(th) / math.sqrt((0.5 - ((math.cos((kx + kx)) - (1.0 - math.cos((math.fabs(ky) + math.fabs(ky))))) * 0.5)))) * t_1 return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 5.7e-157) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 4.5e-8) tmp = Float64(Float64(t_1 * sin(th)) / sqrt(Float64((sin(kx) ^ 2.0) + (abs(ky) ^ 2.0)))); else tmp = Float64(Float64(sin(th) / sqrt(Float64(0.5 - Float64(Float64(cos(Float64(kx + kx)) - Float64(1.0 - cos(Float64(abs(ky) + abs(ky))))) * 0.5)))) * t_1); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 5.7e-157) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 4.5e-8) tmp = (t_1 * sin(th)) / sqrt(((sin(kx) ^ 2.0) + (abs(ky) ^ 2.0))); else tmp = (sin(th) / sqrt((0.5 - ((cos((kx + kx)) - (1.0 - cos((abs(ky) + abs(ky))))) * 0.5)))) * t_1; end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 8811145552479349/15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 6800207735332289/151115727451828646838272], N[(N[(t$95$1 * N[Sin[th], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2], $MachinePrecision] + N[Power[N[Abs[ky], $MachinePrecision], 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(1/2 - N[(N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] - N[(1 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{8811145552479349}{15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{6800207735332289}{151115727451828646838272}:\\
\;\;\;\;\frac{t\_1 \cdot \sin th}{\sqrt{{\sin kx}^{2} + {\left(\left|ky\right|\right)}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\sqrt{\frac{1}{2} - \left(\cos \left(kx + kx\right) - \left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right)\right)\right) \cdot \frac{1}{2}}} \cdot t\_1\\
\end{array}
\end{array}
if ky < 5.7e-157Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 5.7e-157 < ky < 4.4999999999999999e-8Initial program 94.3%
Taylor expanded in kx around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6492.5%
Applied rewrites92.5%
Taylor expanded in ky around 0
lower-pow.f6444.7%
Applied rewrites44.7%
if 4.4999999999999999e-8 < ky Initial program 94.3%
Taylor expanded in kx around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6492.5%
Applied rewrites92.5%
Applied rewrites76.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))) (t_2 (cos (+ kx kx))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
8811145552479349/15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<= (fabs ky) 7526271582073497/147573952589676412928)
(*
(/ t_1 (sqrt (- (* (fabs ky) (fabs ky)) (* (- t_2 1) 1/2))))
(sin th))
(*
(/
(sin th)
(sqrt
(-
1/2
(* (- t_2 (- 1 (cos (+ (fabs ky) (fabs ky))))) 1/2))))
t_1))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = cos((kx + kx));
double tmp;
if (fabs(ky) <= 5.7e-157) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 5.1e-5) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) - ((t_2 - 1.0) * 0.5)))) * sin(th);
} else {
tmp = (sin(th) / sqrt((0.5 - ((t_2 - (1.0 - cos((fabs(ky) + fabs(ky))))) * 0.5)))) * t_1;
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.cos((kx + kx));
double tmp;
if (Math.abs(ky) <= 5.7e-157) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 5.1e-5) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) - ((t_2 - 1.0) * 0.5)))) * Math.sin(th);
} else {
tmp = (Math.sin(th) / Math.sqrt((0.5 - ((t_2 - (1.0 - Math.cos((Math.abs(ky) + Math.abs(ky))))) * 0.5)))) * t_1;
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.cos((kx + kx)) tmp = 0 if math.fabs(ky) <= 5.7e-157: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 5.1e-5: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) - ((t_2 - 1.0) * 0.5)))) * math.sin(th) else: tmp = (math.sin(th) / math.sqrt((0.5 - ((t_2 - (1.0 - math.cos((math.fabs(ky) + math.fabs(ky))))) * 0.5)))) * t_1 return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = cos(Float64(kx + kx)) tmp = 0.0 if (abs(ky) <= 5.7e-157) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 5.1e-5) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) - Float64(Float64(t_2 - 1.0) * 0.5)))) * sin(th)); else tmp = Float64(Float64(sin(th) / sqrt(Float64(0.5 - Float64(Float64(t_2 - Float64(1.0 - cos(Float64(abs(ky) + abs(ky))))) * 0.5)))) * t_1); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = cos((kx + kx)); tmp = 0.0; if (abs(ky) <= 5.7e-157) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 5.1e-5) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) - ((t_2 - 1.0) * 0.5)))) * sin(th); else tmp = (sin(th) / sqrt((0.5 - ((t_2 - (1.0 - cos((abs(ky) + abs(ky))))) * 0.5)))) * t_1; end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 8811145552479349/15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 7526271582073497/147573952589676412928], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$2 - 1), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(1/2 - N[(N[(t$95$2 - N[(1 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \cos \left(kx + kx\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{8811145552479349}{15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{7526271582073497}{147573952589676412928}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| - \left(t\_2 - 1\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\sqrt{\frac{1}{2} - \left(t\_2 - \left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right)\right)\right) \cdot \frac{1}{2}}} \cdot t\_1\\
\end{array}
\end{array}
if ky < 5.7e-157Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 5.7e-157 < ky < 5.1e-5Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
if 5.1e-5 < ky Initial program 94.3%
Taylor expanded in kx around inf
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-pow.f64N/A
lower-sin.f6492.5%
Applied rewrites92.5%
Applied rewrites76.4%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (pow t_1 2))
(t_3 (* (/ t_1 (sqrt t_2)) (sin th)))
(t_4 (pow (sin (fabs kx)) 2))
(t_5 (/ t_1 (sqrt (+ t_4 t_2))))
(t_6 (* th t_1)))
(*
(copysign 1 ky)
(if (<= t_5 -4494592428115755/4503599627370496)
t_3
(if (<= t_5 -3332663724254167/9007199254740992)
(*
(pow
(-
1/2
(*
(-
(cos (+ (fabs kx) (fabs kx)))
(- 1 (cos (+ (fabs ky) (fabs ky)))))
1/2))
-1/2)
t_6)
(if (<= t_5 944473296573929/9444732965739290427392)
(* (/ t_1 (sqrt t_4)) (sin th))
(if (<= t_5 4458563631096791/4503599627370496)
(/ t_6 (sqrt (- t_2 (* 1/2 (- (cos (* 2 (fabs kx))) 1)))))
(if (<= t_5 2)
t_3
(* (sin th) (/ (fabs ky) (fabs kx)))))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = pow(t_1, 2.0);
double t_3 = (t_1 / sqrt(t_2)) * sin(th);
double t_4 = pow(sin(fabs(kx)), 2.0);
double t_5 = t_1 / sqrt((t_4 + t_2));
double t_6 = th * t_1;
double tmp;
if (t_5 <= -0.998) {
tmp = t_3;
} else if (t_5 <= -0.37) {
tmp = pow((0.5 - ((cos((fabs(kx) + fabs(kx))) - (1.0 - cos((fabs(ky) + fabs(ky))))) * 0.5)), -0.5) * t_6;
} else if (t_5 <= 1e-7) {
tmp = (t_1 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.99) {
tmp = t_6 / sqrt((t_2 - (0.5 * (cos((2.0 * fabs(kx))) - 1.0))));
} else if (t_5 <= 2.0) {
tmp = t_3;
} else {
tmp = sin(th) * (fabs(ky) / fabs(kx));
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.pow(t_1, 2.0);
double t_3 = (t_1 / Math.sqrt(t_2)) * Math.sin(th);
double t_4 = Math.pow(Math.sin(Math.abs(kx)), 2.0);
double t_5 = t_1 / Math.sqrt((t_4 + t_2));
double t_6 = th * t_1;
double tmp;
if (t_5 <= -0.998) {
tmp = t_3;
} else if (t_5 <= -0.37) {
tmp = Math.pow((0.5 - ((Math.cos((Math.abs(kx) + Math.abs(kx))) - (1.0 - Math.cos((Math.abs(ky) + Math.abs(ky))))) * 0.5)), -0.5) * t_6;
} else if (t_5 <= 1e-7) {
tmp = (t_1 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.99) {
tmp = t_6 / Math.sqrt((t_2 - (0.5 * (Math.cos((2.0 * Math.abs(kx))) - 1.0))));
} else if (t_5 <= 2.0) {
tmp = t_3;
} else {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(kx));
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.pow(t_1, 2.0) t_3 = (t_1 / math.sqrt(t_2)) * math.sin(th) t_4 = math.pow(math.sin(math.fabs(kx)), 2.0) t_5 = t_1 / math.sqrt((t_4 + t_2)) t_6 = th * t_1 tmp = 0 if t_5 <= -0.998: tmp = t_3 elif t_5 <= -0.37: tmp = math.pow((0.5 - ((math.cos((math.fabs(kx) + math.fabs(kx))) - (1.0 - math.cos((math.fabs(ky) + math.fabs(ky))))) * 0.5)), -0.5) * t_6 elif t_5 <= 1e-7: tmp = (t_1 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.99: tmp = t_6 / math.sqrt((t_2 - (0.5 * (math.cos((2.0 * math.fabs(kx))) - 1.0)))) elif t_5 <= 2.0: tmp = t_3 else: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(kx)) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = t_1 ^ 2.0 t_3 = Float64(Float64(t_1 / sqrt(t_2)) * sin(th)) t_4 = sin(abs(kx)) ^ 2.0 t_5 = Float64(t_1 / sqrt(Float64(t_4 + t_2))) t_6 = Float64(th * t_1) tmp = 0.0 if (t_5 <= -0.998) tmp = t_3; elseif (t_5 <= -0.37) tmp = Float64((Float64(0.5 - Float64(Float64(cos(Float64(abs(kx) + abs(kx))) - Float64(1.0 - cos(Float64(abs(ky) + abs(ky))))) * 0.5)) ^ -0.5) * t_6); elseif (t_5 <= 1e-7) tmp = Float64(Float64(t_1 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.99) tmp = Float64(t_6 / sqrt(Float64(t_2 - Float64(0.5 * Float64(cos(Float64(2.0 * abs(kx))) - 1.0))))); elseif (t_5 <= 2.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(abs(ky) / abs(kx))); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = t_1 ^ 2.0; t_3 = (t_1 / sqrt(t_2)) * sin(th); t_4 = sin(abs(kx)) ^ 2.0; t_5 = t_1 / sqrt((t_4 + t_2)); t_6 = th * t_1; tmp = 0.0; if (t_5 <= -0.998) tmp = t_3; elseif (t_5 <= -0.37) tmp = ((0.5 - ((cos((abs(kx) + abs(kx))) - (1.0 - cos((abs(ky) + abs(ky))))) * 0.5)) ^ -0.5) * t_6; elseif (t_5 <= 1e-7) tmp = (t_1 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.99) tmp = t_6 / sqrt((t_2 - (0.5 * (cos((2.0 * abs(kx))) - 1.0)))); elseif (t_5 <= 2.0) tmp = t_3; else tmp = sin(th) * (abs(ky) / abs(kx)); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 2], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 / N[Sqrt[N[(t$95$4 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(th * t$95$1), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -4494592428115755/4503599627370496], t$95$3, If[LessEqual[t$95$5, -3332663724254167/9007199254740992], N[(N[Power[N[(1/2 - N[(N[(N[Cos[N[(N[Abs[kx], $MachinePrecision] + N[Abs[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(1 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] * t$95$6), $MachinePrecision], If[LessEqual[t$95$5, 944473296573929/9444732965739290427392], N[(N[(t$95$1 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 4458563631096791/4503599627370496], N[(t$95$6 / N[Sqrt[N[(t$95$2 - N[(1/2 * N[(N[Cos[N[(2 * N[Abs[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 2], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := {t\_1}^{2}\\
t_3 := \frac{t\_1}{\sqrt{t\_2}} \cdot \sin th\\
t_4 := {\sin \left(\left|kx\right|\right)}^{2}\\
t_5 := \frac{t\_1}{\sqrt{t\_4 + t\_2}}\\
t_6 := th \cdot t\_1\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq \frac{-4494592428115755}{4503599627370496}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq \frac{-3332663724254167}{9007199254740992}:\\
\;\;\;\;{\left(\frac{1}{2} - \left(\cos \left(\left|kx\right| + \left|kx\right|\right) - \left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right)\right)\right) \cdot \frac{1}{2}\right)}^{\frac{-1}{2}} \cdot t\_6\\
\mathbf{elif}\;t\_5 \leq \frac{944473296573929}{9444732965739290427392}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq \frac{4458563631096791}{4503599627370496}:\\
\;\;\;\;\frac{t\_6}{\sqrt{t\_2 - \frac{1}{2} \cdot \left(\cos \left(2 \cdot \left|kx\right|\right) - 1\right)}}\\
\mathbf{elif}\;t\_5 \leq 2:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|kx\right|}\\
\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.998 or 0.98999999999999999 < (/.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))))) < 2Initial program 94.3%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6441.1%
Applied rewrites41.1%
if -0.998 < (/.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.37Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6440.1%
Applied rewrites40.1%
Applied rewrites40.1%
if -0.37 < (/.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))))) < 9.9999999999999995e-8Initial program 94.3%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.1%
Applied rewrites41.1%
if 9.9999999999999995e-8 < (/.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.98999999999999999Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-cos.f64N/A
lower-*.f6444.0%
Applied rewrites44.0%
if 2 < (/.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.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (pow t_1 2))
(t_3 (* (/ t_1 (sqrt t_2)) (sin th)))
(t_4
(*
(pow
(-
1/2
(*
(-
(cos (+ (fabs kx) (fabs kx)))
(- 1 (cos (+ (fabs ky) (fabs ky)))))
1/2))
-1/2)
(* th t_1)))
(t_5 (pow (sin (fabs kx)) 2))
(t_6 (/ t_1 (sqrt (+ t_5 t_2)))))
(*
(copysign 1 ky)
(if (<= t_6 -4494592428115755/4503599627370496)
t_3
(if (<= t_6 -3332663724254167/9007199254740992)
t_4
(if (<= t_6 944473296573929/9444732965739290427392)
(* (/ t_1 (sqrt t_5)) (sin th))
(if (<= t_6 4458563631096791/4503599627370496)
t_4
(if (<= t_6 2)
t_3
(* (sin th) (/ (fabs ky) (fabs kx)))))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = pow(t_1, 2.0);
double t_3 = (t_1 / sqrt(t_2)) * sin(th);
double t_4 = pow((0.5 - ((cos((fabs(kx) + fabs(kx))) - (1.0 - cos((fabs(ky) + fabs(ky))))) * 0.5)), -0.5) * (th * t_1);
double t_5 = pow(sin(fabs(kx)), 2.0);
double t_6 = t_1 / sqrt((t_5 + t_2));
double tmp;
if (t_6 <= -0.998) {
tmp = t_3;
} else if (t_6 <= -0.37) {
tmp = t_4;
} else if (t_6 <= 1e-7) {
tmp = (t_1 / sqrt(t_5)) * sin(th);
} else if (t_6 <= 0.99) {
tmp = t_4;
} else if (t_6 <= 2.0) {
tmp = t_3;
} else {
tmp = sin(th) * (fabs(ky) / fabs(kx));
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.pow(t_1, 2.0);
double t_3 = (t_1 / Math.sqrt(t_2)) * Math.sin(th);
double t_4 = Math.pow((0.5 - ((Math.cos((Math.abs(kx) + Math.abs(kx))) - (1.0 - Math.cos((Math.abs(ky) + Math.abs(ky))))) * 0.5)), -0.5) * (th * t_1);
double t_5 = Math.pow(Math.sin(Math.abs(kx)), 2.0);
double t_6 = t_1 / Math.sqrt((t_5 + t_2));
double tmp;
if (t_6 <= -0.998) {
tmp = t_3;
} else if (t_6 <= -0.37) {
tmp = t_4;
} else if (t_6 <= 1e-7) {
tmp = (t_1 / Math.sqrt(t_5)) * Math.sin(th);
} else if (t_6 <= 0.99) {
tmp = t_4;
} else if (t_6 <= 2.0) {
tmp = t_3;
} else {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(kx));
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.pow(t_1, 2.0) t_3 = (t_1 / math.sqrt(t_2)) * math.sin(th) t_4 = math.pow((0.5 - ((math.cos((math.fabs(kx) + math.fabs(kx))) - (1.0 - math.cos((math.fabs(ky) + math.fabs(ky))))) * 0.5)), -0.5) * (th * t_1) t_5 = math.pow(math.sin(math.fabs(kx)), 2.0) t_6 = t_1 / math.sqrt((t_5 + t_2)) tmp = 0 if t_6 <= -0.998: tmp = t_3 elif t_6 <= -0.37: tmp = t_4 elif t_6 <= 1e-7: tmp = (t_1 / math.sqrt(t_5)) * math.sin(th) elif t_6 <= 0.99: tmp = t_4 elif t_6 <= 2.0: tmp = t_3 else: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(kx)) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = t_1 ^ 2.0 t_3 = Float64(Float64(t_1 / sqrt(t_2)) * sin(th)) t_4 = Float64((Float64(0.5 - Float64(Float64(cos(Float64(abs(kx) + abs(kx))) - Float64(1.0 - cos(Float64(abs(ky) + abs(ky))))) * 0.5)) ^ -0.5) * Float64(th * t_1)) t_5 = sin(abs(kx)) ^ 2.0 t_6 = Float64(t_1 / sqrt(Float64(t_5 + t_2))) tmp = 0.0 if (t_6 <= -0.998) tmp = t_3; elseif (t_6 <= -0.37) tmp = t_4; elseif (t_6 <= 1e-7) tmp = Float64(Float64(t_1 / sqrt(t_5)) * sin(th)); elseif (t_6 <= 0.99) tmp = t_4; elseif (t_6 <= 2.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(abs(ky) / abs(kx))); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = t_1 ^ 2.0; t_3 = (t_1 / sqrt(t_2)) * sin(th); t_4 = ((0.5 - ((cos((abs(kx) + abs(kx))) - (1.0 - cos((abs(ky) + abs(ky))))) * 0.5)) ^ -0.5) * (th * t_1); t_5 = sin(abs(kx)) ^ 2.0; t_6 = t_1 / sqrt((t_5 + t_2)); tmp = 0.0; if (t_6 <= -0.998) tmp = t_3; elseif (t_6 <= -0.37) tmp = t_4; elseif (t_6 <= 1e-7) tmp = (t_1 / sqrt(t_5)) * sin(th); elseif (t_6 <= 0.99) tmp = t_4; elseif (t_6 <= 2.0) tmp = t_3; else tmp = sin(th) * (abs(ky) / abs(kx)); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 2], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 / N[Sqrt[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[N[(1/2 - N[(N[(N[Cos[N[(N[Abs[kx], $MachinePrecision] + N[Abs[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(1 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision], -1/2], $MachinePrecision] * N[(th * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$1 / N[Sqrt[N[(t$95$5 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$6, -4494592428115755/4503599627370496], t$95$3, If[LessEqual[t$95$6, -3332663724254167/9007199254740992], t$95$4, If[LessEqual[t$95$6, 944473296573929/9444732965739290427392], N[(N[(t$95$1 / N[Sqrt[t$95$5], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 4458563631096791/4503599627370496], t$95$4, If[LessEqual[t$95$6, 2], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := {t\_1}^{2}\\
t_3 := \frac{t\_1}{\sqrt{t\_2}} \cdot \sin th\\
t_4 := {\left(\frac{1}{2} - \left(\cos \left(\left|kx\right| + \left|kx\right|\right) - \left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right)\right)\right) \cdot \frac{1}{2}\right)}^{\frac{-1}{2}} \cdot \left(th \cdot t\_1\right)\\
t_5 := {\sin \left(\left|kx\right|\right)}^{2}\\
t_6 := \frac{t\_1}{\sqrt{t\_5 + t\_2}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_6 \leq \frac{-4494592428115755}{4503599627370496}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_6 \leq \frac{-3332663724254167}{9007199254740992}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_6 \leq \frac{944473296573929}{9444732965739290427392}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_5}} \cdot \sin th\\
\mathbf{elif}\;t\_6 \leq \frac{4458563631096791}{4503599627370496}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_6 \leq 2:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|kx\right|}\\
\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.998 or 0.98999999999999999 < (/.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))))) < 2Initial program 94.3%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6441.1%
Applied rewrites41.1%
if -0.998 < (/.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.37 or 9.9999999999999995e-8 < (/.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.98999999999999999Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6440.1%
Applied rewrites40.1%
Applied rewrites40.1%
if -0.37 < (/.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))))) < 9.9999999999999995e-8Initial program 94.3%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.1%
Applied rewrites41.1%
if 2 < (/.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.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (cos (+ (fabs kx) (fabs kx))))
(t_2 (cos (+ (fabs ky) (fabs ky))))
(t_3 (sin (fabs ky)))
(t_4 (pow t_3 2))
(t_5 (* (/ t_3 (sqrt t_4)) (sin th)))
(t_6 (pow (sin (fabs kx)) 2))
(t_7 (/ t_3 (sqrt (+ t_6 t_4))))
(t_8 (* th t_3)))
(*
(copysign 1 ky)
(if (<= t_7 -4494592428115755/4503599627370496)
t_5
(if (<= t_7 -3332663724254167/9007199254740992)
(/ t_8 (sqrt (- 1/2 (* (- t_1 (- 1 t_2)) 1/2))))
(if (<= t_7 944473296573929/9444732965739290427392)
(* (/ t_3 (sqrt t_6)) (sin th))
(if (<= t_7 4458563631096791/4503599627370496)
(* (/ 1 (sqrt (- 1/2 (* (- t_2 (- 1 t_1)) 1/2)))) t_8)
(if (<= t_7 2)
t_5
(* (sin th) (/ (fabs ky) (fabs kx)))))))))))double code(double kx, double ky, double th) {
double t_1 = cos((fabs(kx) + fabs(kx)));
double t_2 = cos((fabs(ky) + fabs(ky)));
double t_3 = sin(fabs(ky));
double t_4 = pow(t_3, 2.0);
double t_5 = (t_3 / sqrt(t_4)) * sin(th);
double t_6 = pow(sin(fabs(kx)), 2.0);
double t_7 = t_3 / sqrt((t_6 + t_4));
double t_8 = th * t_3;
double tmp;
if (t_7 <= -0.998) {
tmp = t_5;
} else if (t_7 <= -0.37) {
tmp = t_8 / sqrt((0.5 - ((t_1 - (1.0 - t_2)) * 0.5)));
} else if (t_7 <= 1e-7) {
tmp = (t_3 / sqrt(t_6)) * sin(th);
} else if (t_7 <= 0.99) {
tmp = (1.0 / sqrt((0.5 - ((t_2 - (1.0 - t_1)) * 0.5)))) * t_8;
} else if (t_7 <= 2.0) {
tmp = t_5;
} else {
tmp = sin(th) * (fabs(ky) / fabs(kx));
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.cos((Math.abs(kx) + Math.abs(kx)));
double t_2 = Math.cos((Math.abs(ky) + Math.abs(ky)));
double t_3 = Math.sin(Math.abs(ky));
double t_4 = Math.pow(t_3, 2.0);
double t_5 = (t_3 / Math.sqrt(t_4)) * Math.sin(th);
double t_6 = Math.pow(Math.sin(Math.abs(kx)), 2.0);
double t_7 = t_3 / Math.sqrt((t_6 + t_4));
double t_8 = th * t_3;
double tmp;
if (t_7 <= -0.998) {
tmp = t_5;
} else if (t_7 <= -0.37) {
tmp = t_8 / Math.sqrt((0.5 - ((t_1 - (1.0 - t_2)) * 0.5)));
} else if (t_7 <= 1e-7) {
tmp = (t_3 / Math.sqrt(t_6)) * Math.sin(th);
} else if (t_7 <= 0.99) {
tmp = (1.0 / Math.sqrt((0.5 - ((t_2 - (1.0 - t_1)) * 0.5)))) * t_8;
} else if (t_7 <= 2.0) {
tmp = t_5;
} else {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(kx));
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.cos((math.fabs(kx) + math.fabs(kx))) t_2 = math.cos((math.fabs(ky) + math.fabs(ky))) t_3 = math.sin(math.fabs(ky)) t_4 = math.pow(t_3, 2.0) t_5 = (t_3 / math.sqrt(t_4)) * math.sin(th) t_6 = math.pow(math.sin(math.fabs(kx)), 2.0) t_7 = t_3 / math.sqrt((t_6 + t_4)) t_8 = th * t_3 tmp = 0 if t_7 <= -0.998: tmp = t_5 elif t_7 <= -0.37: tmp = t_8 / math.sqrt((0.5 - ((t_1 - (1.0 - t_2)) * 0.5))) elif t_7 <= 1e-7: tmp = (t_3 / math.sqrt(t_6)) * math.sin(th) elif t_7 <= 0.99: tmp = (1.0 / math.sqrt((0.5 - ((t_2 - (1.0 - t_1)) * 0.5)))) * t_8 elif t_7 <= 2.0: tmp = t_5 else: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(kx)) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = cos(Float64(abs(kx) + abs(kx))) t_2 = cos(Float64(abs(ky) + abs(ky))) t_3 = sin(abs(ky)) t_4 = t_3 ^ 2.0 t_5 = Float64(Float64(t_3 / sqrt(t_4)) * sin(th)) t_6 = sin(abs(kx)) ^ 2.0 t_7 = Float64(t_3 / sqrt(Float64(t_6 + t_4))) t_8 = Float64(th * t_3) tmp = 0.0 if (t_7 <= -0.998) tmp = t_5; elseif (t_7 <= -0.37) tmp = Float64(t_8 / sqrt(Float64(0.5 - Float64(Float64(t_1 - Float64(1.0 - t_2)) * 0.5)))); elseif (t_7 <= 1e-7) tmp = Float64(Float64(t_3 / sqrt(t_6)) * sin(th)); elseif (t_7 <= 0.99) tmp = Float64(Float64(1.0 / sqrt(Float64(0.5 - Float64(Float64(t_2 - Float64(1.0 - t_1)) * 0.5)))) * t_8); elseif (t_7 <= 2.0) tmp = t_5; else tmp = Float64(sin(th) * Float64(abs(ky) / abs(kx))); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = cos((abs(kx) + abs(kx))); t_2 = cos((abs(ky) + abs(ky))); t_3 = sin(abs(ky)); t_4 = t_3 ^ 2.0; t_5 = (t_3 / sqrt(t_4)) * sin(th); t_6 = sin(abs(kx)) ^ 2.0; t_7 = t_3 / sqrt((t_6 + t_4)); t_8 = th * t_3; tmp = 0.0; if (t_7 <= -0.998) tmp = t_5; elseif (t_7 <= -0.37) tmp = t_8 / sqrt((0.5 - ((t_1 - (1.0 - t_2)) * 0.5))); elseif (t_7 <= 1e-7) tmp = (t_3 / sqrt(t_6)) * sin(th); elseif (t_7 <= 0.99) tmp = (1.0 / sqrt((0.5 - ((t_2 - (1.0 - t_1)) * 0.5)))) * t_8; elseif (t_7 <= 2.0) tmp = t_5; else tmp = sin(th) * (abs(ky) / abs(kx)); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Cos[N[(N[Abs[kx], $MachinePrecision] + N[Abs[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Power[t$95$3, 2], $MachinePrecision]}, Block[{t$95$5 = N[(N[(t$95$3 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2], $MachinePrecision]}, Block[{t$95$7 = N[(t$95$3 / N[Sqrt[N[(t$95$6 + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[(th * t$95$3), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$7, -4494592428115755/4503599627370496], t$95$5, If[LessEqual[t$95$7, -3332663724254167/9007199254740992], N[(t$95$8 / N[Sqrt[N[(1/2 - N[(N[(t$95$1 - N[(1 - t$95$2), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$7, 944473296573929/9444732965739290427392], N[(N[(t$95$3 / N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$7, 4458563631096791/4503599627370496], N[(N[(1 / N[Sqrt[N[(1/2 - N[(N[(t$95$2 - N[(1 - t$95$1), $MachinePrecision]), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$8), $MachinePrecision], If[LessEqual[t$95$7, 2], t$95$5, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
t_1 := \cos \left(\left|kx\right| + \left|kx\right|\right)\\
t_2 := \cos \left(\left|ky\right| + \left|ky\right|\right)\\
t_3 := \sin \left(\left|ky\right|\right)\\
t_4 := {t\_3}^{2}\\
t_5 := \frac{t\_3}{\sqrt{t\_4}} \cdot \sin th\\
t_6 := {\sin \left(\left|kx\right|\right)}^{2}\\
t_7 := \frac{t\_3}{\sqrt{t\_6 + t\_4}}\\
t_8 := th \cdot t\_3\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_7 \leq \frac{-4494592428115755}{4503599627370496}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_7 \leq \frac{-3332663724254167}{9007199254740992}:\\
\;\;\;\;\frac{t\_8}{\sqrt{\frac{1}{2} - \left(t\_1 - \left(1 - t\_2\right)\right) \cdot \frac{1}{2}}}\\
\mathbf{elif}\;t\_7 \leq \frac{944473296573929}{9444732965739290427392}:\\
\;\;\;\;\frac{t\_3}{\sqrt{t\_6}} \cdot \sin th\\
\mathbf{elif}\;t\_7 \leq \frac{4458563631096791}{4503599627370496}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{1}{2} - \left(t\_2 - \left(1 - t\_1\right)\right) \cdot \frac{1}{2}}} \cdot t\_8\\
\mathbf{elif}\;t\_7 \leq 2:\\
\;\;\;\;t\_5\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|kx\right|}\\
\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.998 or 0.98999999999999999 < (/.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))))) < 2Initial program 94.3%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6441.1%
Applied rewrites41.1%
if -0.998 < (/.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.37Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6440.1%
Applied rewrites40.1%
Applied rewrites40.1%
if -0.37 < (/.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))))) < 9.9999999999999995e-8Initial program 94.3%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.1%
Applied rewrites41.1%
if 9.9999999999999995e-8 < (/.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.98999999999999999Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6440.1%
Applied rewrites40.1%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6440.1%
Applied rewrites40.1%
if 2 < (/.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.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
8811145552479349/15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<= (fabs ky) 6530219459687219/4503599627370496)
(*
(/
t_1
(sqrt
(- (* (fabs ky) (fabs ky)) (* (- (cos (+ kx kx)) 1) 1/2))))
(sin th))
(*
(/ t_1 (sqrt (- 1/2 (* (cos (+ (fabs ky) (fabs ky))) 1/2))))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 5.7e-157) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 1.45) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) - ((cos((kx + kx)) - 1.0) * 0.5)))) * sin(th);
} else {
tmp = (t_1 / sqrt((0.5 - (cos((fabs(ky) + fabs(ky))) * 0.5)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 5.7e-157) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 1.45) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) - ((Math.cos((kx + kx)) - 1.0) * 0.5)))) * Math.sin(th);
} else {
tmp = (t_1 / Math.sqrt((0.5 - (Math.cos((Math.abs(ky) + Math.abs(ky))) * 0.5)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 5.7e-157: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 1.45: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) - ((math.cos((kx + kx)) - 1.0) * 0.5)))) * math.sin(th) else: tmp = (t_1 / math.sqrt((0.5 - (math.cos((math.fabs(ky) + math.fabs(ky))) * 0.5)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 5.7e-157) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 1.45) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) - Float64(Float64(cos(Float64(kx + kx)) - 1.0) * 0.5)))) * sin(th)); else tmp = Float64(Float64(t_1 / sqrt(Float64(0.5 - Float64(cos(Float64(abs(ky) + abs(ky))) * 0.5)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 5.7e-157) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 1.45) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) - ((cos((kx + kx)) - 1.0) * 0.5)))) * sin(th); else tmp = (t_1 / sqrt((0.5 - (cos((abs(ky) + abs(ky))) * 0.5)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 8811145552479349/15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 6530219459687219/4503599627370496], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] - 1), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(1/2 - N[(N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{8811145552479349}{15458150092069033378781407563727949377195709318825739994628941005806076569158241698144775066327690311849854464126008708709460314644171950622971634693868322994787923259293696}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{6530219459687219}{4503599627370496}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| - \left(\cos \left(kx + kx\right) - 1\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\frac{1}{2} - \cos \left(\left|ky\right| + \left|ky\right|\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 5.7e-157Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 5.7e-157 < ky < 1.45Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
if 1.45 < ky Initial program 94.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites76.3%
Taylor expanded in kx around 0
Applied rewrites31.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
6575919231766733/2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<= (fabs ky) 6800207735332289/151115727451828646838272)
(*
(/ t_1 (sqrt (- (* (fabs ky) (fabs ky)) (* -1 (pow kx 2)))))
(sin th))
(*
(/ t_1 (sqrt (- 1/2 (* (cos (+ (fabs ky) (fabs ky))) 1/2))))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 2.8e-93) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 4.5e-8) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) - (-1.0 * pow(kx, 2.0))))) * sin(th);
} else {
tmp = (t_1 / sqrt((0.5 - (cos((fabs(ky) + fabs(ky))) * 0.5)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 2.8e-93) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 4.5e-8) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) - (-1.0 * Math.pow(kx, 2.0))))) * Math.sin(th);
} else {
tmp = (t_1 / Math.sqrt((0.5 - (Math.cos((Math.abs(ky) + Math.abs(ky))) * 0.5)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 2.8e-93: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 4.5e-8: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) - (-1.0 * math.pow(kx, 2.0))))) * math.sin(th) else: tmp = (t_1 / math.sqrt((0.5 - (math.cos((math.fabs(ky) + math.fabs(ky))) * 0.5)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 2.8e-93) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 4.5e-8) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) - Float64(-1.0 * (kx ^ 2.0))))) * sin(th)); else tmp = Float64(Float64(t_1 / sqrt(Float64(0.5 - Float64(cos(Float64(abs(ky) + abs(ky))) * 0.5)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 2.8e-93) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 4.5e-8) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) - (-1.0 * (kx ^ 2.0))))) * sin(th); else tmp = (t_1 / sqrt((0.5 - (cos((abs(ky) + abs(ky))) * 0.5)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 6575919231766733/2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 6800207735332289/151115727451828646838272], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] - N[(-1 * N[Power[kx, 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(1/2 - N[(N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{6575919231766733}{2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{6800207735332289}{151115727451828646838272}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| - -1 \cdot {kx}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\frac{1}{2} - \cos \left(\left|ky\right| + \left|ky\right|\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 2.8e-93Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 2.8e-93 < ky < 4.4999999999999999e-8Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-pow.f6428.2%
Applied rewrites28.2%
if 4.4999999999999999e-8 < ky Initial program 94.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites76.3%
Taylor expanded in kx around 0
Applied rewrites31.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1 ky)
(if (<=
(fabs ky)
6575919231766733/2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(if (<= (fabs ky) 6530219459687219/4503599627370496)
(*
(/ t_1 (sqrt (- (* (fabs ky) (fabs ky)) (* (- 1 1) 1/2))))
(sin th))
(*
(/ t_1 (sqrt (- 1/2 (* (cos (+ (fabs ky) (fabs ky))) 1/2))))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 2.8e-93) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else if (fabs(ky) <= 1.45) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) - ((1.0 - 1.0) * 0.5)))) * sin(th);
} else {
tmp = (t_1 / sqrt((0.5 - (cos((fabs(ky) + fabs(ky))) * 0.5)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 2.8e-93) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else if (Math.abs(ky) <= 1.45) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) - ((1.0 - 1.0) * 0.5)))) * Math.sin(th);
} else {
tmp = (t_1 / Math.sqrt((0.5 - (Math.cos((Math.abs(ky) + Math.abs(ky))) * 0.5)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 2.8e-93: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) elif math.fabs(ky) <= 1.45: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) - ((1.0 - 1.0) * 0.5)))) * math.sin(th) else: tmp = (t_1 / math.sqrt((0.5 - (math.cos((math.fabs(ky) + math.fabs(ky))) * 0.5)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 2.8e-93) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); elseif (abs(ky) <= 1.45) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) - Float64(Float64(1.0 - 1.0) * 0.5)))) * sin(th)); else tmp = Float64(Float64(t_1 / sqrt(Float64(0.5 - Float64(cos(Float64(abs(ky) + abs(ky))) * 0.5)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 2.8e-93) tmp = (sin(th) / abs(sin(kx))) * abs(ky); elseif (abs(ky) <= 1.45) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) - ((1.0 - 1.0) * 0.5)))) * sin(th); else tmp = (t_1 / sqrt((0.5 - (cos((abs(ky) + abs(ky))) * 0.5)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 6575919231766733/2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 6530219459687219/4503599627370496], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] - N[(N[(1 - 1), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(1/2 - N[(N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq \frac{6575919231766733}{2348542582773833227889480596789337027375682548908319870707290971532209025114608443463698998384768703031934976}:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;\left|ky\right| \leq \frac{6530219459687219}{4503599627370496}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| - \left(1 - 1\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\frac{1}{2} - \cos \left(\left|ky\right| + \left|ky\right|\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 2.8e-93Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 2.8e-93 < ky < 1.45Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
Taylor expanded in kx around 0
Applied rewrites13.8%
if 1.45 < ky Initial program 94.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
associate-+r-N/A
lower--.f64N/A
Applied rewrites76.3%
Taylor expanded in kx around 0
Applied rewrites31.2%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (sin (fabs kx)))
(t_3 (/ t_1 (sqrt (+ (pow t_2 2) (pow t_1 2))))))
(*
(copysign 1 ky)
(if (<= t_3 -5404319552844595/36028797018963968)
(* (/ 1 (sqrt (- 1/2 (* 1/2 (cos (* 2 (fabs ky))))))) (* th t_1))
(if (<= t_3 3249347131147813/4503599627370496)
(* (/ (sin th) (fabs t_2)) (fabs ky))
(if (<= t_3 2)
(*
(/ t_1 (sqrt (- (* (fabs ky) (fabs ky)) (* (- 1 1) 1/2))))
(sin th))
(* (sin th) (/ (fabs ky) (fabs kx)))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = sin(fabs(kx));
double t_3 = t_1 / sqrt((pow(t_2, 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_3 <= -0.15) {
tmp = (1.0 / sqrt((0.5 - (0.5 * cos((2.0 * fabs(ky))))))) * (th * t_1);
} else if (t_3 <= 0.7215) {
tmp = (sin(th) / fabs(t_2)) * fabs(ky);
} else if (t_3 <= 2.0) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) - ((1.0 - 1.0) * 0.5)))) * sin(th);
} else {
tmp = sin(th) * (fabs(ky) / fabs(kx));
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.sin(Math.abs(kx));
double t_3 = t_1 / Math.sqrt((Math.pow(t_2, 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_3 <= -0.15) {
tmp = (1.0 / Math.sqrt((0.5 - (0.5 * Math.cos((2.0 * Math.abs(ky))))))) * (th * t_1);
} else if (t_3 <= 0.7215) {
tmp = (Math.sin(th) / Math.abs(t_2)) * Math.abs(ky);
} else if (t_3 <= 2.0) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) - ((1.0 - 1.0) * 0.5)))) * Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(kx));
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.sin(math.fabs(kx)) t_3 = t_1 / math.sqrt((math.pow(t_2, 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_3 <= -0.15: tmp = (1.0 / math.sqrt((0.5 - (0.5 * math.cos((2.0 * math.fabs(ky))))))) * (th * t_1) elif t_3 <= 0.7215: tmp = (math.sin(th) / math.fabs(t_2)) * math.fabs(ky) elif t_3 <= 2.0: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) - ((1.0 - 1.0) * 0.5)))) * math.sin(th) else: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(kx)) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = sin(abs(kx)) t_3 = Float64(t_1 / sqrt(Float64((t_2 ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.15) tmp = Float64(Float64(1.0 / sqrt(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * abs(ky))))))) * Float64(th * t_1)); elseif (t_3 <= 0.7215) tmp = Float64(Float64(sin(th) / abs(t_2)) * abs(ky)); elseif (t_3 <= 2.0) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) - Float64(Float64(1.0 - 1.0) * 0.5)))) * sin(th)); else tmp = Float64(sin(th) * Float64(abs(ky) / abs(kx))); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = sin(abs(kx)); t_3 = t_1 / sqrt(((t_2 ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_3 <= -0.15) tmp = (1.0 / sqrt((0.5 - (0.5 * cos((2.0 * abs(ky))))))) * (th * t_1); elseif (t_3 <= 0.7215) tmp = (sin(th) / abs(t_2)) * abs(ky); elseif (t_3 <= 2.0) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) - ((1.0 - 1.0) * 0.5)))) * sin(th); else tmp = sin(th) * (abs(ky) / abs(kx)); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / N[Sqrt[N[(N[Power[t$95$2, 2], $MachinePrecision] + N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, -5404319552844595/36028797018963968], N[(N[(1 / N[Sqrt[N[(1/2 - N[(1/2 * N[Cos[N[(2 * N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(th * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 3249347131147813/4503599627370496], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] - N[(N[(1 - 1), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \sin \left(\left|kx\right|\right)\\
t_3 := \frac{t\_1}{\sqrt{{t\_2}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq \frac{-5404319552844595}{36028797018963968}:\\
\;\;\;\;\frac{1}{\sqrt{\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \left|ky\right|\right)}} \cdot \left(th \cdot t\_1\right)\\
\mathbf{elif}\;t\_3 \leq \frac{3249347131147813}{4503599627370496}:\\
\;\;\;\;\frac{\sin th}{\left|t\_2\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| - \left(1 - 1\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|kx\right|}\\
\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.14999999999999999Initial program 94.3%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
Applied rewrites76.2%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6440.1%
Applied rewrites40.1%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6416.7%
Applied rewrites16.7%
if -0.14999999999999999 < (/.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.72150000000000003Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 0.72150000000000003 < (/.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))))) < 2Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
Taylor expanded in kx around 0
Applied rewrites13.8%
if 2 < (/.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.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (sin (fabs kx)))
(t_3 (/ t_1 (sqrt (+ (pow t_2 2) (pow t_1 2))))))
(*
(copysign 1 ky)
(if (<= t_3 3249347131147813/4503599627370496)
(* (/ (sin th) (fabs t_2)) (fabs ky))
(if (<= t_3 2)
(*
(/ t_1 (sqrt (- (* (fabs ky) (fabs ky)) (* (- 1 1) 1/2))))
(sin th))
(* (sin th) (/ (fabs ky) (fabs kx))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = sin(fabs(kx));
double t_3 = t_1 / sqrt((pow(t_2, 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_3 <= 0.7215) {
tmp = (sin(th) / fabs(t_2)) * fabs(ky);
} else if (t_3 <= 2.0) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) - ((1.0 - 1.0) * 0.5)))) * sin(th);
} else {
tmp = sin(th) * (fabs(ky) / fabs(kx));
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double t_2 = Math.sin(Math.abs(kx));
double t_3 = t_1 / Math.sqrt((Math.pow(t_2, 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_3 <= 0.7215) {
tmp = (Math.sin(th) / Math.abs(t_2)) * Math.abs(ky);
} else if (t_3 <= 2.0) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) - ((1.0 - 1.0) * 0.5)))) * Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(kx));
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = math.sin(math.fabs(kx)) t_3 = t_1 / math.sqrt((math.pow(t_2, 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_3 <= 0.7215: tmp = (math.sin(th) / math.fabs(t_2)) * math.fabs(ky) elif t_3 <= 2.0: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) - ((1.0 - 1.0) * 0.5)))) * math.sin(th) else: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(kx)) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = sin(abs(kx)) t_3 = Float64(t_1 / sqrt(Float64((t_2 ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_3 <= 0.7215) tmp = Float64(Float64(sin(th) / abs(t_2)) * abs(ky)); elseif (t_3 <= 2.0) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) - Float64(Float64(1.0 - 1.0) * 0.5)))) * sin(th)); else tmp = Float64(sin(th) * Float64(abs(ky) / abs(kx))); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); t_2 = sin(abs(kx)); t_3 = t_1 / sqrt(((t_2 ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_3 <= 0.7215) tmp = (sin(th) / abs(t_2)) * abs(ky); elseif (t_3 <= 2.0) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) - ((1.0 - 1.0) * 0.5)))) * sin(th); else tmp = sin(th) * (abs(ky) / abs(kx)); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / N[Sqrt[N[(N[Power[t$95$2, 2], $MachinePrecision] + N[Power[t$95$1, 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 3249347131147813/4503599627370496], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] - N[(N[(1 - 1), $MachinePrecision] * 1/2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \sin \left(\left|kx\right|\right)\\
t_3 := \frac{t\_1}{\sqrt{{t\_2}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq \frac{3249347131147813}{4503599627370496}:\\
\;\;\;\;\frac{\sin th}{\left|t\_2\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| - \left(1 - 1\right) \cdot \frac{1}{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|kx\right|}\\
\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.72150000000000003Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
if 0.72150000000000003 < (/.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))))) < 2Initial program 94.3%
Taylor expanded in ky around 0
lower-pow.f6446.5%
Applied rewrites46.5%
Applied rewrites37.8%
Taylor expanded in kx around 0
Applied rewrites13.8%
if 2 < (/.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.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th) :precision binary64 (* (/ (sin th) (fabs (sin kx))) ky))
double code(double kx, double ky, double th) {
return (sin(th) / fabs(sin(kx))) * ky;
}
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) / abs(sin(kx))) * ky
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(th) / Math.abs(Math.sin(kx))) * ky;
}
def code(kx, ky, th): return (math.sin(th) / math.fabs(math.sin(kx))) * ky
function code(kx, ky, th) return Float64(Float64(sin(th) / abs(sin(kx))) * ky) end
function tmp = code(kx, ky, th) tmp = (sin(th) / abs(sin(kx))) * ky; end
code[kx_, ky_, th_] := N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision]
\frac{\sin th}{\left|\sin kx\right|} \cdot ky
Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ ky (fabs (sin kx)))))
double code(double kx, double ky, double th) {
return sin(th) * (ky / fabs(sin(kx)));
}
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) * (ky / abs(sin(kx)))
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (ky / Math.abs(Math.sin(kx)));
}
def code(kx, ky, th): return math.sin(th) * (ky / math.fabs(math.sin(kx)))
function code(kx, ky, th) return Float64(sin(th) * Float64(ky / abs(sin(kx)))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (ky / abs(sin(kx))); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sin th \cdot \frac{ky}{\left|\sin kx\right|}
Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
remove-double-divN/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.0%
Applied rewrites39.0%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs kx))))
(if (<=
(pow t_1 2)
35681192317649/178405961588244985132285746181186892047843328)
(* (/ (sin th) (fabs kx)) ky)
(/ (* ky th) (fabs t_1)))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(kx));
double tmp;
if (pow(t_1, 2.0) <= 2e-31) {
tmp = (sin(th) / fabs(kx)) * ky;
} else {
tmp = (ky * th) / fabs(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(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(abs(kx))
if ((t_1 ** 2.0d0) <= 2d-31) then
tmp = (sin(th) / abs(kx)) * ky
else
tmp = (ky * th) / abs(t_1)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(kx));
double tmp;
if (Math.pow(t_1, 2.0) <= 2e-31) {
tmp = (Math.sin(th) / Math.abs(kx)) * ky;
} else {
tmp = (ky * th) / Math.abs(t_1);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(kx)) tmp = 0 if math.pow(t_1, 2.0) <= 2e-31: tmp = (math.sin(th) / math.fabs(kx)) * ky else: tmp = (ky * th) / math.fabs(t_1) return tmp
function code(kx, ky, th) t_1 = sin(abs(kx)) tmp = 0.0 if ((t_1 ^ 2.0) <= 2e-31) tmp = Float64(Float64(sin(th) / abs(kx)) * ky); else tmp = Float64(Float64(ky * th) / abs(t_1)); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(kx)); tmp = 0.0; if ((t_1 ^ 2.0) <= 2e-31) tmp = (sin(th) / abs(kx)) * ky; else tmp = (ky * th) / abs(t_1); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Power[t$95$1, 2], $MachinePrecision], 35681192317649/178405961588244985132285746181186892047843328], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision], N[(N[(ky * th), $MachinePrecision] / N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|kx\right|\right)\\
\mathbf{if}\;{t\_1}^{2} \leq \frac{35681192317649}{178405961588244985132285746181186892047843328}:\\
\;\;\;\;\frac{\sin th}{\left|kx\right|} \cdot ky\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot th}{\left|t\_1\right|}\\
\end{array}
if (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) < 2.0000000000000002e-31Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
if 2.0000000000000002e-31 < (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
lift-sqrt.f64N/A
pow1/2N/A
metadata-evalN/A
metadata-evalN/A
pow-negN/A
lower-unsound-pow.f32N/A
lower-pow.f32N/A
pow-flipN/A
pow1/2N/A
lift-sqrt.f64N/A
lower-unsound-/.f64N/A
lower-/.f6435.0%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6437.2%
Applied rewrites37.2%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sin.f6419.2%
Applied rewrites19.2%
(FPCore (kx ky th) :precision binary64 (* (/ (sin th) (fabs kx)) ky))
double code(double kx, double ky, double th) {
return (sin(th) / fabs(kx)) * ky;
}
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) / abs(kx)) * ky
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(th) / Math.abs(kx)) * ky;
}
def code(kx, ky, th): return (math.sin(th) / math.fabs(kx)) * ky
function code(kx, ky, th) return Float64(Float64(sin(th) / abs(kx)) * ky) end
function tmp = code(kx, ky, th) tmp = (sin(th) / abs(kx)) * ky; end
code[kx_, ky_, th_] := N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision]
\frac{\sin th}{\left|kx\right|} \cdot ky
Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th) :precision binary64 (* (sin th) (/ ky (fabs kx))))
double code(double kx, double ky, double th) {
return sin(th) * (ky / fabs(kx));
}
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) * (ky / abs(kx))
end function
public static double code(double kx, double ky, double th) {
return Math.sin(th) * (ky / Math.abs(kx));
}
def code(kx, ky, th): return math.sin(th) * (ky / math.fabs(kx))
function code(kx, ky, th) return Float64(sin(th) * Float64(ky / abs(kx))) end
function tmp = code(kx, ky, th) tmp = sin(th) * (ky / abs(kx)); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] * N[(ky / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sin th \cdot \frac{ky}{\left|kx\right|}
Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.6%
Applied rewrites16.6%
(FPCore (kx ky th) :precision binary64 (* th (/ ky (fabs kx))))
double code(double kx, double ky, double th) {
return th * (ky / fabs(kx));
}
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 * (ky / abs(kx))
end function
public static double code(double kx, double ky, double th) {
return th * (ky / Math.abs(kx));
}
def code(kx, ky, th): return th * (ky / math.fabs(kx))
function code(kx, ky, th) return Float64(th * Float64(ky / abs(kx))) end
function tmp = code(kx, ky, th) tmp = th * (ky / abs(kx)); end
code[kx_, ky_, th_] := N[(th * N[(ky / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
th \cdot \frac{ky}{\left|kx\right|}
Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6435.1%
Applied rewrites35.1%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.6%
Applied rewrites15.6%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f6412.4%
Applied rewrites12.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6413.4%
Applied rewrites13.4%
herbie shell --seed 2025285 -o generate:evaluate
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2) (pow (sin ky) 2)))) (sin th)))