
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
Herbie found 24 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
Initial program 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(fabs ky)
(+ 1.0 (* -0.16666666666666666 (pow (fabs ky) 2.0)))))
(t_2 (sin (fabs ky)))
(t_3
(*
(/ t_2 (hypot t_2 (sin kx)))
(* th (+ 1.0 (* -0.16666666666666666 (pow th 2.0))))))
(t_4 (pow t_2 2.0))
(t_5 (pow (sin kx) 2.0))
(t_6 (/ t_2 (sqrt (+ t_5 t_4)))))
(*
(copysign 1.0 ky)
(if (<= t_6 -0.9998)
(/
(* (sin th) t_2)
(hypot
(* kx (+ 1.0 (* -0.16666666666666666 (pow kx 2.0))))
t_2))
(if (<= t_6 -0.3)
t_3
(if (<= t_6 5e-15)
(* (/ t_2 (sqrt t_5)) (sin th))
(if (<= t_6 0.9990377408563715)
t_3
(if (<= t_6 1.0)
(* (/ t_2 (sqrt t_4)) (sin th))
(* (/ t_1 (hypot t_1 (sin kx))) (sin th))))))))))double code(double kx, double ky, double th) {
double t_1 = fabs(ky) * (1.0 + (-0.16666666666666666 * pow(fabs(ky), 2.0)));
double t_2 = sin(fabs(ky));
double t_3 = (t_2 / hypot(t_2, sin(kx))) * (th * (1.0 + (-0.16666666666666666 * pow(th, 2.0))));
double t_4 = pow(t_2, 2.0);
double t_5 = pow(sin(kx), 2.0);
double t_6 = t_2 / sqrt((t_5 + t_4));
double tmp;
if (t_6 <= -0.9998) {
tmp = (sin(th) * t_2) / hypot((kx * (1.0 + (-0.16666666666666666 * pow(kx, 2.0)))), t_2);
} else if (t_6 <= -0.3) {
tmp = t_3;
} else if (t_6 <= 5e-15) {
tmp = (t_2 / sqrt(t_5)) * sin(th);
} else if (t_6 <= 0.9990377408563715) {
tmp = t_3;
} else if (t_6 <= 1.0) {
tmp = (t_2 / sqrt(t_4)) * sin(th);
} else {
tmp = (t_1 / hypot(t_1, sin(kx))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(ky) * (1.0 + (-0.16666666666666666 * Math.pow(Math.abs(ky), 2.0)));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = (t_2 / Math.hypot(t_2, Math.sin(kx))) * (th * (1.0 + (-0.16666666666666666 * Math.pow(th, 2.0))));
double t_4 = Math.pow(t_2, 2.0);
double t_5 = Math.pow(Math.sin(kx), 2.0);
double t_6 = t_2 / Math.sqrt((t_5 + t_4));
double tmp;
if (t_6 <= -0.9998) {
tmp = (Math.sin(th) * t_2) / Math.hypot((kx * (1.0 + (-0.16666666666666666 * Math.pow(kx, 2.0)))), t_2);
} else if (t_6 <= -0.3) {
tmp = t_3;
} else if (t_6 <= 5e-15) {
tmp = (t_2 / Math.sqrt(t_5)) * Math.sin(th);
} else if (t_6 <= 0.9990377408563715) {
tmp = t_3;
} else if (t_6 <= 1.0) {
tmp = (t_2 / Math.sqrt(t_4)) * Math.sin(th);
} else {
tmp = (t_1 / Math.hypot(t_1, Math.sin(kx))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.fabs(ky) * (1.0 + (-0.16666666666666666 * math.pow(math.fabs(ky), 2.0))) t_2 = math.sin(math.fabs(ky)) t_3 = (t_2 / math.hypot(t_2, math.sin(kx))) * (th * (1.0 + (-0.16666666666666666 * math.pow(th, 2.0)))) t_4 = math.pow(t_2, 2.0) t_5 = math.pow(math.sin(kx), 2.0) t_6 = t_2 / math.sqrt((t_5 + t_4)) tmp = 0 if t_6 <= -0.9998: tmp = (math.sin(th) * t_2) / math.hypot((kx * (1.0 + (-0.16666666666666666 * math.pow(kx, 2.0)))), t_2) elif t_6 <= -0.3: tmp = t_3 elif t_6 <= 5e-15: tmp = (t_2 / math.sqrt(t_5)) * math.sin(th) elif t_6 <= 0.9990377408563715: tmp = t_3 elif t_6 <= 1.0: tmp = (t_2 / math.sqrt(t_4)) * math.sin(th) else: tmp = (t_1 / math.hypot(t_1, math.sin(kx))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = Float64(abs(ky) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(ky) ^ 2.0)))) t_2 = sin(abs(ky)) t_3 = Float64(Float64(t_2 / hypot(t_2, sin(kx))) * Float64(th * Float64(1.0 + Float64(-0.16666666666666666 * (th ^ 2.0))))) t_4 = t_2 ^ 2.0 t_5 = sin(kx) ^ 2.0 t_6 = Float64(t_2 / sqrt(Float64(t_5 + t_4))) tmp = 0.0 if (t_6 <= -0.9998) tmp = Float64(Float64(sin(th) * t_2) / hypot(Float64(kx * Float64(1.0 + Float64(-0.16666666666666666 * (kx ^ 2.0)))), t_2)); elseif (t_6 <= -0.3) tmp = t_3; elseif (t_6 <= 5e-15) tmp = Float64(Float64(t_2 / sqrt(t_5)) * sin(th)); elseif (t_6 <= 0.9990377408563715) tmp = t_3; elseif (t_6 <= 1.0) tmp = Float64(Float64(t_2 / sqrt(t_4)) * sin(th)); else tmp = Float64(Float64(t_1 / hypot(t_1, sin(kx))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = abs(ky) * (1.0 + (-0.16666666666666666 * (abs(ky) ^ 2.0))); t_2 = sin(abs(ky)); t_3 = (t_2 / hypot(t_2, sin(kx))) * (th * (1.0 + (-0.16666666666666666 * (th ^ 2.0)))); t_4 = t_2 ^ 2.0; t_5 = sin(kx) ^ 2.0; t_6 = t_2 / sqrt((t_5 + t_4)); tmp = 0.0; if (t_6 <= -0.9998) tmp = (sin(th) * t_2) / hypot((kx * (1.0 + (-0.16666666666666666 * (kx ^ 2.0)))), t_2); elseif (t_6 <= -0.3) tmp = t_3; elseif (t_6 <= 5e-15) tmp = (t_2 / sqrt(t_5)) * sin(th); elseif (t_6 <= 0.9990377408563715) tmp = t_3; elseif (t_6 <= 1.0) tmp = (t_2 / sqrt(t_4)) * sin(th); else tmp = (t_1 / hypot(t_1, sin(kx))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Abs[ky], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$2 / N[Sqrt[t$95$2 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(1.0 + N[(-0.16666666666666666 * N[Power[th, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[t$95$2, 2.0], $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$2 / N[Sqrt[N[(t$95$5 + t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$6, -0.9998], N[(N[(N[Sin[th], $MachinePrecision] * t$95$2), $MachinePrecision] / N[Sqrt[N[(kx * N[(1.0 + N[(-0.16666666666666666 * N[Power[kx, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + t$95$2 ^ 2], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, -0.3], t$95$3, If[LessEqual[t$95$6, 5e-15], N[(N[(t$95$2 / N[Sqrt[t$95$5], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$6, 0.9990377408563715], t$95$3, If[LessEqual[t$95$6, 1.0], N[(N[(t$95$2 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \left|ky\right| \cdot \left(1 + -0.16666666666666666 \cdot {\left(\left|ky\right|\right)}^{2}\right)\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := \frac{t\_2}{\mathsf{hypot}\left(t\_2, \sin kx\right)} \cdot \left(th \cdot \left(1 + -0.16666666666666666 \cdot {th}^{2}\right)\right)\\
t_4 := {t\_2}^{2}\\
t_5 := {\sin kx}^{2}\\
t_6 := \frac{t\_2}{\sqrt{t\_5 + t\_4}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_6 \leq -0.9998:\\
\;\;\;\;\frac{\sin th \cdot t\_2}{\mathsf{hypot}\left(kx \cdot \left(1 + -0.16666666666666666 \cdot {kx}^{2}\right), t\_2\right)}\\
\mathbf{elif}\;t\_6 \leq -0.3:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_6 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_5}} \cdot \sin th\\
\mathbf{elif}\;t\_6 \leq 0.9990377408563715:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_6 \leq 1:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6454.4%
Applied rewrites54.4%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in th around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.8%
Applied rewrites50.8%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
if 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6440.6%
Applied rewrites40.6%
if 1 < (/.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 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6454.8%
Applied rewrites54.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2
(*
(- t_1)
(*
(/ -1.0 (hypot (sin kx) t_1))
(* th (+ 1.0 (* -0.16666666666666666 (pow th 2.0)))))))
(t_3
(*
(*
(/
1.0
(hypot
(* kx (+ 1.0 (* -0.16666666666666666 (pow kx 2.0))))
t_1))
t_1)
(sin th)))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_1 (sqrt (+ t_4 (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9998)
t_3
(if (<= t_5 -0.3)
t_2
(if (<= t_5 5e-15)
(* (/ t_1 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715) t_2 t_3)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = -t_1 * ((-1.0 / hypot(sin(kx), t_1)) * (th * (1.0 + (-0.16666666666666666 * pow(th, 2.0)))));
double t_3 = ((1.0 / hypot((kx * (1.0 + (-0.16666666666666666 * pow(kx, 2.0)))), t_1)) * t_1) * sin(th);
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_1 / sqrt((t_4 + pow(t_1, 2.0)));
double tmp;
if (t_5 <= -0.9998) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_2;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_2;
} else {
tmp = t_3;
}
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 = -t_1 * ((-1.0 / Math.hypot(Math.sin(kx), t_1)) * (th * (1.0 + (-0.16666666666666666 * Math.pow(th, 2.0)))));
double t_3 = ((1.0 / Math.hypot((kx * (1.0 + (-0.16666666666666666 * Math.pow(kx, 2.0)))), t_1)) * t_1) * Math.sin(th);
double t_4 = Math.pow(Math.sin(kx), 2.0);
double t_5 = t_1 / Math.sqrt((t_4 + Math.pow(t_1, 2.0)));
double tmp;
if (t_5 <= -0.9998) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_2;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_2;
} else {
tmp = t_3;
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = -t_1 * ((-1.0 / math.hypot(math.sin(kx), t_1)) * (th * (1.0 + (-0.16666666666666666 * math.pow(th, 2.0))))) t_3 = ((1.0 / math.hypot((kx * (1.0 + (-0.16666666666666666 * math.pow(kx, 2.0)))), t_1)) * t_1) * math.sin(th) t_4 = math.pow(math.sin(kx), 2.0) t_5 = t_1 / math.sqrt((t_4 + math.pow(t_1, 2.0))) tmp = 0 if t_5 <= -0.9998: tmp = t_3 elif t_5 <= -0.3: tmp = t_2 elif t_5 <= 5e-15: tmp = (t_1 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.9990377408563715: tmp = t_2 else: tmp = t_3 return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(Float64(-t_1) * Float64(Float64(-1.0 / hypot(sin(kx), t_1)) * Float64(th * Float64(1.0 + Float64(-0.16666666666666666 * (th ^ 2.0)))))) t_3 = Float64(Float64(Float64(1.0 / hypot(Float64(kx * Float64(1.0 + Float64(-0.16666666666666666 * (kx ^ 2.0)))), t_1)) * t_1) * sin(th)) t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_1 / sqrt(Float64(t_4 + (t_1 ^ 2.0)))) tmp = 0.0 if (t_5 <= -0.9998) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_2; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_1 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_2; else tmp = t_3; 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 * ((-1.0 / hypot(sin(kx), t_1)) * (th * (1.0 + (-0.16666666666666666 * (th ^ 2.0))))); t_3 = ((1.0 / hypot((kx * (1.0 + (-0.16666666666666666 * (kx ^ 2.0)))), t_1)) * t_1) * sin(th); t_4 = sin(kx) ^ 2.0; t_5 = t_1 / sqrt((t_4 + (t_1 ^ 2.0))); tmp = 0.0; if (t_5 <= -0.9998) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_2; elseif (t_5 <= 5e-15) tmp = (t_1 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.9990377408563715) tmp = t_2; else tmp = t_3; 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[((-t$95$1) * N[(N[(-1.0 / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(1.0 + N[(-0.16666666666666666 * N[Power[th, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(1.0 / N[Sqrt[N[(kx * N[(1.0 + N[(-0.16666666666666666 * N[Power[kx, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 / N[Sqrt[N[(t$95$4 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9998], t$95$3, If[LessEqual[t$95$5, -0.3], t$95$2, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$1 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$2, t$95$3]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \left(-t\_1\right) \cdot \left(\frac{-1}{\mathsf{hypot}\left(\sin kx, t\_1\right)} \cdot \left(th \cdot \left(1 + -0.16666666666666666 \cdot {th}^{2}\right)\right)\right)\\
t_3 := \left(\frac{1}{\mathsf{hypot}\left(kx \cdot \left(1 + -0.16666666666666666 \cdot {kx}^{2}\right), t\_1\right)} \cdot t\_1\right) \cdot \sin th\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{t\_1}{\sqrt{t\_4 + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9998:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002 or 0.99903774085637154 < (/.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 93.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5%
Applied rewrites99.5%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6457.8%
Applied rewrites57.8%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
Taylor expanded in th around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.7%
Applied rewrites50.7%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2
(*
(/ t_1 (hypot t_1 (sin kx)))
(* th (+ 1.0 (* -0.16666666666666666 (pow th 2.0))))))
(t_3
(*
(*
(/
1.0
(hypot
(* kx (+ 1.0 (* -0.16666666666666666 (pow kx 2.0))))
t_1))
t_1)
(sin th)))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_1 (sqrt (+ t_4 (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9998)
t_3
(if (<= t_5 -0.3)
t_2
(if (<= t_5 5e-15)
(* (/ t_1 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715) t_2 t_3)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = (t_1 / hypot(t_1, sin(kx))) * (th * (1.0 + (-0.16666666666666666 * pow(th, 2.0))));
double t_3 = ((1.0 / hypot((kx * (1.0 + (-0.16666666666666666 * pow(kx, 2.0)))), t_1)) * t_1) * sin(th);
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_1 / sqrt((t_4 + pow(t_1, 2.0)));
double tmp;
if (t_5 <= -0.9998) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_2;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_2;
} else {
tmp = t_3;
}
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 = (t_1 / Math.hypot(t_1, Math.sin(kx))) * (th * (1.0 + (-0.16666666666666666 * Math.pow(th, 2.0))));
double t_3 = ((1.0 / Math.hypot((kx * (1.0 + (-0.16666666666666666 * Math.pow(kx, 2.0)))), t_1)) * t_1) * Math.sin(th);
double t_4 = Math.pow(Math.sin(kx), 2.0);
double t_5 = t_1 / Math.sqrt((t_4 + Math.pow(t_1, 2.0)));
double tmp;
if (t_5 <= -0.9998) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_2;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_2;
} else {
tmp = t_3;
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = (t_1 / math.hypot(t_1, math.sin(kx))) * (th * (1.0 + (-0.16666666666666666 * math.pow(th, 2.0)))) t_3 = ((1.0 / math.hypot((kx * (1.0 + (-0.16666666666666666 * math.pow(kx, 2.0)))), t_1)) * t_1) * math.sin(th) t_4 = math.pow(math.sin(kx), 2.0) t_5 = t_1 / math.sqrt((t_4 + math.pow(t_1, 2.0))) tmp = 0 if t_5 <= -0.9998: tmp = t_3 elif t_5 <= -0.3: tmp = t_2 elif t_5 <= 5e-15: tmp = (t_1 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.9990377408563715: tmp = t_2 else: tmp = t_3 return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(Float64(t_1 / hypot(t_1, sin(kx))) * Float64(th * Float64(1.0 + Float64(-0.16666666666666666 * (th ^ 2.0))))) t_3 = Float64(Float64(Float64(1.0 / hypot(Float64(kx * Float64(1.0 + Float64(-0.16666666666666666 * (kx ^ 2.0)))), t_1)) * t_1) * sin(th)) t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_1 / sqrt(Float64(t_4 + (t_1 ^ 2.0)))) tmp = 0.0 if (t_5 <= -0.9998) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_2; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_1 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_2; else tmp = t_3; 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 / hypot(t_1, sin(kx))) * (th * (1.0 + (-0.16666666666666666 * (th ^ 2.0)))); t_3 = ((1.0 / hypot((kx * (1.0 + (-0.16666666666666666 * (kx ^ 2.0)))), t_1)) * t_1) * sin(th); t_4 = sin(kx) ^ 2.0; t_5 = t_1 / sqrt((t_4 + (t_1 ^ 2.0))); tmp = 0.0; if (t_5 <= -0.9998) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_2; elseif (t_5 <= 5e-15) tmp = (t_1 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.9990377408563715) tmp = t_2; else tmp = t_3; 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[(N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(1.0 + N[(-0.16666666666666666 * N[Power[th, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(1.0 / N[Sqrt[N[(kx * N[(1.0 + N[(-0.16666666666666666 * N[Power[kx, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 / N[Sqrt[N[(t$95$4 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9998], t$95$3, If[LessEqual[t$95$5, -0.3], t$95$2, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$1 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$2, t$95$3]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)} \cdot \left(th \cdot \left(1 + -0.16666666666666666 \cdot {th}^{2}\right)\right)\\
t_3 := \left(\frac{1}{\mathsf{hypot}\left(kx \cdot \left(1 + -0.16666666666666666 \cdot {kx}^{2}\right), t\_1\right)} \cdot t\_1\right) \cdot \sin th\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{t\_1}{\sqrt{t\_4 + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9998:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002 or 0.99903774085637154 < (/.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 93.7%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.6%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.5%
Applied rewrites99.5%
Taylor expanded in kx around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6457.8%
Applied rewrites57.8%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in th around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.8%
Applied rewrites50.8%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(fabs ky)
(+ 1.0 (* -0.16666666666666666 (pow (fabs ky) 2.0)))))
(t_2 (sin (fabs ky)))
(t_3 (pow t_2 2.0))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_2 (sqrt (+ t_4 t_3))))
(t_6
(*
(/ t_2 (hypot t_2 (sin kx)))
(* th (+ 1.0 (* -0.16666666666666666 (pow th 2.0)))))))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9998)
(* (/ t_2 (sqrt (+ (pow kx 2.0) t_3))) (sin th))
(if (<= t_5 -0.3)
t_6
(if (<= t_5 5e-15)
(* (/ t_2 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715)
t_6
(if (<= t_5 1.0)
(* (/ t_2 (sqrt t_3)) (sin th))
(* (/ t_1 (hypot t_1 (sin kx))) (sin th))))))))))double code(double kx, double ky, double th) {
double t_1 = fabs(ky) * (1.0 + (-0.16666666666666666 * pow(fabs(ky), 2.0)));
double t_2 = sin(fabs(ky));
double t_3 = pow(t_2, 2.0);
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_2 / sqrt((t_4 + t_3));
double t_6 = (t_2 / hypot(t_2, sin(kx))) * (th * (1.0 + (-0.16666666666666666 * pow(th, 2.0))));
double tmp;
if (t_5 <= -0.9998) {
tmp = (t_2 / sqrt((pow(kx, 2.0) + t_3))) * sin(th);
} else if (t_5 <= -0.3) {
tmp = t_6;
} else if (t_5 <= 5e-15) {
tmp = (t_2 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_6;
} else if (t_5 <= 1.0) {
tmp = (t_2 / sqrt(t_3)) * sin(th);
} else {
tmp = (t_1 / hypot(t_1, sin(kx))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(ky) * (1.0 + (-0.16666666666666666 * Math.pow(Math.abs(ky), 2.0)));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = Math.pow(t_2, 2.0);
double t_4 = Math.pow(Math.sin(kx), 2.0);
double t_5 = t_2 / Math.sqrt((t_4 + t_3));
double t_6 = (t_2 / Math.hypot(t_2, Math.sin(kx))) * (th * (1.0 + (-0.16666666666666666 * Math.pow(th, 2.0))));
double tmp;
if (t_5 <= -0.9998) {
tmp = (t_2 / Math.sqrt((Math.pow(kx, 2.0) + t_3))) * Math.sin(th);
} else if (t_5 <= -0.3) {
tmp = t_6;
} else if (t_5 <= 5e-15) {
tmp = (t_2 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_6;
} else if (t_5 <= 1.0) {
tmp = (t_2 / Math.sqrt(t_3)) * Math.sin(th);
} else {
tmp = (t_1 / Math.hypot(t_1, Math.sin(kx))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.fabs(ky) * (1.0 + (-0.16666666666666666 * math.pow(math.fabs(ky), 2.0))) t_2 = math.sin(math.fabs(ky)) t_3 = math.pow(t_2, 2.0) t_4 = math.pow(math.sin(kx), 2.0) t_5 = t_2 / math.sqrt((t_4 + t_3)) t_6 = (t_2 / math.hypot(t_2, math.sin(kx))) * (th * (1.0 + (-0.16666666666666666 * math.pow(th, 2.0)))) tmp = 0 if t_5 <= -0.9998: tmp = (t_2 / math.sqrt((math.pow(kx, 2.0) + t_3))) * math.sin(th) elif t_5 <= -0.3: tmp = t_6 elif t_5 <= 5e-15: tmp = (t_2 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.9990377408563715: tmp = t_6 elif t_5 <= 1.0: tmp = (t_2 / math.sqrt(t_3)) * math.sin(th) else: tmp = (t_1 / math.hypot(t_1, math.sin(kx))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = Float64(abs(ky) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(ky) ^ 2.0)))) t_2 = sin(abs(ky)) t_3 = t_2 ^ 2.0 t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_2 / sqrt(Float64(t_4 + t_3))) t_6 = Float64(Float64(t_2 / hypot(t_2, sin(kx))) * Float64(th * Float64(1.0 + Float64(-0.16666666666666666 * (th ^ 2.0))))) tmp = 0.0 if (t_5 <= -0.9998) tmp = Float64(Float64(t_2 / sqrt(Float64((kx ^ 2.0) + t_3))) * sin(th)); elseif (t_5 <= -0.3) tmp = t_6; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_2 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_6; elseif (t_5 <= 1.0) tmp = Float64(Float64(t_2 / sqrt(t_3)) * sin(th)); else tmp = Float64(Float64(t_1 / hypot(t_1, sin(kx))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = abs(ky) * (1.0 + (-0.16666666666666666 * (abs(ky) ^ 2.0))); t_2 = sin(abs(ky)); t_3 = t_2 ^ 2.0; t_4 = sin(kx) ^ 2.0; t_5 = t_2 / sqrt((t_4 + t_3)); t_6 = (t_2 / hypot(t_2, sin(kx))) * (th * (1.0 + (-0.16666666666666666 * (th ^ 2.0)))); tmp = 0.0; if (t_5 <= -0.9998) tmp = (t_2 / sqrt(((kx ^ 2.0) + t_3))) * sin(th); elseif (t_5 <= -0.3) tmp = t_6; elseif (t_5 <= 5e-15) tmp = (t_2 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.9990377408563715) tmp = t_6; elseif (t_5 <= 1.0) tmp = (t_2 / sqrt(t_3)) * sin(th); else tmp = (t_1 / hypot(t_1, sin(kx))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Abs[ky], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 / N[Sqrt[N[(t$95$4 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$2 / N[Sqrt[t$95$2 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(th * N[(1.0 + N[(-0.16666666666666666 * N[Power[th, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9998], N[(N[(t$95$2 / N[Sqrt[N[(N[Power[kx, 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, -0.3], t$95$6, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$2 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$6, If[LessEqual[t$95$5, 1.0], N[(N[(t$95$2 / N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \left|ky\right| \cdot \left(1 + -0.16666666666666666 \cdot {\left(\left|ky\right|\right)}^{2}\right)\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := {t\_2}^{2}\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{t\_2}{\sqrt{t\_4 + t\_3}}\\
t_6 := \frac{t\_2}{\mathsf{hypot}\left(t\_2, \sin kx\right)} \cdot \left(th \cdot \left(1 + -0.16666666666666666 \cdot {th}^{2}\right)\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9998:\\
\;\;\;\;\frac{t\_2}{\sqrt{{kx}^{2} + t\_3}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 1:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_3}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in th around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6450.8%
Applied rewrites50.8%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
if 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6440.6%
Applied rewrites40.6%
if 1 < (/.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 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6454.8%
Applied rewrites54.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(*
(fabs ky)
(+ 1.0 (* -0.16666666666666666 (pow (fabs ky) 2.0)))))
(t_2 (sin (fabs ky)))
(t_3 (pow t_2 2.0))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_2 (sqrt (+ t_4 t_3))))
(t_6 (/ (* th t_2) (hypot (sin kx) t_2))))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9998)
(* (/ t_2 (sqrt (+ (pow kx 2.0) t_3))) (sin th))
(if (<= t_5 -0.3)
t_6
(if (<= t_5 5e-15)
(* (/ t_2 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715)
t_6
(if (<= t_5 1.0)
(* (/ t_2 (sqrt t_3)) (sin th))
(* (/ t_1 (hypot t_1 (sin kx))) (sin th))))))))))double code(double kx, double ky, double th) {
double t_1 = fabs(ky) * (1.0 + (-0.16666666666666666 * pow(fabs(ky), 2.0)));
double t_2 = sin(fabs(ky));
double t_3 = pow(t_2, 2.0);
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_2 / sqrt((t_4 + t_3));
double t_6 = (th * t_2) / hypot(sin(kx), t_2);
double tmp;
if (t_5 <= -0.9998) {
tmp = (t_2 / sqrt((pow(kx, 2.0) + t_3))) * sin(th);
} else if (t_5 <= -0.3) {
tmp = t_6;
} else if (t_5 <= 5e-15) {
tmp = (t_2 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_6;
} else if (t_5 <= 1.0) {
tmp = (t_2 / sqrt(t_3)) * sin(th);
} else {
tmp = (t_1 / hypot(t_1, sin(kx))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.abs(ky) * (1.0 + (-0.16666666666666666 * Math.pow(Math.abs(ky), 2.0)));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = Math.pow(t_2, 2.0);
double t_4 = Math.pow(Math.sin(kx), 2.0);
double t_5 = t_2 / Math.sqrt((t_4 + t_3));
double t_6 = (th * t_2) / Math.hypot(Math.sin(kx), t_2);
double tmp;
if (t_5 <= -0.9998) {
tmp = (t_2 / Math.sqrt((Math.pow(kx, 2.0) + t_3))) * Math.sin(th);
} else if (t_5 <= -0.3) {
tmp = t_6;
} else if (t_5 <= 5e-15) {
tmp = (t_2 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_6;
} else if (t_5 <= 1.0) {
tmp = (t_2 / Math.sqrt(t_3)) * Math.sin(th);
} else {
tmp = (t_1 / Math.hypot(t_1, Math.sin(kx))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.fabs(ky) * (1.0 + (-0.16666666666666666 * math.pow(math.fabs(ky), 2.0))) t_2 = math.sin(math.fabs(ky)) t_3 = math.pow(t_2, 2.0) t_4 = math.pow(math.sin(kx), 2.0) t_5 = t_2 / math.sqrt((t_4 + t_3)) t_6 = (th * t_2) / math.hypot(math.sin(kx), t_2) tmp = 0 if t_5 <= -0.9998: tmp = (t_2 / math.sqrt((math.pow(kx, 2.0) + t_3))) * math.sin(th) elif t_5 <= -0.3: tmp = t_6 elif t_5 <= 5e-15: tmp = (t_2 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.9990377408563715: tmp = t_6 elif t_5 <= 1.0: tmp = (t_2 / math.sqrt(t_3)) * math.sin(th) else: tmp = (t_1 / math.hypot(t_1, math.sin(kx))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = Float64(abs(ky) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(ky) ^ 2.0)))) t_2 = sin(abs(ky)) t_3 = t_2 ^ 2.0 t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_2 / sqrt(Float64(t_4 + t_3))) t_6 = Float64(Float64(th * t_2) / hypot(sin(kx), t_2)) tmp = 0.0 if (t_5 <= -0.9998) tmp = Float64(Float64(t_2 / sqrt(Float64((kx ^ 2.0) + t_3))) * sin(th)); elseif (t_5 <= -0.3) tmp = t_6; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_2 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_6; elseif (t_5 <= 1.0) tmp = Float64(Float64(t_2 / sqrt(t_3)) * sin(th)); else tmp = Float64(Float64(t_1 / hypot(t_1, sin(kx))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = abs(ky) * (1.0 + (-0.16666666666666666 * (abs(ky) ^ 2.0))); t_2 = sin(abs(ky)); t_3 = t_2 ^ 2.0; t_4 = sin(kx) ^ 2.0; t_5 = t_2 / sqrt((t_4 + t_3)); t_6 = (th * t_2) / hypot(sin(kx), t_2); tmp = 0.0; if (t_5 <= -0.9998) tmp = (t_2 / sqrt(((kx ^ 2.0) + t_3))) * sin(th); elseif (t_5 <= -0.3) tmp = t_6; elseif (t_5 <= 5e-15) tmp = (t_2 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.9990377408563715) tmp = t_6; elseif (t_5 <= 1.0) tmp = (t_2 / sqrt(t_3)) * sin(th); else tmp = (t_1 / hypot(t_1, sin(kx))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Abs[ky], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 / N[Sqrt[N[(t$95$4 + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(th * t$95$2), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$2 ^ 2], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9998], N[(N[(t$95$2 / N[Sqrt[N[(N[Power[kx, 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, -0.3], t$95$6, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$2 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$6, If[LessEqual[t$95$5, 1.0], N[(N[(t$95$2 / N[Sqrt[t$95$3], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[t$95$1 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]]
\begin{array}{l}
t_1 := \left|ky\right| \cdot \left(1 + -0.16666666666666666 \cdot {\left(\left|ky\right|\right)}^{2}\right)\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := {t\_2}^{2}\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{t\_2}{\sqrt{t\_4 + t\_3}}\\
t_6 := \frac{th \cdot t\_2}{\mathsf{hypot}\left(\sin kx, t\_2\right)}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9998:\\
\;\;\;\;\frac{t\_2}{\sqrt{{kx}^{2} + t\_3}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 1:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_3}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\mathsf{hypot}\left(t\_1, \sin kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99980000000000002Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
if 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6440.6%
Applied rewrites40.6%
if 1 < (/.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 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6454.8%
Applied rewrites54.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (pow t_1 2.0))
(t_3 (* (/ t_1 (sqrt t_2)) (sin th)))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_1 (sqrt (+ t_4 t_2))))
(t_6 (/ (* th t_1) (hypot (sin kx) t_1)))
(t_7
(*
(fabs ky)
(+ 1.0 (* -0.16666666666666666 (pow (fabs ky) 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9948)
t_3
(if (<= t_5 -0.3)
t_6
(if (<= t_5 5e-15)
(* (/ t_1 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715)
t_6
(if (<= t_5 1.0)
t_3
(* (/ t_7 (hypot t_7 (sin kx))) (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 = (t_1 / sqrt(t_2)) * sin(th);
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_1 / sqrt((t_4 + t_2));
double t_6 = (th * t_1) / hypot(sin(kx), t_1);
double t_7 = fabs(ky) * (1.0 + (-0.16666666666666666 * pow(fabs(ky), 2.0)));
double tmp;
if (t_5 <= -0.9948) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_6;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_6;
} else if (t_5 <= 1.0) {
tmp = t_3;
} else {
tmp = (t_7 / hypot(t_7, sin(kx))) * 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 = (t_1 / Math.sqrt(t_2)) * Math.sin(th);
double t_4 = Math.pow(Math.sin(kx), 2.0);
double t_5 = t_1 / Math.sqrt((t_4 + t_2));
double t_6 = (th * t_1) / Math.hypot(Math.sin(kx), t_1);
double t_7 = Math.abs(ky) * (1.0 + (-0.16666666666666666 * Math.pow(Math.abs(ky), 2.0)));
double tmp;
if (t_5 <= -0.9948) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_6;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_6;
} else if (t_5 <= 1.0) {
tmp = t_3;
} else {
tmp = (t_7 / Math.hypot(t_7, Math.sin(kx))) * 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 = (t_1 / math.sqrt(t_2)) * math.sin(th) t_4 = math.pow(math.sin(kx), 2.0) t_5 = t_1 / math.sqrt((t_4 + t_2)) t_6 = (th * t_1) / math.hypot(math.sin(kx), t_1) t_7 = math.fabs(ky) * (1.0 + (-0.16666666666666666 * math.pow(math.fabs(ky), 2.0))) tmp = 0 if t_5 <= -0.9948: tmp = t_3 elif t_5 <= -0.3: tmp = t_6 elif t_5 <= 5e-15: tmp = (t_1 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.9990377408563715: tmp = t_6 elif t_5 <= 1.0: tmp = t_3 else: tmp = (t_7 / math.hypot(t_7, math.sin(kx))) * 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 = Float64(Float64(t_1 / sqrt(t_2)) * sin(th)) t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_1 / sqrt(Float64(t_4 + t_2))) t_6 = Float64(Float64(th * t_1) / hypot(sin(kx), t_1)) t_7 = Float64(abs(ky) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(ky) ^ 2.0)))) tmp = 0.0 if (t_5 <= -0.9948) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_6; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_1 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_6; elseif (t_5 <= 1.0) tmp = t_3; else tmp = Float64(Float64(t_7 / hypot(t_7, sin(kx))) * 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 = (t_1 / sqrt(t_2)) * sin(th); t_4 = sin(kx) ^ 2.0; t_5 = t_1 / sqrt((t_4 + t_2)); t_6 = (th * t_1) / hypot(sin(kx), t_1); t_7 = abs(ky) * (1.0 + (-0.16666666666666666 * (abs(ky) ^ 2.0))); tmp = 0.0; if (t_5 <= -0.9948) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_6; elseif (t_5 <= 5e-15) tmp = (t_1 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.9990377408563715) tmp = t_6; elseif (t_5 <= 1.0) tmp = t_3; else tmp = (t_7 / hypot(t_7, sin(kx))) * 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.0], $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[kx], $MachinePrecision], 2.0], $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[(N[(th * t$95$1), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[Abs[ky], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9948], t$95$3, If[LessEqual[t$95$5, -0.3], t$95$6, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$1 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$6, If[LessEqual[t$95$5, 1.0], t$95$3, N[(N[(t$95$7 / N[Sqrt[t$95$7 ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $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 := \frac{t\_1}{\sqrt{t\_2}} \cdot \sin th\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{t\_1}{\sqrt{t\_4 + t\_2}}\\
t_6 := \frac{th \cdot t\_1}{\mathsf{hypot}\left(\sin kx, t\_1\right)}\\
t_7 := \left|ky\right| \cdot \left(1 + -0.16666666666666666 \cdot {\left(\left|ky\right|\right)}^{2}\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9948:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_6\\
\mathbf{elif}\;t\_5 \leq 1:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_7}{\mathsf{hypot}\left(t\_7, \sin kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.99480000000000002 or 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6440.6%
Applied rewrites40.6%
if -0.99480000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
if 1 < (/.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 93.7%
lift-sqrt.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6499.7%
Applied rewrites99.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6451.3%
Applied rewrites51.3%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6454.8%
Applied rewrites54.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (pow t_1 2.0))
(t_3 (* (/ t_1 (sqrt t_2)) (sin th)))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_1 (sqrt (+ t_4 t_2))))
(t_6 (hypot (sin kx) t_1))
(t_7 (/ (* th t_1) t_6)))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9948)
t_3
(if (<= t_5 -0.3)
t_7
(if (<= t_5 5e-15)
(* (/ t_1 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715)
t_7
(if (<= t_5 1.0)
t_3
(* (* -1.0 (fabs ky)) (* (/ -1.0 t_6) (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 = (t_1 / sqrt(t_2)) * sin(th);
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_1 / sqrt((t_4 + t_2));
double t_6 = hypot(sin(kx), t_1);
double t_7 = (th * t_1) / t_6;
double tmp;
if (t_5 <= -0.9948) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_7;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_7;
} else if (t_5 <= 1.0) {
tmp = t_3;
} else {
tmp = (-1.0 * fabs(ky)) * ((-1.0 / t_6) * 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 = (t_1 / Math.sqrt(t_2)) * Math.sin(th);
double t_4 = Math.pow(Math.sin(kx), 2.0);
double t_5 = t_1 / Math.sqrt((t_4 + t_2));
double t_6 = Math.hypot(Math.sin(kx), t_1);
double t_7 = (th * t_1) / t_6;
double tmp;
if (t_5 <= -0.9948) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_7;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / Math.sqrt(t_4)) * Math.sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_7;
} else if (t_5 <= 1.0) {
tmp = t_3;
} else {
tmp = (-1.0 * Math.abs(ky)) * ((-1.0 / t_6) * 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 = (t_1 / math.sqrt(t_2)) * math.sin(th) t_4 = math.pow(math.sin(kx), 2.0) t_5 = t_1 / math.sqrt((t_4 + t_2)) t_6 = math.hypot(math.sin(kx), t_1) t_7 = (th * t_1) / t_6 tmp = 0 if t_5 <= -0.9948: tmp = t_3 elif t_5 <= -0.3: tmp = t_7 elif t_5 <= 5e-15: tmp = (t_1 / math.sqrt(t_4)) * math.sin(th) elif t_5 <= 0.9990377408563715: tmp = t_7 elif t_5 <= 1.0: tmp = t_3 else: tmp = (-1.0 * math.fabs(ky)) * ((-1.0 / t_6) * 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 = Float64(Float64(t_1 / sqrt(t_2)) * sin(th)) t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_1 / sqrt(Float64(t_4 + t_2))) t_6 = hypot(sin(kx), t_1) t_7 = Float64(Float64(th * t_1) / t_6) tmp = 0.0 if (t_5 <= -0.9948) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_7; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_1 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_7; elseif (t_5 <= 1.0) tmp = t_3; else tmp = Float64(Float64(-1.0 * abs(ky)) * Float64(Float64(-1.0 / t_6) * 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 = (t_1 / sqrt(t_2)) * sin(th); t_4 = sin(kx) ^ 2.0; t_5 = t_1 / sqrt((t_4 + t_2)); t_6 = hypot(sin(kx), t_1); t_7 = (th * t_1) / t_6; tmp = 0.0; if (t_5 <= -0.9948) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_7; elseif (t_5 <= 5e-15) tmp = (t_1 / sqrt(t_4)) * sin(th); elseif (t_5 <= 0.9990377408563715) tmp = t_7; elseif (t_5 <= 1.0) tmp = t_3; else tmp = (-1.0 * abs(ky)) * ((-1.0 / t_6) * 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.0], $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[kx], $MachinePrecision], 2.0], $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[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]}, Block[{t$95$7 = N[(N[(th * t$95$1), $MachinePrecision] / t$95$6), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9948], t$95$3, If[LessEqual[t$95$5, -0.3], t$95$7, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$1 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$7, If[LessEqual[t$95$5, 1.0], t$95$3, N[(N[(-1.0 * N[Abs[ky], $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 / t$95$6), $MachinePrecision] * N[Sin[th], $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 kx}^{2}\\
t_5 := \frac{t\_1}{\sqrt{t\_4 + t\_2}}\\
t_6 := \mathsf{hypot}\left(\sin kx, t\_1\right)\\
t_7 := \frac{th \cdot t\_1}{t\_6}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9948:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_7\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_7\\
\mathbf{elif}\;t\_5 \leq 1:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\left(-1 \cdot \left|ky\right|\right) \cdot \left(\frac{-1}{t\_6} \cdot \sin th\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.99480000000000002 or 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6440.6%
Applied rewrites40.6%
if -0.99480000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
if 1 < (/.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 93.7%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-*.f6451.5%
Applied rewrites51.5%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (pow t_1 2.0))
(t_3 (* (/ t_1 (sqrt t_2)) (sin th)))
(t_4 (sin (fabs kx)))
(t_5 (/ (* th t_1) (hypot t_4 t_1)))
(t_6 (pow t_4 2.0))
(t_7 (/ t_1 (sqrt (+ t_6 t_2)))))
(*
(copysign 1.0 ky)
(if (<= t_7 -0.9948)
t_3
(if (<= t_7 -0.3)
t_5
(if (<= t_7 5e-15)
(* (/ t_1 (sqrt t_6)) (sin th))
(if (<= t_7 0.9990377408563715)
t_5
(if (<= t_7 2.0)
t_3
(* (sin th) (* (fabs ky) (/ 1.0 (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 = sin(fabs(kx));
double t_5 = (th * t_1) / hypot(t_4, t_1);
double t_6 = pow(t_4, 2.0);
double t_7 = t_1 / sqrt((t_6 + t_2));
double tmp;
if (t_7 <= -0.9948) {
tmp = t_3;
} else if (t_7 <= -0.3) {
tmp = t_5;
} else if (t_7 <= 5e-15) {
tmp = (t_1 / sqrt(t_6)) * sin(th);
} else if (t_7 <= 0.9990377408563715) {
tmp = t_5;
} else if (t_7 <= 2.0) {
tmp = t_3;
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / 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.sin(Math.abs(kx));
double t_5 = (th * t_1) / Math.hypot(t_4, t_1);
double t_6 = Math.pow(t_4, 2.0);
double t_7 = t_1 / Math.sqrt((t_6 + t_2));
double tmp;
if (t_7 <= -0.9948) {
tmp = t_3;
} else if (t_7 <= -0.3) {
tmp = t_5;
} else if (t_7 <= 5e-15) {
tmp = (t_1 / Math.sqrt(t_6)) * Math.sin(th);
} else if (t_7 <= 0.9990377408563715) {
tmp = t_5;
} else if (t_7 <= 2.0) {
tmp = t_3;
} else {
tmp = Math.sin(th) * (Math.abs(ky) * (1.0 / 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.sin(math.fabs(kx)) t_5 = (th * t_1) / math.hypot(t_4, t_1) t_6 = math.pow(t_4, 2.0) t_7 = t_1 / math.sqrt((t_6 + t_2)) tmp = 0 if t_7 <= -0.9948: tmp = t_3 elif t_7 <= -0.3: tmp = t_5 elif t_7 <= 5e-15: tmp = (t_1 / math.sqrt(t_6)) * math.sin(th) elif t_7 <= 0.9990377408563715: tmp = t_5 elif t_7 <= 2.0: tmp = t_3 else: tmp = math.sin(th) * (math.fabs(ky) * (1.0 / 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)) t_5 = Float64(Float64(th * t_1) / hypot(t_4, t_1)) t_6 = t_4 ^ 2.0 t_7 = Float64(t_1 / sqrt(Float64(t_6 + t_2))) tmp = 0.0 if (t_7 <= -0.9948) tmp = t_3; elseif (t_7 <= -0.3) tmp = t_5; elseif (t_7 <= 5e-15) tmp = Float64(Float64(t_1 / sqrt(t_6)) * sin(th)); elseif (t_7 <= 0.9990377408563715) tmp = t_5; elseif (t_7 <= 2.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / 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)); t_5 = (th * t_1) / hypot(t_4, t_1); t_6 = t_4 ^ 2.0; t_7 = t_1 / sqrt((t_6 + t_2)); tmp = 0.0; if (t_7 <= -0.9948) tmp = t_3; elseif (t_7 <= -0.3) tmp = t_5; elseif (t_7 <= 5e-15) tmp = (t_1 / sqrt(t_6)) * sin(th); elseif (t_7 <= 0.9990377408563715) tmp = t_5; elseif (t_7 <= 2.0) tmp = t_3; else tmp = sin(th) * (abs(ky) * (1.0 / 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.0], $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[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(N[(th * t$95$1), $MachinePrecision] / N[Sqrt[t$95$4 ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Power[t$95$4, 2.0], $MachinePrecision]}, Block[{t$95$7 = N[(t$95$1 / N[Sqrt[N[(t$95$6 + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$7, -0.9948], t$95$3, If[LessEqual[t$95$7, -0.3], t$95$5, If[LessEqual[t$95$7, 5e-15], N[(N[(t$95$1 / N[Sqrt[t$95$6], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$7, 0.9990377408563715], t$95$5, If[LessEqual[t$95$7, 2.0], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[kx], $MachinePrecision]), $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)\\
t_5 := \frac{th \cdot t\_1}{\mathsf{hypot}\left(t\_4, t\_1\right)}\\
t_6 := {t\_4}^{2}\\
t_7 := \frac{t\_1}{\sqrt{t\_6 + t\_2}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_7 \leq -0.9948:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_7 \leq -0.3:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_7 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_6}} \cdot \sin th\\
\mathbf{elif}\;t\_7 \leq 0.9990377408563715:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_7 \leq 2:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|kx\right|}\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.99480000000000002 or 0.99903774085637154 < (/.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 93.7%
Taylor expanded in kx around 0
lower-pow.f64N/A
lower-sin.f6440.6%
Applied rewrites40.6%
if -0.99480000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ (* th t_1) (hypot (sin kx) t_1)))
(t_3
(*
t_1
(/
(sin th)
(sqrt
(fma
(- 1.0 (cos (+ (fabs ky) (fabs ky))))
0.5
(* kx kx))))))
(t_4 (pow (sin kx) 2.0))
(t_5 (/ t_1 (sqrt (+ t_4 (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_5 -0.9998)
t_3
(if (<= t_5 -0.3)
t_2
(if (<= t_5 5e-15)
(* (/ t_1 (sqrt t_4)) (sin th))
(if (<= t_5 0.9990377408563715)
t_2
(if (<= t_5 1.0)
t_3
(* (sin th) (* (fabs ky) (/ 1.0 (fabs (sin kx)))))))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = (th * t_1) / hypot(sin(kx), t_1);
double t_3 = t_1 * (sin(th) / sqrt(fma((1.0 - cos((fabs(ky) + fabs(ky)))), 0.5, (kx * kx))));
double t_4 = pow(sin(kx), 2.0);
double t_5 = t_1 / sqrt((t_4 + pow(t_1, 2.0)));
double tmp;
if (t_5 <= -0.9998) {
tmp = t_3;
} else if (t_5 <= -0.3) {
tmp = t_2;
} else if (t_5 <= 5e-15) {
tmp = (t_1 / sqrt(t_4)) * sin(th);
} else if (t_5 <= 0.9990377408563715) {
tmp = t_2;
} else if (t_5 <= 1.0) {
tmp = t_3;
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / fabs(sin(kx))));
}
return copysign(1.0, ky) * tmp;
}
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(Float64(th * t_1) / hypot(sin(kx), t_1)) t_3 = Float64(t_1 * Float64(sin(th) / sqrt(fma(Float64(1.0 - cos(Float64(abs(ky) + abs(ky)))), 0.5, Float64(kx * kx))))) t_4 = sin(kx) ^ 2.0 t_5 = Float64(t_1 / sqrt(Float64(t_4 + (t_1 ^ 2.0)))) tmp = 0.0 if (t_5 <= -0.9998) tmp = t_3; elseif (t_5 <= -0.3) tmp = t_2; elseif (t_5 <= 5e-15) tmp = Float64(Float64(t_1 / sqrt(t_4)) * sin(th)); elseif (t_5 <= 0.9990377408563715) tmp = t_2; elseif (t_5 <= 1.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / abs(sin(kx))))); end return Float64(copysign(1.0, ky) * tmp) end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(th * t$95$1), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 / N[Sqrt[N[(t$95$4 + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$5, -0.9998], t$95$3, If[LessEqual[t$95$5, -0.3], t$95$2, If[LessEqual[t$95$5, 5e-15], N[(N[(t$95$1 / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$5, 0.9990377408563715], t$95$2, If[LessEqual[t$95$5, 1.0], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{th \cdot t\_1}{\mathsf{hypot}\left(\sin kx, t\_1\right)}\\
t_3 := t\_1 \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right), 0.5, kx \cdot kx\right)}}\\
t_4 := {\sin kx}^{2}\\
t_5 := \frac{t\_1}{\sqrt{t\_4 + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_5 \leq -0.9998:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_5 \leq -0.3:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{t\_1}{\sqrt{t\_4}} \cdot \sin th\\
\mathbf{elif}\;t\_5 \leq 0.9990377408563715:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_5 \leq 1:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|\sin kx\right|}\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.99980000000000002 or 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites43.4%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
Taylor expanded in ky around 0
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
if 1 < (/.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 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval36.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6439.9%
Applied rewrites39.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ (* th t_1) (hypot (sin kx) t_1)))
(t_3
(*
t_1
(/
(sin th)
(sqrt
(fma
(- 1.0 (cos (+ (fabs ky) (fabs ky))))
0.5
(* kx kx))))))
(t_4 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0)))))
(t_5 (fabs (sin kx))))
(*
(copysign 1.0 ky)
(if (<= t_4 -0.9998)
t_3
(if (<= t_4 -0.3)
t_2
(if (<= t_4 5e-15)
(* (* (/ -1.0 t_5) (- t_1)) (sin th))
(if (<= t_4 0.9990377408563715)
t_2
(if (<= t_4 1.0)
t_3
(* (sin th) (* (fabs ky) (/ 1.0 t_5)))))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = (th * t_1) / hypot(sin(kx), t_1);
double t_3 = t_1 * (sin(th) / sqrt(fma((1.0 - cos((fabs(ky) + fabs(ky)))), 0.5, (kx * kx))));
double t_4 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double t_5 = fabs(sin(kx));
double tmp;
if (t_4 <= -0.9998) {
tmp = t_3;
} else if (t_4 <= -0.3) {
tmp = t_2;
} else if (t_4 <= 5e-15) {
tmp = ((-1.0 / t_5) * -t_1) * sin(th);
} else if (t_4 <= 0.9990377408563715) {
tmp = t_2;
} else if (t_4 <= 1.0) {
tmp = t_3;
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / t_5));
}
return copysign(1.0, ky) * tmp;
}
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(Float64(th * t_1) / hypot(sin(kx), t_1)) t_3 = Float64(t_1 * Float64(sin(th) / sqrt(fma(Float64(1.0 - cos(Float64(abs(ky) + abs(ky)))), 0.5, Float64(kx * kx))))) t_4 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) t_5 = abs(sin(kx)) tmp = 0.0 if (t_4 <= -0.9998) tmp = t_3; elseif (t_4 <= -0.3) tmp = t_2; elseif (t_4 <= 5e-15) tmp = Float64(Float64(Float64(-1.0 / t_5) * Float64(-t_1)) * sin(th)); elseif (t_4 <= 0.9990377408563715) tmp = t_2; elseif (t_4 <= 1.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / t_5))); end return Float64(copysign(1.0, ky) * tmp) end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(th * t$95$1), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$4, -0.9998], t$95$3, If[LessEqual[t$95$4, -0.3], t$95$2, If[LessEqual[t$95$4, 5e-15], N[(N[(N[(-1.0 / t$95$5), $MachinePrecision] * (-t$95$1)), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.9990377408563715], t$95$2, If[LessEqual[t$95$4, 1.0], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{th \cdot t\_1}{\mathsf{hypot}\left(\sin kx, t\_1\right)}\\
t_3 := t\_1 \cdot \frac{\sin th}{\sqrt{\mathsf{fma}\left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right), 0.5, kx \cdot kx\right)}}\\
t_4 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
t_5 := \left|\sin kx\right|\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_4 \leq -0.9998:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq -0.3:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\left(\frac{-1}{t\_5} \cdot \left(-t\_1\right)\right) \cdot \sin th\\
\mathbf{elif}\;t\_4 \leq 0.9990377408563715:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 1:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{t\_5}\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.99980000000000002 or 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.1%
lift-+.f64N/A
+-commutativeN/A
Applied rewrites43.4%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites45.0%
if 1 < (/.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 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval36.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6439.9%
Applied rewrites39.9%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ (* th t_1) (hypot (sin kx) t_1)))
(t_3
(/
(* (sin th) t_1)
(sqrt
(fma (- 1.0 (cos (+ (fabs ky) (fabs ky)))) 0.5 (* kx kx)))))
(t_4 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0)))))
(t_5 (fabs (sin kx))))
(*
(copysign 1.0 ky)
(if (<= t_4 -0.9998)
t_3
(if (<= t_4 -0.3)
t_2
(if (<= t_4 5e-15)
(* (* (/ -1.0 t_5) (- t_1)) (sin th))
(if (<= t_4 0.9990377408563715)
t_2
(if (<= t_4 1.0)
t_3
(* (sin th) (* (fabs ky) (/ 1.0 t_5)))))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = (th * t_1) / hypot(sin(kx), t_1);
double t_3 = (sin(th) * t_1) / sqrt(fma((1.0 - cos((fabs(ky) + fabs(ky)))), 0.5, (kx * kx)));
double t_4 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double t_5 = fabs(sin(kx));
double tmp;
if (t_4 <= -0.9998) {
tmp = t_3;
} else if (t_4 <= -0.3) {
tmp = t_2;
} else if (t_4 <= 5e-15) {
tmp = ((-1.0 / t_5) * -t_1) * sin(th);
} else if (t_4 <= 0.9990377408563715) {
tmp = t_2;
} else if (t_4 <= 1.0) {
tmp = t_3;
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / t_5));
}
return copysign(1.0, ky) * tmp;
}
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(Float64(th * t_1) / hypot(sin(kx), t_1)) t_3 = Float64(Float64(sin(th) * t_1) / sqrt(fma(Float64(1.0 - cos(Float64(abs(ky) + abs(ky)))), 0.5, Float64(kx * kx)))) t_4 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) t_5 = abs(sin(kx)) tmp = 0.0 if (t_4 <= -0.9998) tmp = t_3; elseif (t_4 <= -0.3) tmp = t_2; elseif (t_4 <= 5e-15) tmp = Float64(Float64(Float64(-1.0 / t_5) * Float64(-t_1)) * sin(th)); elseif (t_4 <= 0.9990377408563715) tmp = t_2; elseif (t_4 <= 1.0) tmp = t_3; else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / t_5))); end return Float64(copysign(1.0, ky) * tmp) end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(th * t$95$1), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sin[th], $MachinePrecision] * t$95$1), $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * 0.5 + N[(kx * kx), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$4, -0.9998], t$95$3, If[LessEqual[t$95$4, -0.3], t$95$2, If[LessEqual[t$95$4, 5e-15], N[(N[(N[(-1.0 / t$95$5), $MachinePrecision] * (-t$95$1)), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.9990377408563715], t$95$2, If[LessEqual[t$95$4, 1.0], t$95$3, N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{th \cdot t\_1}{\mathsf{hypot}\left(\sin kx, t\_1\right)}\\
t_3 := \frac{\sin th \cdot t\_1}{\sqrt{\mathsf{fma}\left(1 - \cos \left(\left|ky\right| + \left|ky\right|\right), 0.5, kx \cdot kx\right)}}\\
t_4 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
t_5 := \left|\sin kx\right|\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_4 \leq -0.9998:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_4 \leq -0.3:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\left(\frac{-1}{t\_5} \cdot \left(-t\_1\right)\right) \cdot \sin th\\
\mathbf{elif}\;t\_4 \leq 0.9990377408563715:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_4 \leq 1:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{t\_5}\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.99980000000000002 or 0.99903774085637154 < (/.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))))) < 1Initial program 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-commutativeN/A
lift-*.f64N/A
lower-/.f6450.5%
lift-+.f64N/A
+-commutativeN/A
lift-pow.f64N/A
pow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sin-multN/A
mult-flipN/A
metadata-evalN/A
Applied rewrites42.6%
if -0.99980000000000002 < (/.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.29999999999999999 or 5e-15 < (/.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.99903774085637154Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if -0.29999999999999999 < (/.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))))) < 5e-15Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites45.0%
if 1 < (/.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 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lower-/.f64N/A
metadata-eval36.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6439.9%
Applied rewrites39.9%
(FPCore (kx ky th) :precision binary64 (* (copysign 1.0 th) (if (<= (fabs th) 31.0) (/ (* (fabs th) (sin ky)) (hypot (sin kx) (sin ky))) (* (* (/ -1.0 (fabs (sin kx))) (- (sin ky))) (sin (fabs th))))))
double code(double kx, double ky, double th) {
double tmp;
if (fabs(th) <= 31.0) {
tmp = (fabs(th) * sin(ky)) / hypot(sin(kx), sin(ky));
} else {
tmp = ((-1.0 / fabs(sin(kx))) * -sin(ky)) * sin(fabs(th));
}
return copysign(1.0, th) * tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.abs(th) <= 31.0) {
tmp = (Math.abs(th) * Math.sin(ky)) / Math.hypot(Math.sin(kx), Math.sin(ky));
} else {
tmp = ((-1.0 / Math.abs(Math.sin(kx))) * -Math.sin(ky)) * Math.sin(Math.abs(th));
}
return Math.copySign(1.0, th) * tmp;
}
def code(kx, ky, th): tmp = 0 if math.fabs(th) <= 31.0: tmp = (math.fabs(th) * math.sin(ky)) / math.hypot(math.sin(kx), math.sin(ky)) else: tmp = ((-1.0 / math.fabs(math.sin(kx))) * -math.sin(ky)) * math.sin(math.fabs(th)) return math.copysign(1.0, th) * tmp
function code(kx, ky, th) tmp = 0.0 if (abs(th) <= 31.0) tmp = Float64(Float64(abs(th) * sin(ky)) / hypot(sin(kx), sin(ky))); else tmp = Float64(Float64(Float64(-1.0 / abs(sin(kx))) * Float64(-sin(ky))) * sin(abs(th))); end return Float64(copysign(1.0, th) * tmp) end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (abs(th) <= 31.0) tmp = (abs(th) * sin(ky)) / hypot(sin(kx), sin(ky)); else tmp = ((-1.0 / abs(sin(kx))) * -sin(ky)) * sin(abs(th)); end tmp_2 = (sign(th) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[th]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[th], $MachinePrecision], 31.0], N[(N[(N[Abs[th], $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(N[(-1.0 / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * (-N[Sin[ky], $MachinePrecision])), $MachinePrecision] * N[Sin[N[Abs[th], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, th\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|th\right| \leq 31:\\
\;\;\;\;\frac{\left|th\right| \cdot \sin ky}{\mathsf{hypot}\left(\sin kx, \sin ky\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{-1}{\left|\sin kx\right|} \cdot \left(-\sin ky\right)\right) \cdot \sin \left(\left|th\right|\right)\\
\end{array}
if th < 31Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6492.1%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-pow.f64N/A
unpow2N/A
lower-hypot.f6496.1%
Applied rewrites96.1%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6447.6%
Applied rewrites47.6%
if 31 < th Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites45.0%
(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.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 0.99)
(* (* (/ -1.0 (fabs t_2)) (- t_1)) (sin th))
(if (<= t_3 2.0)
(*
(/
t_1
(sqrt (+ (* (fabs ky) (fabs ky)) (* (fabs kx) (fabs kx)))))
(sin th))
(* (sin th) (* (fabs ky) (/ 1.0 (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.99) {
tmp = ((-1.0 / fabs(t_2)) * -t_1) * sin(th);
} else if (t_3 <= 2.0) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) + (fabs(kx) * fabs(kx))))) * sin(th);
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / 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.99) {
tmp = ((-1.0 / Math.abs(t_2)) * -t_1) * Math.sin(th);
} else if (t_3 <= 2.0) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) + (Math.abs(kx) * Math.abs(kx))))) * Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.abs(ky) * (1.0 / 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.99: tmp = ((-1.0 / math.fabs(t_2)) * -t_1) * math.sin(th) elif t_3 <= 2.0: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) + (math.fabs(kx) * math.fabs(kx))))) * math.sin(th) else: tmp = math.sin(th) * (math.fabs(ky) * (1.0 / 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.99) tmp = Float64(Float64(Float64(-1.0 / abs(t_2)) * Float64(-t_1)) * sin(th)); elseif (t_3 <= 2.0) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) + Float64(abs(kx) * abs(kx))))) * sin(th)); else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / 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.99) tmp = ((-1.0 / abs(t_2)) * -t_1) * sin(th); elseif (t_3 <= 2.0) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) + (abs(kx) * abs(kx))))) * sin(th); else tmp = sin(th) * (abs(ky) * (1.0 / 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.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 0.99], N[(N[(N[(-1.0 / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision] * (-t$95$1)), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[kx], $MachinePrecision] * N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[kx], $MachinePrecision]), $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 0.99:\\
\;\;\;\;\left(\frac{-1}{\left|t\_2\right|} \cdot \left(-t\_1\right)\right) \cdot \sin th\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| + \left|kx\right| \cdot \left|kx\right|}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|kx\right|}\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.98999999999999999Initial program 93.7%
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
associate-*l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
Applied rewrites99.4%
Taylor expanded in ky around 0
lower-/.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.7%
Applied rewrites41.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites45.0%
if 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 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
Taylor expanded in ky around 0
lower-pow.f6428.4%
Applied rewrites28.4%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6428.4%
lift-pow.f64N/A
unpow2N/A
lower-*.f6428.4%
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites28.4%
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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(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.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 0.965)
(* (sin th) (/ (fabs ky) (fabs t_2)))
(if (<= t_3 2.0)
(*
(/
t_1
(sqrt (+ (* (fabs ky) (fabs ky)) (* (fabs kx) (fabs kx)))))
(sin th))
(* (sin th) (* (fabs ky) (/ 1.0 (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.965) {
tmp = sin(th) * (fabs(ky) / fabs(t_2));
} else if (t_3 <= 2.0) {
tmp = (t_1 / sqrt(((fabs(ky) * fabs(ky)) + (fabs(kx) * fabs(kx))))) * sin(th);
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / 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.965) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(t_2));
} else if (t_3 <= 2.0) {
tmp = (t_1 / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) + (Math.abs(kx) * Math.abs(kx))))) * Math.sin(th);
} else {
tmp = Math.sin(th) * (Math.abs(ky) * (1.0 / 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.965: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(t_2)) elif t_3 <= 2.0: tmp = (t_1 / math.sqrt(((math.fabs(ky) * math.fabs(ky)) + (math.fabs(kx) * math.fabs(kx))))) * math.sin(th) else: tmp = math.sin(th) * (math.fabs(ky) * (1.0 / 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.965) tmp = Float64(sin(th) * Float64(abs(ky) / abs(t_2))); elseif (t_3 <= 2.0) tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(abs(ky) * abs(ky)) + Float64(abs(kx) * abs(kx))))) * sin(th)); else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / 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.965) tmp = sin(th) * (abs(ky) / abs(t_2)); elseif (t_3 <= 2.0) tmp = (t_1 / sqrt(((abs(ky) * abs(ky)) + (abs(kx) * abs(kx))))) * sin(th); else tmp = sin(th) * (abs(ky) * (1.0 / 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.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 0.965], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(N[(t$95$1 / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[kx], $MachinePrecision] * N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[kx], $MachinePrecision]), $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 0.965:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|t\_2\right|}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left|ky\right| \cdot \left|ky\right| + \left|kx\right| \cdot \left|kx\right|}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|kx\right|}\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.96499999999999997Initial program 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6440.0%
Applied rewrites40.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
if 0.96499999999999997 < (/.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 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
Taylor expanded in ky around 0
lower-pow.f6428.4%
Applied rewrites28.4%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6428.4%
lift-pow.f64N/A
unpow2N/A
lower-*.f6428.4%
lower-*.f64N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites28.4%
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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(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.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 0.965)
(* (sin th) (/ (fabs ky) (fabs t_2)))
(if (<= t_3 2.0)
(*
t_1
(/
(sin th)
(sqrt (+ (* (fabs ky) (fabs ky)) (* (fabs kx) (fabs kx))))))
(* (sin th) (* (fabs ky) (/ 1.0 (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.965) {
tmp = sin(th) * (fabs(ky) / fabs(t_2));
} else if (t_3 <= 2.0) {
tmp = t_1 * (sin(th) / sqrt(((fabs(ky) * fabs(ky)) + (fabs(kx) * fabs(kx)))));
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / 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.965) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(t_2));
} else if (t_3 <= 2.0) {
tmp = t_1 * (Math.sin(th) / Math.sqrt(((Math.abs(ky) * Math.abs(ky)) + (Math.abs(kx) * Math.abs(kx)))));
} else {
tmp = Math.sin(th) * (Math.abs(ky) * (1.0 / 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.965: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(t_2)) elif t_3 <= 2.0: tmp = t_1 * (math.sin(th) / math.sqrt(((math.fabs(ky) * math.fabs(ky)) + (math.fabs(kx) * math.fabs(kx))))) else: tmp = math.sin(th) * (math.fabs(ky) * (1.0 / 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.965) tmp = Float64(sin(th) * Float64(abs(ky) / abs(t_2))); elseif (t_3 <= 2.0) tmp = Float64(t_1 * Float64(sin(th) / sqrt(Float64(Float64(abs(ky) * abs(ky)) + Float64(abs(kx) * abs(kx)))))); else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / 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.965) tmp = sin(th) * (abs(ky) / abs(t_2)); elseif (t_3 <= 2.0) tmp = t_1 * (sin(th) / sqrt(((abs(ky) * abs(ky)) + (abs(kx) * abs(kx))))); else tmp = sin(th) * (abs(ky) * (1.0 / 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.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 0.965], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(t$95$1 * N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[kx], $MachinePrecision] * N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[kx], $MachinePrecision]), $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 0.965:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|t\_2\right|}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;t\_1 \cdot \frac{\sin th}{\sqrt{\left|ky\right| \cdot \left|ky\right| + \left|kx\right| \cdot \left|kx\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|kx\right|}\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.96499999999999997Initial program 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6440.0%
Applied rewrites40.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
if 0.96499999999999997 < (/.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 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
Taylor expanded in ky around 0
lower-pow.f6428.4%
Applied rewrites28.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6428.3%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6428.3%
Applied rewrites28.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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(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.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 0.99)
(* (sin th) (/ (fabs ky) (fabs t_2)))
(if (<= t_3 2.0)
(/
1.0
(/
(sqrt (+ (* (fabs ky) (fabs ky)) (* (fabs kx) (fabs kx))))
(*
(*
(fabs ky)
(+ 1.0 (* -0.16666666666666666 (pow (fabs ky) 2.0))))
(sin th))))
(* (sin th) (* (fabs ky) (/ 1.0 (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.99) {
tmp = sin(th) * (fabs(ky) / fabs(t_2));
} else if (t_3 <= 2.0) {
tmp = 1.0 / (sqrt(((fabs(ky) * fabs(ky)) + (fabs(kx) * fabs(kx)))) / ((fabs(ky) * (1.0 + (-0.16666666666666666 * pow(fabs(ky), 2.0)))) * sin(th)));
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / 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.99) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(t_2));
} else if (t_3 <= 2.0) {
tmp = 1.0 / (Math.sqrt(((Math.abs(ky) * Math.abs(ky)) + (Math.abs(kx) * Math.abs(kx)))) / ((Math.abs(ky) * (1.0 + (-0.16666666666666666 * Math.pow(Math.abs(ky), 2.0)))) * Math.sin(th)));
} else {
tmp = Math.sin(th) * (Math.abs(ky) * (1.0 / 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.99: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(t_2)) elif t_3 <= 2.0: tmp = 1.0 / (math.sqrt(((math.fabs(ky) * math.fabs(ky)) + (math.fabs(kx) * math.fabs(kx)))) / ((math.fabs(ky) * (1.0 + (-0.16666666666666666 * math.pow(math.fabs(ky), 2.0)))) * math.sin(th))) else: tmp = math.sin(th) * (math.fabs(ky) * (1.0 / 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.99) tmp = Float64(sin(th) * Float64(abs(ky) / abs(t_2))); elseif (t_3 <= 2.0) tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(abs(ky) * abs(ky)) + Float64(abs(kx) * abs(kx)))) / Float64(Float64(abs(ky) * Float64(1.0 + Float64(-0.16666666666666666 * (abs(ky) ^ 2.0)))) * sin(th)))); else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / 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.99) tmp = sin(th) * (abs(ky) / abs(t_2)); elseif (t_3 <= 2.0) tmp = 1.0 / (sqrt(((abs(ky) * abs(ky)) + (abs(kx) * abs(kx)))) / ((abs(ky) * (1.0 + (-0.16666666666666666 * (abs(ky) ^ 2.0)))) * sin(th))); else tmp = sin(th) * (abs(ky) * (1.0 / 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.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 0.99], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(1.0 / N[(N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[kx], $MachinePrecision] * N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(N[Abs[ky], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[kx], $MachinePrecision]), $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 0.99:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|t\_2\right|}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\left|ky\right| \cdot \left|ky\right| + \left|kx\right| \cdot \left|kx\right|}}{\left(\left|ky\right| \cdot \left(1 + -0.16666666666666666 \cdot {\left(\left|ky\right|\right)}^{2}\right)\right) \cdot \sin th}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|kx\right|}\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.98999999999999999Initial program 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6440.0%
Applied rewrites40.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
if 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 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
Taylor expanded in ky around 0
lower-pow.f6428.4%
Applied rewrites28.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
Applied rewrites26.7%
Taylor expanded in ky around 0
lower-*.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-pow.f6424.9%
Applied rewrites24.9%
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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(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.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 0.99)
(* (sin th) (/ (fabs ky) (fabs t_2)))
(if (<= t_3 2.0)
(/
1.0
(/
(sqrt (+ (* (fabs ky) (fabs ky)) (* (fabs kx) (fabs kx))))
(* th t_1)))
(* (sin th) (* (fabs ky) (/ 1.0 (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.99) {
tmp = sin(th) * (fabs(ky) / fabs(t_2));
} else if (t_3 <= 2.0) {
tmp = 1.0 / (sqrt(((fabs(ky) * fabs(ky)) + (fabs(kx) * fabs(kx)))) / (th * t_1));
} else {
tmp = sin(th) * (fabs(ky) * (1.0 / 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.99) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(t_2));
} else if (t_3 <= 2.0) {
tmp = 1.0 / (Math.sqrt(((Math.abs(ky) * Math.abs(ky)) + (Math.abs(kx) * Math.abs(kx)))) / (th * t_1));
} else {
tmp = Math.sin(th) * (Math.abs(ky) * (1.0 / 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.99: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(t_2)) elif t_3 <= 2.0: tmp = 1.0 / (math.sqrt(((math.fabs(ky) * math.fabs(ky)) + (math.fabs(kx) * math.fabs(kx)))) / (th * t_1)) else: tmp = math.sin(th) * (math.fabs(ky) * (1.0 / 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.99) tmp = Float64(sin(th) * Float64(abs(ky) / abs(t_2))); elseif (t_3 <= 2.0) tmp = Float64(1.0 / Float64(sqrt(Float64(Float64(abs(ky) * abs(ky)) + Float64(abs(kx) * abs(kx)))) / Float64(th * t_1))); else tmp = Float64(sin(th) * Float64(abs(ky) * Float64(1.0 / 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.99) tmp = sin(th) * (abs(ky) / abs(t_2)); elseif (t_3 <= 2.0) tmp = 1.0 / (sqrt(((abs(ky) * abs(ky)) + (abs(kx) * abs(kx)))) / (th * t_1)); else tmp = sin(th) * (abs(ky) * (1.0 / 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.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, 0.99], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.0], N[(1.0 / N[(N[Sqrt[N[(N[(N[Abs[ky], $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision] + N[(N[Abs[kx], $MachinePrecision] * N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(th * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[(1.0 / N[Abs[kx], $MachinePrecision]), $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 0.99:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|t\_2\right|}\\
\mathbf{elif}\;t\_3 \leq 2:\\
\;\;\;\;\frac{1}{\frac{\sqrt{\left|ky\right| \cdot \left|ky\right| + \left|kx\right| \cdot \left|kx\right|}}{th \cdot t\_1}}\\
\mathbf{else}:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \frac{1}{\left|kx\right|}\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.98999999999999999Initial program 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6440.0%
Applied rewrites40.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6439.9%
Applied rewrites39.9%
if 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 93.7%
Taylor expanded in kx around 0
lower-pow.f6452.2%
Applied rewrites52.2%
Taylor expanded in ky around 0
lower-pow.f6428.4%
Applied rewrites28.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
Applied rewrites26.7%
Taylor expanded in th around 0
lower-*.f64N/A
lower-sin.f6417.4%
Applied rewrites17.4%
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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(FPCore (kx ky th) :precision binary64 (* (copysign 1.0 th) (if (<= (fabs th) 420.0) (* (/ (fabs th) (fabs (sin (fabs kx)))) ky) (* (sin (fabs th)) (/ ky (fabs kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (fabs(th) <= 420.0) {
tmp = (fabs(th) / fabs(sin(fabs(kx)))) * ky;
} else {
tmp = sin(fabs(th)) * (ky / fabs(kx));
}
return copysign(1.0, th) * tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.abs(th) <= 420.0) {
tmp = (Math.abs(th) / Math.abs(Math.sin(Math.abs(kx)))) * ky;
} else {
tmp = Math.sin(Math.abs(th)) * (ky / Math.abs(kx));
}
return Math.copySign(1.0, th) * tmp;
}
def code(kx, ky, th): tmp = 0 if math.fabs(th) <= 420.0: tmp = (math.fabs(th) / math.fabs(math.sin(math.fabs(kx)))) * ky else: tmp = math.sin(math.fabs(th)) * (ky / math.fabs(kx)) return math.copysign(1.0, th) * tmp
function code(kx, ky, th) tmp = 0.0 if (abs(th) <= 420.0) tmp = Float64(Float64(abs(th) / abs(sin(abs(kx)))) * ky); else tmp = Float64(sin(abs(th)) * Float64(ky / abs(kx))); end return Float64(copysign(1.0, th) * tmp) end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (abs(th) <= 420.0) tmp = (abs(th) / abs(sin(abs(kx)))) * ky; else tmp = sin(abs(th)) * (ky / abs(kx)); end tmp_2 = (sign(th) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[th]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[th], $MachinePrecision], 420.0], N[(N[(N[Abs[th], $MachinePrecision] / N[Abs[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision], N[(N[Sin[N[Abs[th], $MachinePrecision]], $MachinePrecision] * N[(ky / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\mathsf{copysign}\left(1, th\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|th\right| \leq 420:\\
\;\;\;\;\frac{\left|th\right|}{\left|\sin \left(\left|kx\right|\right)\right|} \cdot ky\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\left|th\right|\right) \cdot \frac{ky}{\left|kx\right|}\\
\end{array}
if th < 420Initial program 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6440.0%
Applied rewrites40.0%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6421.2%
Applied rewrites21.2%
if 420 < th Initial program 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(FPCore (kx ky th) :precision binary64 (if (<= (fabs kx) 3e+28) (* (/ (sin th) (fabs kx)) ky) (/ (* ky th) (fabs (sin (fabs kx))))))
double code(double kx, double ky, double th) {
double tmp;
if (fabs(kx) <= 3e+28) {
tmp = (sin(th) / fabs(kx)) * ky;
} else {
tmp = (ky * th) / fabs(sin(fabs(kx)));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (abs(kx) <= 3d+28) then
tmp = (sin(th) / abs(kx)) * ky
else
tmp = (ky * th) / abs(sin(abs(kx)))
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.abs(kx) <= 3e+28) {
tmp = (Math.sin(th) / Math.abs(kx)) * ky;
} else {
tmp = (ky * th) / Math.abs(Math.sin(Math.abs(kx)));
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.fabs(kx) <= 3e+28: tmp = (math.sin(th) / math.fabs(kx)) * ky else: tmp = (ky * th) / math.fabs(math.sin(math.fabs(kx))) return tmp
function code(kx, ky, th) tmp = 0.0 if (abs(kx) <= 3e+28) tmp = Float64(Float64(sin(th) / abs(kx)) * ky); else tmp = Float64(Float64(ky * th) / abs(sin(abs(kx)))); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (abs(kx) <= 3e+28) tmp = (sin(th) / abs(kx)) * ky; else tmp = (ky * th) / abs(sin(abs(kx))); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Abs[kx], $MachinePrecision], 3e+28], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision] * ky), $MachinePrecision], N[(N[(ky * th), $MachinePrecision] / N[Abs[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|kx\right| \leq 3 \cdot 10^{+28}:\\
\;\;\;\;\frac{\sin th}{\left|kx\right|} \cdot ky\\
\mathbf{else}:\\
\;\;\;\;\frac{ky \cdot th}{\left|\sin \left(\left|kx\right|\right)\right|}\\
\end{array}
if kx < 3.0000000000000001e28Initial program 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
if 3.0000000000000001e28 < kx Initial program 93.7%
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.9%
Applied rewrites35.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.7%
lift-sqrt.f64N/A
lift-pow.f64N/A
pow2N/A
rem-sqrt-square-revN/A
lower-fabs.f6440.0%
Applied rewrites40.0%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sin.f6419.5%
Applied rewrites19.5%
(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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(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 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.8%
Applied rewrites16.8%
(FPCore (kx ky th) :precision binary64 (* th (fma -0.16666666666666666 (/ (* ky (pow th 2.0)) (fabs kx)) (/ ky (fabs kx)))))
double code(double kx, double ky, double th) {
return th * fma(-0.16666666666666666, ((ky * pow(th, 2.0)) / fabs(kx)), (ky / fabs(kx)));
}
function code(kx, ky, th) return Float64(th * fma(-0.16666666666666666, Float64(Float64(ky * (th ^ 2.0)) / abs(kx)), Float64(ky / abs(kx)))) end
code[kx_, ky_, th_] := N[(th * N[(-0.16666666666666666 * N[(N[(ky * N[Power[th, 2.0], $MachinePrecision]), $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision] + N[(ky / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
th \cdot \mathsf{fma}\left(-0.16666666666666666, \frac{ky \cdot {th}^{2}}{\left|kx\right|}, \frac{ky}{\left|kx\right|}\right)
Initial program 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
Taylor expanded in th around 0
lower-*.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f64N/A
lower-/.f6413.2%
Applied rewrites13.2%
(FPCore (kx ky th) :precision binary64 (/ (* ky th) (fabs kx)))
double code(double kx, double ky, double th) {
return (ky * th) / 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 = (ky * th) / abs(kx)
end function
public static double code(double kx, double ky, double th) {
return (ky * th) / Math.abs(kx);
}
def code(kx, ky, th): return (ky * th) / math.fabs(kx)
function code(kx, ky, th) return Float64(Float64(ky * th) / abs(kx)) end
function tmp = code(kx, ky, th) tmp = (ky * th) / abs(kx); end
code[kx_, ky_, th_] := N[(N[(ky * th), $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]
\frac{ky \cdot th}{\left|kx\right|}
Initial program 93.7%
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.9%
Applied rewrites35.9%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.9%
Applied rewrites15.9%
Taylor expanded in th around 0
lower-*.f6412.9%
Applied rewrites12.9%
herbie shell --seed 2025212
(FPCore (kx ky th)
:name "Toniolo and Linder, Equation (3b), real"
:precision binary64
(* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))