
(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 26 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
(if (<= (fabs kx) 2.55e-166)
(* (sin th) (copysign 1.0 (sin ky)))
(*
(/
(sin ky)
(sqrt (+ (pow (/ 1.0 (sin (fabs kx))) -2.0) (pow (sin ky) 2.0))))
(sin th))))double code(double kx, double ky, double th) {
double tmp;
if (fabs(kx) <= 2.55e-166) {
tmp = sin(th) * copysign(1.0, sin(ky));
} else {
tmp = (sin(ky) / sqrt((pow((1.0 / sin(fabs(kx))), -2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.abs(kx) <= 2.55e-166) {
tmp = Math.sin(th) * Math.copySign(1.0, Math.sin(ky));
} else {
tmp = (Math.sin(ky) / Math.sqrt((Math.pow((1.0 / Math.sin(Math.abs(kx))), -2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.fabs(kx) <= 2.55e-166: tmp = math.sin(th) * math.copysign(1.0, math.sin(ky)) else: tmp = (math.sin(ky) / math.sqrt((math.pow((1.0 / math.sin(math.fabs(kx))), -2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (abs(kx) <= 2.55e-166) tmp = Float64(sin(th) * copysign(1.0, sin(ky))); else tmp = Float64(Float64(sin(ky) / sqrt(Float64((Float64(1.0 / sin(abs(kx))) ^ -2.0) + (sin(ky) ^ 2.0)))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (abs(kx) <= 2.55e-166) tmp = sin(th) * (sign(sin(ky)) * abs(1.0)); else tmp = (sin(ky) / sqrt((((1.0 / sin(abs(kx))) ^ -2.0) + (sin(ky) ^ 2.0)))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Abs[kx], $MachinePrecision], 2.55e-166], N[(N[Sin[th], $MachinePrecision] * N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[(1.0 / N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|kx\right| \leq 2.55 \cdot 10^{-166}:\\
\;\;\;\;\sin th \cdot \mathsf{copysign}\left(1, \sin ky\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{{\left(\frac{1}{\sin \left(\left|kx\right|\right)}\right)}^{-2} + {\sin ky}^{2}}} \cdot \sin th\\
\end{array}
if kx < 2.5500000000000001e-166Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
fabs-rhs-divN/A
lower-copysign.f6444.4%
Applied rewrites44.4%
if 2.5500000000000001e-166 < kx Initial program 93.7%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lower-unsound-pow.f6493.6%
Applied rewrites93.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
mult-flipN/A
remove-double-divN/A
unpow-1N/A
lift-pow.f64N/A
inv-powN/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
metadata-eval93.6%
Applied rewrites93.6%
(FPCore (kx ky th)
:precision binary64
(if (<= (fabs kx) 2.55e-166)
(* (sin th) (copysign 1.0 (sin ky)))
(*
(/
(sin ky)
(sqrt (+ (pow (sin (fabs kx)) 2.0) (pow (sin ky) 2.0))))
(sin th))))double code(double kx, double ky, double th) {
double tmp;
if (fabs(kx) <= 2.55e-166) {
tmp = sin(th) * copysign(1.0, sin(ky));
} else {
tmp = (sin(ky) / sqrt((pow(sin(fabs(kx)), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (Math.abs(kx) <= 2.55e-166) {
tmp = Math.sin(th) * Math.copySign(1.0, Math.sin(ky));
} else {
tmp = (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(Math.abs(kx)), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if math.fabs(kx) <= 2.55e-166: tmp = math.sin(th) * math.copysign(1.0, math.sin(ky)) else: tmp = (math.sin(ky) / math.sqrt((math.pow(math.sin(math.fabs(kx)), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (abs(kx) <= 2.55e-166) tmp = Float64(sin(th) * copysign(1.0, sin(ky))); else tmp = Float64(Float64(sin(ky) / sqrt(Float64((sin(abs(kx)) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (abs(kx) <= 2.55e-166) tmp = sin(th) * (sign(sin(ky)) * abs(1.0)); else tmp = (sin(ky) / sqrt(((sin(abs(kx)) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[Abs[kx], $MachinePrecision], 2.55e-166], N[(N[Sin[th], $MachinePrecision] * N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|kx\right| \leq 2.55 \cdot 10^{-166}:\\
\;\;\;\;\sin th \cdot \mathsf{copysign}\left(1, \sin ky\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{{\sin \left(\left|kx\right|\right)}^{2} + {\sin ky}^{2}}} \cdot \sin th\\
\end{array}
if kx < 2.5500000000000001e-166Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
fabs-rhs-divN/A
lower-copysign.f6444.4%
Applied rewrites44.4%
if 2.5500000000000001e-166 < kx Initial program 93.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(/
(sin th)
(sqrt
(*
(+
(- (- 1.0 (cos (+ kx kx))) (cos (+ (fabs ky) (fabs ky))))
1.0)
0.5))))
(t_2 (sin (fabs ky)))
(t_3 (pow (sin kx) 2.0))
(t_4 (/ t_2 (sqrt (+ t_3 (pow t_2 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_4 4e-296)
(* t_1 t_2)
(if (<= t_4 0.001)
(* (/ t_2 (sqrt (+ t_3 (pow (fabs ky) 2.0)))) (sin th))
(if (<= t_4 0.9999999999999979)
(/ t_1 (/ 1.0 t_2))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(th) / sqrt(((((1.0 - cos((kx + kx))) - cos((fabs(ky) + fabs(ky)))) + 1.0) * 0.5));
double t_2 = sin(fabs(ky));
double t_3 = pow(sin(kx), 2.0);
double t_4 = t_2 / sqrt((t_3 + pow(t_2, 2.0)));
double tmp;
if (t_4 <= 4e-296) {
tmp = t_1 * t_2;
} else if (t_4 <= 0.001) {
tmp = (t_2 / sqrt((t_3 + pow(fabs(ky), 2.0)))) * sin(th);
} else if (t_4 <= 0.9999999999999979) {
tmp = t_1 / (1.0 / t_2);
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sqrt(((((1.0 - Math.cos((kx + kx))) - Math.cos((Math.abs(ky) + Math.abs(ky)))) + 1.0) * 0.5));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = Math.pow(Math.sin(kx), 2.0);
double t_4 = t_2 / Math.sqrt((t_3 + Math.pow(t_2, 2.0)));
double tmp;
if (t_4 <= 4e-296) {
tmp = t_1 * t_2;
} else if (t_4 <= 0.001) {
tmp = (t_2 / Math.sqrt((t_3 + Math.pow(Math.abs(ky), 2.0)))) * Math.sin(th);
} else if (t_4 <= 0.9999999999999979) {
tmp = t_1 / (1.0 / t_2);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sqrt(((((1.0 - math.cos((kx + kx))) - math.cos((math.fabs(ky) + math.fabs(ky)))) + 1.0) * 0.5)) t_2 = math.sin(math.fabs(ky)) t_3 = math.pow(math.sin(kx), 2.0) t_4 = t_2 / math.sqrt((t_3 + math.pow(t_2, 2.0))) tmp = 0 if t_4 <= 4e-296: tmp = t_1 * t_2 elif t_4 <= 0.001: tmp = (t_2 / math.sqrt((t_3 + math.pow(math.fabs(ky), 2.0)))) * math.sin(th) elif t_4 <= 0.9999999999999979: tmp = t_1 / (1.0 / t_2) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sqrt(Float64(Float64(Float64(Float64(1.0 - cos(Float64(kx + kx))) - cos(Float64(abs(ky) + abs(ky)))) + 1.0) * 0.5))) t_2 = sin(abs(ky)) t_3 = sin(kx) ^ 2.0 t_4 = Float64(t_2 / sqrt(Float64(t_3 + (t_2 ^ 2.0)))) tmp = 0.0 if (t_4 <= 4e-296) tmp = Float64(t_1 * t_2); elseif (t_4 <= 0.001) tmp = Float64(Float64(t_2 / sqrt(Float64(t_3 + (abs(ky) ^ 2.0)))) * sin(th)); elseif (t_4 <= 0.9999999999999979) tmp = Float64(t_1 / Float64(1.0 / t_2)); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sqrt(((((1.0 - cos((kx + kx))) - cos((abs(ky) + abs(ky)))) + 1.0) * 0.5)); t_2 = sin(abs(ky)); t_3 = sin(kx) ^ 2.0; t_4 = t_2 / sqrt((t_3 + (t_2 ^ 2.0))); tmp = 0.0; if (t_4 <= 4e-296) tmp = t_1 * t_2; elseif (t_4 <= 0.001) tmp = (t_2 / sqrt((t_3 + (abs(ky) ^ 2.0)))) * sin(th); elseif (t_4 <= 0.9999999999999979) tmp = t_1 / (1.0 / t_2); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[Power[t$95$2, 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$4, 4e-296], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t$95$4, 0.001], N[(N[(t$95$2 / N[Sqrt[N[(t$95$3 + N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.9999999999999979], N[(t$95$1 / N[(1.0 / t$95$2), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \frac{\sin th}{\sqrt{\left(\left(\left(1 - \cos \left(kx + kx\right)\right) - \cos \left(\left|ky\right| + \left|ky\right|\right)\right) + 1\right) \cdot 0.5}}\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := {\sin kx}^{2}\\
t_4 := \frac{t\_2}{\sqrt{t\_3 + {t\_2}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_4 \leq 4 \cdot 10^{-296}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t\_4 \leq 0.001:\\
\;\;\;\;\frac{t\_2}{\sqrt{t\_3 + {\left(\left|ky\right|\right)}^{2}}} \cdot \sin th\\
\mathbf{elif}\;t\_4 \leq 0.9999999999999979:\\
\;\;\;\;\frac{t\_1}{\frac{1}{t\_2}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4e-296Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites75.3%
if 4e-296 < (/.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))))) < 1e-3Initial program 93.7%
Taylor expanded in ky around 0
lower-pow.f6447.1%
Applied rewrites47.1%
if 1e-3 < (/.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.99999999999999789Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
mult-flipN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites75.2%
if 0.99999999999999789 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(/
(sin th)
(sqrt
(*
(+
(- (- 1.0 (cos (+ kx kx))) (cos (+ (fabs ky) (fabs ky))))
1.0)
0.5))))
(t_2 (sin (fabs ky)))
(t_3 (/ t_2 (sqrt (+ (pow (sin kx) 2.0) (pow t_2 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 -0.05)
(* t_1 t_2)
(if (<= t_3 0.001)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_3 0.9999999999999979)
(/ t_1 (/ 1.0 t_2))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(th) / sqrt(((((1.0 - cos((kx + kx))) - cos((fabs(ky) + fabs(ky)))) + 1.0) * 0.5));
double t_2 = sin(fabs(ky));
double t_3 = t_2 / sqrt((pow(sin(kx), 2.0) + pow(t_2, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = t_1 * t_2;
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = t_1 / (1.0 / t_2);
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(th) / Math.sqrt(((((1.0 - Math.cos((kx + kx))) - Math.cos((Math.abs(ky) + Math.abs(ky)))) + 1.0) * 0.5));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = t_2 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_2, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = t_1 * t_2;
} else if (t_3 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = t_1 / (1.0 / t_2);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(th) / math.sqrt(((((1.0 - math.cos((kx + kx))) - math.cos((math.fabs(ky) + math.fabs(ky)))) + 1.0) * 0.5)) t_2 = math.sin(math.fabs(ky)) t_3 = t_2 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_2, 2.0))) tmp = 0 if t_3 <= -0.05: tmp = t_1 * t_2 elif t_3 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_3 <= 0.9999999999999979: tmp = t_1 / (1.0 / t_2) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = Float64(sin(th) / sqrt(Float64(Float64(Float64(Float64(1.0 - cos(Float64(kx + kx))) - cos(Float64(abs(ky) + abs(ky)))) + 1.0) * 0.5))) t_2 = sin(abs(ky)) t_3 = Float64(t_2 / sqrt(Float64((sin(kx) ^ 2.0) + (t_2 ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.05) tmp = Float64(t_1 * t_2); elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_3 <= 0.9999999999999979) tmp = Float64(t_1 / Float64(1.0 / t_2)); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(th) / sqrt(((((1.0 - cos((kx + kx))) - cos((abs(ky) + abs(ky)))) + 1.0) * 0.5)); t_2 = sin(abs(ky)); t_3 = t_2 / sqrt(((sin(kx) ^ 2.0) + (t_2 ^ 2.0))); tmp = 0.0; if (t_3 <= -0.05) tmp = t_1 * t_2; elseif (t_3 <= 0.001) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_3 <= 0.9999999999999979) tmp = t_1 / (1.0 / t_2); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$2, 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.05], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9999999999999979], N[(t$95$1 / N[(1.0 / t$95$2), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\sin th}{\sqrt{\left(\left(\left(1 - \cos \left(kx + kx\right)\right) - \cos \left(\left|ky\right| + \left|ky\right|\right)\right) + 1\right) \cdot 0.5}}\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := \frac{t\_2}{\sqrt{{\sin kx}^{2} + {t\_2}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -0.05:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_3 \leq 0.9999999999999979:\\
\;\;\;\;\frac{t\_1}{\frac{1}{t\_2}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites75.3%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 1e-3 < (/.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.99999999999999789Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
mult-flipN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites75.2%
if 0.99999999999999789 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(sqrt
(*
(+
(- (- 1.0 (cos (+ kx kx))) (cos (+ (fabs ky) (fabs ky))))
1.0)
0.5)))
(t_2 (sin (fabs ky)))
(t_3 (/ t_2 (sqrt (+ (pow (sin kx) 2.0) (pow t_2 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 -0.05)
(* (/ (sin th) t_1) t_2)
(if (<= t_3 0.001)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_3 0.9999999999999979)
(* (/ 1.0 (* (/ 1.0 t_2) t_1)) (sin th))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sqrt(((((1.0 - cos((kx + kx))) - cos((fabs(ky) + fabs(ky)))) + 1.0) * 0.5));
double t_2 = sin(fabs(ky));
double t_3 = t_2 / sqrt((pow(sin(kx), 2.0) + pow(t_2, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = (sin(th) / t_1) * t_2;
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = (1.0 / ((1.0 / t_2) * t_1)) * sin(th);
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sqrt(((((1.0 - Math.cos((kx + kx))) - Math.cos((Math.abs(ky) + Math.abs(ky)))) + 1.0) * 0.5));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = t_2 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_2, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = (Math.sin(th) / t_1) * t_2;
} else if (t_3 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = (1.0 / ((1.0 / t_2) * t_1)) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sqrt(((((1.0 - math.cos((kx + kx))) - math.cos((math.fabs(ky) + math.fabs(ky)))) + 1.0) * 0.5)) t_2 = math.sin(math.fabs(ky)) t_3 = t_2 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_2, 2.0))) tmp = 0 if t_3 <= -0.05: tmp = (math.sin(th) / t_1) * t_2 elif t_3 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_3 <= 0.9999999999999979: tmp = (1.0 / ((1.0 / t_2) * t_1)) * math.sin(th) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sqrt(Float64(Float64(Float64(Float64(1.0 - cos(Float64(kx + kx))) - cos(Float64(abs(ky) + abs(ky)))) + 1.0) * 0.5)) t_2 = sin(abs(ky)) t_3 = Float64(t_2 / sqrt(Float64((sin(kx) ^ 2.0) + (t_2 ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.05) tmp = Float64(Float64(sin(th) / t_1) * t_2); elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_3 <= 0.9999999999999979) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 / t_2) * t_1)) * sin(th)); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sqrt(((((1.0 - cos((kx + kx))) - cos((abs(ky) + abs(ky)))) + 1.0) * 0.5)); t_2 = sin(abs(ky)); t_3 = t_2 / sqrt(((sin(kx) ^ 2.0) + (t_2 ^ 2.0))); tmp = 0.0; if (t_3 <= -0.05) tmp = (sin(th) / t_1) * t_2; elseif (t_3 <= 0.001) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_3 <= 0.9999999999999979) tmp = (1.0 / ((1.0 / t_2) * t_1)) * sin(th); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[(N[(N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$2, 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.05], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9999999999999979], N[(N[(1.0 / N[(N[(1.0 / t$95$2), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sqrt{\left(\left(\left(1 - \cos \left(kx + kx\right)\right) - \cos \left(\left|ky\right| + \left|ky\right|\right)\right) + 1\right) \cdot 0.5}\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := \frac{t\_2}{\sqrt{{\sin kx}^{2} + {t\_2}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -0.05:\\
\;\;\;\;\frac{\sin th}{t\_1} \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_3 \leq 0.9999999999999979:\\
\;\;\;\;\frac{1}{\frac{1}{t\_2} \cdot t\_1} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites75.3%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 1e-3 < (/.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.99999999999999789Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6475.2%
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
lift--.f64N/A
sub-negate-revN/A
distribute-rgt1-inN/A
lower-*.f64N/A
Applied rewrites75.2%
if 0.99999999999999789 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(sqrt
(*
(+
(- (- 1.0 (cos (+ kx kx))) (cos (+ (fabs ky) (fabs ky))))
1.0)
0.5)))
(t_2 (sin (fabs ky)))
(t_3 (/ t_2 (sqrt (+ (pow (sin kx) 2.0) (pow t_2 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 -0.05)
(* (/ (sin th) t_1) t_2)
(if (<= t_3 0.001)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_3 0.9999999999999979)
(/ (* (sin th) t_2) t_1)
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sqrt(((((1.0 - cos((kx + kx))) - cos((fabs(ky) + fabs(ky)))) + 1.0) * 0.5));
double t_2 = sin(fabs(ky));
double t_3 = t_2 / sqrt((pow(sin(kx), 2.0) + pow(t_2, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = (sin(th) / t_1) * t_2;
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = (sin(th) * t_2) / t_1;
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sqrt(((((1.0 - Math.cos((kx + kx))) - Math.cos((Math.abs(ky) + Math.abs(ky)))) + 1.0) * 0.5));
double t_2 = Math.sin(Math.abs(ky));
double t_3 = t_2 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_2, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = (Math.sin(th) / t_1) * t_2;
} else if (t_3 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = (Math.sin(th) * t_2) / t_1;
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sqrt(((((1.0 - math.cos((kx + kx))) - math.cos((math.fabs(ky) + math.fabs(ky)))) + 1.0) * 0.5)) t_2 = math.sin(math.fabs(ky)) t_3 = t_2 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_2, 2.0))) tmp = 0 if t_3 <= -0.05: tmp = (math.sin(th) / t_1) * t_2 elif t_3 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_3 <= 0.9999999999999979: tmp = (math.sin(th) * t_2) / t_1 else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sqrt(Float64(Float64(Float64(Float64(1.0 - cos(Float64(kx + kx))) - cos(Float64(abs(ky) + abs(ky)))) + 1.0) * 0.5)) t_2 = sin(abs(ky)) t_3 = Float64(t_2 / sqrt(Float64((sin(kx) ^ 2.0) + (t_2 ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.05) tmp = Float64(Float64(sin(th) / t_1) * t_2); elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_3 <= 0.9999999999999979) tmp = Float64(Float64(sin(th) * t_2) / t_1); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sqrt(((((1.0 - cos((kx + kx))) - cos((abs(ky) + abs(ky)))) + 1.0) * 0.5)); t_2 = sin(abs(ky)); t_3 = t_2 / sqrt(((sin(kx) ^ 2.0) + (t_2 ^ 2.0))); tmp = 0.0; if (t_3 <= -0.05) tmp = (sin(th) / t_1) * t_2; elseif (t_3 <= 0.001) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_3 <= 0.9999999999999979) tmp = (sin(th) * t_2) / t_1; else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sqrt[N[(N[(N[(N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$2, 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.05], N[(N[(N[Sin[th], $MachinePrecision] / t$95$1), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9999999999999979], N[(N[(N[Sin[th], $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$1), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sqrt{\left(\left(\left(1 - \cos \left(kx + kx\right)\right) - \cos \left(\left|ky\right| + \left|ky\right|\right)\right) + 1\right) \cdot 0.5}\\
t_2 := \sin \left(\left|ky\right|\right)\\
t_3 := \frac{t\_2}{\sqrt{{\sin kx}^{2} + {t\_2}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -0.05:\\
\;\;\;\;\frac{\sin th}{t\_1} \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_3 \leq 0.9999999999999979:\\
\;\;\;\;\frac{\sin th \cdot t\_2}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites75.3%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 1e-3 < (/.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.99999999999999789Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
associate-*l/N/A
lift-*.f64N/A
lower-/.f6475.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6475.2%
lift--.f64N/A
Applied rewrites75.2%
if 0.99999999999999789 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0)))))
(t_3 (- 1.0 (cos (+ kx kx))))
(t_4 (cos (+ (fabs ky) (fabs ky)))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.05)
(* (/ (sin th) (sqrt (* (+ (- t_3 t_4) 1.0) 0.5))) t_1)
(if (<= t_2 0.001)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_2 0.9999999999999979)
(* (/ t_1 (sqrt (- 0.5 (* (- t_4 t_3) 0.5)))) (sin th))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double t_3 = 1.0 - cos((kx + kx));
double t_4 = cos((fabs(ky) + fabs(ky)));
double tmp;
if (t_2 <= -0.05) {
tmp = (sin(th) / sqrt((((t_3 - t_4) + 1.0) * 0.5))) * t_1;
} else if (t_2 <= 0.001) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_2 <= 0.9999999999999979) {
tmp = (t_1 / sqrt((0.5 - ((t_4 - t_3) * 0.5)))) * sin(th);
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double t_3 = 1.0 - Math.cos((kx + kx));
double t_4 = Math.cos((Math.abs(ky) + Math.abs(ky)));
double tmp;
if (t_2 <= -0.05) {
tmp = (Math.sin(th) / Math.sqrt((((t_3 - t_4) + 1.0) * 0.5))) * t_1;
} else if (t_2 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_2 <= 0.9999999999999979) {
tmp = (t_1 / Math.sqrt((0.5 - ((t_4 - t_3) * 0.5)))) * Math.sin(th);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) t_3 = 1.0 - math.cos((kx + kx)) t_4 = math.cos((math.fabs(ky) + math.fabs(ky))) tmp = 0 if t_2 <= -0.05: tmp = (math.sin(th) / math.sqrt((((t_3 - t_4) + 1.0) * 0.5))) * t_1 elif t_2 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_2 <= 0.9999999999999979: tmp = (t_1 / math.sqrt((0.5 - ((t_4 - t_3) * 0.5)))) * math.sin(th) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) t_3 = Float64(1.0 - cos(Float64(kx + kx))) t_4 = cos(Float64(abs(ky) + abs(ky))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(Float64(sin(th) / sqrt(Float64(Float64(Float64(t_3 - t_4) + 1.0) * 0.5))) * t_1); elseif (t_2 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_2 <= 0.9999999999999979) tmp = Float64(Float64(t_1 / sqrt(Float64(0.5 - Float64(Float64(t_4 - t_3) * 0.5)))) * sin(th)); else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); t_3 = 1.0 - cos((kx + kx)); t_4 = cos((abs(ky) + abs(ky))); tmp = 0.0; if (t_2 <= -0.05) tmp = (sin(th) / sqrt((((t_3 - t_4) + 1.0) * 0.5))) * t_1; elseif (t_2 <= 0.001) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_2 <= 0.9999999999999979) tmp = (t_1 / sqrt((0.5 - ((t_4 - t_3) * 0.5)))) * sin(th); else tmp = 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[(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$3 = N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -0.05], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[(N[(N[(t$95$3 - t$95$4), $MachinePrecision] + 1.0), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.9999999999999979], N[(N[(t$95$1 / N[Sqrt[N[(0.5 - N[(N[(t$95$4 - t$95$3), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]), $MachinePrecision]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
t_3 := 1 - \cos \left(kx + kx\right)\\
t_4 := \cos \left(\left|ky\right| + \left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{\sin th}{\sqrt{\left(\left(t\_3 - t\_4\right) + 1\right) \cdot 0.5}} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_2 \leq 0.9999999999999979:\\
\;\;\;\;\frac{t\_1}{\sqrt{0.5 - \left(t\_4 - t\_3\right) \cdot 0.5}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites75.3%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 1e-3 < (/.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.99999999999999789Initial program 93.7%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lower-unsound-pow.f6493.6%
Applied rewrites93.6%
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-a-revN/A
count-2N/A
lift-+.f64N/A
lift-cos.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
distribute-rgt1-inN/A
+-commutativeN/A
sub-flipN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites75.4%
if 0.99999999999999789 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2
(*
(/
t_1
(sqrt
(-
0.5
(*
(- (cos (+ (fabs ky) (fabs ky))) (- 1.0 (cos (+ kx kx))))
0.5))))
(sin th)))
(t_3 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_3 -0.05)
t_2
(if (<= t_3 0.001)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_3 0.9999999999999979) t_2 (sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = (t_1 / sqrt((0.5 - ((cos((fabs(ky) + fabs(ky))) - (1.0 - cos((kx + kx)))) * 0.5)))) * sin(th);
double t_3 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = t_2;
} else if (t_3 <= 0.001) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = t_2;
} else {
tmp = 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 = (t_1 / Math.sqrt((0.5 - ((Math.cos((Math.abs(ky) + Math.abs(ky))) - (1.0 - Math.cos((kx + kx)))) * 0.5)))) * Math.sin(th);
double t_3 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_3 <= -0.05) {
tmp = t_2;
} else if (t_3 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_3 <= 0.9999999999999979) {
tmp = t_2;
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = (t_1 / math.sqrt((0.5 - ((math.cos((math.fabs(ky) + math.fabs(ky))) - (1.0 - math.cos((kx + kx)))) * 0.5)))) * math.sin(th) t_3 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_3 <= -0.05: tmp = t_2 elif t_3 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_3 <= 0.9999999999999979: tmp = t_2 else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(Float64(t_1 / sqrt(Float64(0.5 - Float64(Float64(cos(Float64(abs(ky) + abs(ky))) - Float64(1.0 - cos(Float64(kx + kx)))) * 0.5)))) * sin(th)) t_3 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_3 <= -0.05) tmp = t_2; elseif (t_3 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_3 <= 0.9999999999999979) tmp = t_2; else tmp = 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 / sqrt((0.5 - ((cos((abs(ky) + abs(ky))) - (1.0 - cos((kx + kx)))) * 0.5)))) * sin(th); t_3 = t_1 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_3 <= -0.05) tmp = t_2; elseif (t_3 <= 0.001) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_3 <= 0.9999999999999979) tmp = t_2; else tmp = 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[(N[(t$95$1 / N[Sqrt[N[(0.5 - N[(N[(N[Cos[N[(N[Abs[ky], $MachinePrecision] + N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[(1.0 - N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, -0.05], t$95$2, If[LessEqual[t$95$3, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 0.9999999999999979], t$95$2, N[Sin[th], $MachinePrecision]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{0.5 - \left(\cos \left(\left|ky\right| + \left|ky\right|\right) - \left(1 - \cos \left(kx + kx\right)\right)\right) \cdot 0.5}} \cdot \sin th\\
t_3 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_3 \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_3 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_3 \leq 0.9999999999999979:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003 or 1e-3 < (/.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.99999999999999789Initial program 93.7%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lower-unsound-pow.f6493.6%
Applied rewrites93.6%
lift-+.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
lift-pow.f64N/A
pow-divN/A
metadata-evalN/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-a-revN/A
count-2N/A
lift-+.f64N/A
lift-cos.f64N/A
*-commutativeN/A
fp-cancel-sub-sign-invN/A
distribute-rgt1-inN/A
+-commutativeN/A
sub-flipN/A
lift--.f64N/A
lift-*.f64N/A
Applied rewrites75.4%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 0.99999999999999789 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1.0 ky)
(if (<= (fabs ky) 1.6e-162)
(* (sin th) (/ (fabs ky) (fabs (sin kx))))
(if (<= (fabs ky) 5.8e-7)
(*
(/
t_1
(sqrt (+ (pow (/ 1.0 (sin kx)) -2.0) (pow (fabs ky) 2.0))))
(sin th))
(*
(/
t_1
(sqrt (+ (- 0.5 (* (cos (+ kx kx)) 0.5)) (pow t_1 2.0))))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 1.6e-162) {
tmp = sin(th) * (fabs(ky) / fabs(sin(kx)));
} else if (fabs(ky) <= 5.8e-7) {
tmp = (t_1 / sqrt((pow((1.0 / sin(kx)), -2.0) + pow(fabs(ky), 2.0)))) * sin(th);
} else {
tmp = (t_1 / sqrt(((0.5 - (cos((kx + kx)) * 0.5)) + pow(t_1, 2.0)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 1.6e-162) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(Math.sin(kx)));
} else if (Math.abs(ky) <= 5.8e-7) {
tmp = (t_1 / Math.sqrt((Math.pow((1.0 / Math.sin(kx)), -2.0) + Math.pow(Math.abs(ky), 2.0)))) * Math.sin(th);
} else {
tmp = (t_1 / Math.sqrt(((0.5 - (Math.cos((kx + kx)) * 0.5)) + Math.pow(t_1, 2.0)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 1.6e-162: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(math.sin(kx))) elif math.fabs(ky) <= 5.8e-7: tmp = (t_1 / math.sqrt((math.pow((1.0 / math.sin(kx)), -2.0) + math.pow(math.fabs(ky), 2.0)))) * math.sin(th) else: tmp = (t_1 / math.sqrt(((0.5 - (math.cos((kx + kx)) * 0.5)) + math.pow(t_1, 2.0)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 1.6e-162) tmp = Float64(sin(th) * Float64(abs(ky) / abs(sin(kx)))); elseif (abs(ky) <= 5.8e-7) tmp = Float64(Float64(t_1 / sqrt(Float64((Float64(1.0 / sin(kx)) ^ -2.0) + (abs(ky) ^ 2.0)))) * sin(th)); else tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(0.5 - Float64(cos(Float64(kx + kx)) * 0.5)) + (t_1 ^ 2.0)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 1.6e-162) tmp = sin(th) * (abs(ky) / abs(sin(kx))); elseif (abs(ky) <= 5.8e-7) tmp = (t_1 / sqrt((((1.0 / sin(kx)) ^ -2.0) + (abs(ky) ^ 2.0)))) * sin(th); else tmp = (t_1 / sqrt(((0.5 - (cos((kx + kx)) * 0.5)) + (t_1 ^ 2.0)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 1.6e-162], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 5.8e-7], N[(N[(t$95$1 / N[Sqrt[N[(N[Power[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision], -2.0], $MachinePrecision] + N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq 1.6 \cdot 10^{-162}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|\sin kx\right|}\\
\mathbf{elif}\;\left|ky\right| \leq 5.8 \cdot 10^{-7}:\\
\;\;\;\;\frac{t\_1}{\sqrt{{\left(\frac{1}{\sin kx}\right)}^{-2} + {\left(\left|ky\right|\right)}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right) + {t\_1}^{2}}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 1.5999999999999999e-162Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.4%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
if 1.5999999999999999e-162 < ky < 5.7999999999999995e-7Initial program 93.7%
lift-pow.f64N/A
metadata-evalN/A
pow-subN/A
lower-unsound-/.f64N/A
lower-unsound-pow.f64N/A
lower-unsound-pow.f6493.6%
Applied rewrites93.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow1N/A
mult-flipN/A
remove-double-divN/A
unpow-1N/A
lift-pow.f64N/A
inv-powN/A
inv-powN/A
pow-prod-upN/A
metadata-evalN/A
metadata-evalN/A
lower-pow.f64N/A
lift-pow.f64N/A
unpow-1N/A
lower-/.f64N/A
metadata-eval93.6%
Applied rewrites93.6%
Taylor expanded in ky around 0
lower-pow.f6447.0%
Applied rewrites47.0%
if 5.7999999999999995e-7 < ky Initial program 93.7%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
count-2-revN/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f6484.7%
Applied rewrites84.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1.0 ky)
(if (<= (fabs ky) 1.6e-162)
(* (sin th) (/ (fabs ky) (fabs (sin kx))))
(if (<= (fabs ky) 5e-41)
(*
(/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow (fabs ky) 2.0))))
(sin th))
(*
(/
t_1
(sqrt (+ (- 0.5 (* (cos (+ kx kx)) 0.5)) (pow t_1 2.0))))
(sin th)))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if (fabs(ky) <= 1.6e-162) {
tmp = sin(th) * (fabs(ky) / fabs(sin(kx)));
} else if (fabs(ky) <= 5e-41) {
tmp = (t_1 / sqrt((pow(sin(kx), 2.0) + pow(fabs(ky), 2.0)))) * sin(th);
} else {
tmp = (t_1 / sqrt(((0.5 - (cos((kx + kx)) * 0.5)) + pow(t_1, 2.0)))) * sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if (Math.abs(ky) <= 1.6e-162) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(Math.sin(kx)));
} else if (Math.abs(ky) <= 5e-41) {
tmp = (t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.abs(ky), 2.0)))) * Math.sin(th);
} else {
tmp = (t_1 / Math.sqrt(((0.5 - (Math.cos((kx + kx)) * 0.5)) + Math.pow(t_1, 2.0)))) * Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if math.fabs(ky) <= 1.6e-162: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(math.sin(kx))) elif math.fabs(ky) <= 5e-41: tmp = (t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.fabs(ky), 2.0)))) * math.sin(th) else: tmp = (t_1 / math.sqrt(((0.5 - (math.cos((kx + kx)) * 0.5)) + math.pow(t_1, 2.0)))) * math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (abs(ky) <= 1.6e-162) tmp = Float64(sin(th) * Float64(abs(ky) / abs(sin(kx)))); elseif (abs(ky) <= 5e-41) tmp = Float64(Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (abs(ky) ^ 2.0)))) * sin(th)); else tmp = Float64(Float64(t_1 / sqrt(Float64(Float64(0.5 - Float64(cos(Float64(kx + kx)) * 0.5)) + (t_1 ^ 2.0)))) * sin(th)); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if (abs(ky) <= 1.6e-162) tmp = sin(th) * (abs(ky) / abs(sin(kx))); elseif (abs(ky) <= 5e-41) tmp = (t_1 / sqrt(((sin(kx) ^ 2.0) + (abs(ky) ^ 2.0)))) * sin(th); else tmp = (t_1 / sqrt(((0.5 - (cos((kx + kx)) * 0.5)) + (t_1 ^ 2.0)))) * sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[ky], $MachinePrecision], 1.6e-162], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[ky], $MachinePrecision], 5e-41], N[(N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Abs[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|ky\right| \leq 1.6 \cdot 10^{-162}:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|\sin kx\right|}\\
\mathbf{elif}\;\left|ky\right| \leq 5 \cdot 10^{-41}:\\
\;\;\;\;\frac{t\_1}{\sqrt{{\sin kx}^{2} + {\left(\left|ky\right|\right)}^{2}}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\sqrt{\left(0.5 - \cos \left(kx + kx\right) \cdot 0.5\right) + {t\_1}^{2}}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 1.5999999999999999e-162Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.4%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
if 1.5999999999999999e-162 < ky < 4.9999999999999996e-41Initial program 93.7%
Taylor expanded in ky around 0
lower-pow.f6447.1%
Applied rewrites47.1%
if 4.9999999999999996e-41 < ky Initial program 93.7%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
count-2-revN/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f6484.7%
Applied rewrites84.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (* th t_1))
(t_3 (pow t_1 2.0))
(t_4 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) t_3))))
(t_5 (cos (* 2.0 kx))))
(*
(copysign 1.0 ky)
(if (<= t_4 -0.85)
(* (sin th) (copysign 1.0 t_1))
(if (<= t_4 -0.05)
(/ t_2 (sqrt (- (+ 0.5 t_3) (* 0.5 t_5))))
(if (<= t_4 0.1)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_4 0.995)
(/
t_2
(sqrt
(- 0.5 (* 0.5 (- (+ t_5 (cos (* 2.0 (fabs ky)))) 1.0)))))
(sin th))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = th * t_1;
double t_3 = pow(t_1, 2.0);
double t_4 = t_1 / sqrt((pow(sin(kx), 2.0) + t_3));
double t_5 = cos((2.0 * kx));
double tmp;
if (t_4 <= -0.85) {
tmp = sin(th) * copysign(1.0, t_1);
} else if (t_4 <= -0.05) {
tmp = t_2 / sqrt(((0.5 + t_3) - (0.5 * t_5)));
} else if (t_4 <= 0.1) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_4 <= 0.995) {
tmp = t_2 / sqrt((0.5 - (0.5 * ((t_5 + cos((2.0 * fabs(ky)))) - 1.0))));
} else {
tmp = 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 = th * t_1;
double t_3 = Math.pow(t_1, 2.0);
double t_4 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + t_3));
double t_5 = Math.cos((2.0 * kx));
double tmp;
if (t_4 <= -0.85) {
tmp = Math.sin(th) * Math.copySign(1.0, t_1);
} else if (t_4 <= -0.05) {
tmp = t_2 / Math.sqrt(((0.5 + t_3) - (0.5 * t_5)));
} else if (t_4 <= 0.1) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_4 <= 0.995) {
tmp = t_2 / Math.sqrt((0.5 - (0.5 * ((t_5 + Math.cos((2.0 * Math.abs(ky)))) - 1.0))));
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = th * t_1 t_3 = math.pow(t_1, 2.0) t_4 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + t_3)) t_5 = math.cos((2.0 * kx)) tmp = 0 if t_4 <= -0.85: tmp = math.sin(th) * math.copysign(1.0, t_1) elif t_4 <= -0.05: tmp = t_2 / math.sqrt(((0.5 + t_3) - (0.5 * t_5))) elif t_4 <= 0.1: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_4 <= 0.995: tmp = t_2 / math.sqrt((0.5 - (0.5 * ((t_5 + math.cos((2.0 * math.fabs(ky)))) - 1.0)))) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(th * t_1) t_3 = t_1 ^ 2.0 t_4 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + t_3))) t_5 = cos(Float64(2.0 * kx)) tmp = 0.0 if (t_4 <= -0.85) tmp = Float64(sin(th) * copysign(1.0, t_1)); elseif (t_4 <= -0.05) tmp = Float64(t_2 / sqrt(Float64(Float64(0.5 + t_3) - Float64(0.5 * t_5)))); elseif (t_4 <= 0.1) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_4 <= 0.995) tmp = Float64(t_2 / sqrt(Float64(0.5 - Float64(0.5 * Float64(Float64(t_5 + cos(Float64(2.0 * abs(ky)))) - 1.0))))); else tmp = 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 = th * t_1; t_3 = t_1 ^ 2.0; t_4 = t_1 / sqrt(((sin(kx) ^ 2.0) + t_3)); t_5 = cos((2.0 * kx)); tmp = 0.0; if (t_4 <= -0.85) tmp = sin(th) * (sign(t_1) * abs(1.0)); elseif (t_4 <= -0.05) tmp = t_2 / sqrt(((0.5 + t_3) - (0.5 * t_5))); elseif (t_4 <= 0.1) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_4 <= 0.995) tmp = t_2 / sqrt((0.5 - (0.5 * ((t_5 + cos((2.0 * abs(ky)))) - 1.0)))); else tmp = 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[(th * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$1, 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Cos[N[(2.0 * 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.85], N[(N[Sin[th], $MachinePrecision] * N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t$95$1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -0.05], N[(t$95$2 / N[Sqrt[N[(N[(0.5 + t$95$3), $MachinePrecision] - N[(0.5 * t$95$5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.995], N[(t$95$2 / N[Sqrt[N[(0.5 - N[(0.5 * N[(N[(t$95$5 + N[Cos[N[(2.0 * N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]]), $MachinePrecision]]]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := th \cdot t\_1\\
t_3 := {t\_1}^{2}\\
t_4 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + t\_3}}\\
t_5 := \cos \left(2 \cdot kx\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_4 \leq -0.85:\\
\;\;\;\;\sin th \cdot \mathsf{copysign}\left(1, t\_1\right)\\
\mathbf{elif}\;t\_4 \leq -0.05:\\
\;\;\;\;\frac{t\_2}{\sqrt{\left(0.5 + t\_3\right) - 0.5 \cdot t\_5}}\\
\mathbf{elif}\;t\_4 \leq 0.1:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_4 \leq 0.995:\\
\;\;\;\;\frac{t\_2}{\sqrt{0.5 - 0.5 \cdot \left(\left(t\_5 + \cos \left(2 \cdot \left|ky\right|\right)\right) - 1\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.84999999999999998Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
fabs-rhs-divN/A
lower-copysign.f6444.4%
Applied rewrites44.4%
if -0.84999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
lift-pow.f64N/A
unpow2N/A
lift-sin.f64N/A
lift-sin.f64N/A
sqr-sin-aN/A
lower--.f64N/A
count-2-revN/A
*-commutativeN/A
lower-*.f64N/A
lower-cos.f64N/A
lower-+.f6484.7%
Applied rewrites84.7%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-pow.f64N/A
lower-sin.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8%
Applied rewrites38.8%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.995Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8%
Applied rewrites38.8%
if 0.995 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0)))))
(t_3
(/
(* th t_1)
(sqrt
(-
0.5
(*
0.5
(- (+ (cos (* 2.0 kx)) (cos (* 2.0 (fabs ky)))) 1.0)))))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.85)
(* (sin th) (copysign 1.0 t_1))
(if (<= t_2 -0.05)
t_3
(if (<= t_2 0.1)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(if (<= t_2 0.995) t_3 (sin th))))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double t_3 = (th * t_1) / sqrt((0.5 - (0.5 * ((cos((2.0 * kx)) + cos((2.0 * fabs(ky)))) - 1.0))));
double tmp;
if (t_2 <= -0.85) {
tmp = sin(th) * copysign(1.0, t_1);
} else if (t_2 <= -0.05) {
tmp = t_3;
} else if (t_2 <= 0.1) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else if (t_2 <= 0.995) {
tmp = t_3;
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double t_3 = (th * t_1) / Math.sqrt((0.5 - (0.5 * ((Math.cos((2.0 * kx)) + Math.cos((2.0 * Math.abs(ky)))) - 1.0))));
double tmp;
if (t_2 <= -0.85) {
tmp = Math.sin(th) * Math.copySign(1.0, t_1);
} else if (t_2 <= -0.05) {
tmp = t_3;
} else if (t_2 <= 0.1) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else if (t_2 <= 0.995) {
tmp = t_3;
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) t_3 = (th * t_1) / math.sqrt((0.5 - (0.5 * ((math.cos((2.0 * kx)) + math.cos((2.0 * math.fabs(ky)))) - 1.0)))) tmp = 0 if t_2 <= -0.85: tmp = math.sin(th) * math.copysign(1.0, t_1) elif t_2 <= -0.05: tmp = t_3 elif t_2 <= 0.1: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) elif t_2 <= 0.995: tmp = t_3 else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) t_3 = Float64(Float64(th * t_1) / sqrt(Float64(0.5 - Float64(0.5 * Float64(Float64(cos(Float64(2.0 * kx)) + cos(Float64(2.0 * abs(ky)))) - 1.0))))) tmp = 0.0 if (t_2 <= -0.85) tmp = Float64(sin(th) * copysign(1.0, t_1)); elseif (t_2 <= -0.05) tmp = t_3; elseif (t_2 <= 0.1) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); elseif (t_2 <= 0.995) tmp = t_3; else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); t_3 = (th * t_1) / sqrt((0.5 - (0.5 * ((cos((2.0 * kx)) + cos((2.0 * abs(ky)))) - 1.0)))); tmp = 0.0; if (t_2 <= -0.85) tmp = sin(th) * (sign(t_1) * abs(1.0)); elseif (t_2 <= -0.05) tmp = t_3; elseif (t_2 <= 0.1) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); elseif (t_2 <= 0.995) tmp = t_3; else tmp = 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[(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$3 = N[(N[(th * t$95$1), $MachinePrecision] / N[Sqrt[N[(0.5 - N[(0.5 * N[(N[(N[Cos[N[(2.0 * kx), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(2.0 * N[Abs[ky], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 1.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$2, -0.85], N[(N[Sin[th], $MachinePrecision] * N[With[{TMP1 = Abs[1.0], TMP2 = Sign[t$95$1]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -0.05], t$95$3, If[LessEqual[t$95$2, 0.1], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.995], t$95$3, N[Sin[th], $MachinePrecision]]]]]), $MachinePrecision]]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
t_3 := \frac{th \cdot t\_1}{\sqrt{0.5 - 0.5 \cdot \left(\left(\cos \left(2 \cdot kx\right) + \cos \left(2 \cdot \left|ky\right|\right)\right) - 1\right)}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.85:\\
\;\;\;\;\sin th \cdot \mathsf{copysign}\left(1, t\_1\right)\\
\mathbf{elif}\;t\_2 \leq -0.05:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 0.1:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{elif}\;t\_2 \leq 0.995:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.84999999999999998Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
fabs-rhs-divN/A
lower-copysign.f6444.4%
Applied rewrites44.4%
if -0.84999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003 or 0.10000000000000001 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.995Initial program 93.7%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6493.6%
Applied rewrites75.3%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6475.3%
Applied rewrites75.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower--.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-cos.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6438.8%
Applied rewrites38.8%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 0.10000000000000001Initial program 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 0.995 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1
(/
(sin ky)
(sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))))
(if (<= t_1 -0.05)
(* (sin th) (copysign 1.0 (sin ky)))
(if (<= t_1 0.001)
(* (sin th) (* ky (fabs (/ 1.0 (sin kx)))))
(sin th)))))double code(double kx, double ky, double th) {
double t_1 = sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = sin(th) * copysign(1.0, sin(ky));
} else if (t_1 <= 0.001) {
tmp = sin(th) * (ky * fabs((1.0 / sin(kx))));
} else {
tmp = sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)));
double tmp;
if (t_1 <= -0.05) {
tmp = Math.sin(th) * Math.copySign(1.0, Math.sin(ky));
} else if (t_1 <= 0.001) {
tmp = Math.sin(th) * (ky * Math.abs((1.0 / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): t_1 = math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0))) tmp = 0 if t_1 <= -0.05: tmp = math.sin(th) * math.copysign(1.0, math.sin(ky)) elif t_1 <= 0.001: tmp = math.sin(th) * (ky * math.fabs((1.0 / math.sin(kx)))) else: tmp = math.sin(th) return tmp
function code(kx, ky, th) t_1 = Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) tmp = 0.0 if (t_1 <= -0.05) tmp = Float64(sin(th) * copysign(1.0, sin(ky))); elseif (t_1 <= 0.001) tmp = Float64(sin(th) * Float64(ky * abs(Float64(1.0 / sin(kx))))); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) t_1 = sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0))); tmp = 0.0; if (t_1 <= -0.05) tmp = sin(th) * (sign(sin(ky)) * abs(1.0)); elseif (t_1 <= 0.001) tmp = sin(th) * (ky * abs((1.0 / sin(kx)))); else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], N[(N[Sin[th], $MachinePrecision] * N[With[{TMP1 = Abs[1.0], TMP2 = Sign[N[Sin[ky], $MachinePrecision]]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(ky * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]]
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;\sin th \cdot \mathsf{copysign}\left(1, \sin ky\right)\\
\mathbf{elif}\;t\_1 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(ky \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
fabs-rhs-divN/A
lower-copysign.f6444.4%
Applied rewrites44.4%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.05)
(* (/ th (fabs t_1)) t_1)
(if (<= t_2 0.001)
(* (sin th) (* (fabs ky) (fabs (/ 1.0 (sin kx)))))
(sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / fabs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = sin(th) * (fabs(ky) * fabs((1.0 / sin(kx))));
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / Math.abs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) * Math.abs((1.0 / Math.sin(kx))));
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_2 <= -0.05: tmp = (th / math.fabs(t_1)) * t_1 elif t_2 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) * math.fabs((1.0 / math.sin(kx)))) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(Float64(th / abs(t_1)) * t_1); elseif (t_2 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) * abs(Float64(1.0 / sin(kx))))); else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_2 <= -0.05) tmp = (th / abs(t_1)) * t_1; elseif (t_2 <= 0.001) tmp = sin(th) * (abs(ky) * abs((1.0 / sin(kx)))); else tmp = 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[(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]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -0.05], N[(N[(th / N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] * N[Abs[N[(1.0 / N[Sin[kx], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{th}{\left|t\_1\right|} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0.001:\\
\;\;\;\;\sin th \cdot \left(\left|ky\right| \cdot \left|\frac{1}{\sin kx}\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.6%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6444.3%
Applied rewrites44.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6423.7%
Applied rewrites23.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
mult-flipN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
metadata-evalN/A
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
div-fabsN/A
unpow-1N/A
lift-pow.f64N/A
lower-fabs.f6439.5%
lift-pow.f64N/A
unpow-1N/A
lower-/.f6439.5%
Applied rewrites39.5%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.05)
(* (/ th (fabs t_1)) t_1)
(if (<= t_2 0.001)
(* (/ (sin th) (fabs (sin kx))) (fabs ky))
(sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / fabs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = (sin(th) / fabs(sin(kx))) * fabs(ky);
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / Math.abs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = (Math.sin(th) / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_2 <= -0.05: tmp = (th / math.fabs(t_1)) * t_1 elif t_2 <= 0.001: tmp = (math.sin(th) / math.fabs(math.sin(kx))) * math.fabs(ky) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(Float64(th / abs(t_1)) * t_1); elseif (t_2 <= 0.001) tmp = Float64(Float64(sin(th) / abs(sin(kx))) * abs(ky)); else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_2 <= -0.05) tmp = (th / abs(t_1)) * t_1; elseif (t_2 <= 0.001) tmp = (sin(th) / abs(sin(kx))) * abs(ky); else tmp = 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[(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]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -0.05], N[(N[(th / N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.001], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{th}{\left|t\_1\right|} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0.001:\\
\;\;\;\;\frac{\sin th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.6%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6444.3%
Applied rewrites44.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6423.7%
Applied rewrites23.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.5%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.05)
(* (/ th (fabs t_1)) t_1)
(if (<= t_2 0.001)
(* (sin th) (/ (fabs ky) (fabs (sin kx))))
(sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / fabs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = sin(th) * (fabs(ky) / fabs(sin(kx)));
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / Math.abs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(Math.sin(kx)));
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_2 <= -0.05: tmp = (th / math.fabs(t_1)) * t_1 elif t_2 <= 0.001: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(math.sin(kx))) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(Float64(th / abs(t_1)) * t_1); elseif (t_2 <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) / abs(sin(kx)))); else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_2 <= -0.05) tmp = (th / abs(t_1)) * t_1; elseif (t_2 <= 0.001) tmp = sin(th) * (abs(ky) / abs(sin(kx))); else tmp = 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[(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]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -0.05], N[(N[(th / N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{th}{\left|t\_1\right|} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|\sin kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.6%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6444.3%
Applied rewrites44.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6423.7%
Applied rewrites23.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6436.4%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.05)
(* (/ th (fabs t_1)) t_1)
(if (<= t_2 0.001)
(* (/ th (fabs (sin kx))) (fabs ky))
(sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / fabs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = (th / fabs(sin(kx))) * fabs(ky);
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th / Math.abs(t_1)) * t_1;
} else if (t_2 <= 0.001) {
tmp = (th / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_2 <= -0.05: tmp = (th / math.fabs(t_1)) * t_1 elif t_2 <= 0.001: tmp = (th / math.fabs(math.sin(kx))) * math.fabs(ky) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(Float64(th / abs(t_1)) * t_1); elseif (t_2 <= 0.001) tmp = Float64(Float64(th / abs(sin(kx))) * abs(ky)); else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_2 <= -0.05) tmp = (th / abs(t_1)) * t_1; elseif (t_2 <= 0.001) tmp = (th / abs(sin(kx))) * abs(ky); else tmp = 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[(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]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -0.05], N[(N[(th / N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 0.001], N[(N[(th / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{th}{\left|t\_1\right|} \cdot t\_1\\
\mathbf{elif}\;t\_2 \leq 0.001:\\
\;\;\;\;\frac{th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.6%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6444.3%
Applied rewrites44.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6423.7%
Applied rewrites23.7%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.5%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6421.4%
Applied rewrites21.4%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky)))
(t_2 (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0))))))
(*
(copysign 1.0 ky)
(if (<= t_2 -0.05)
(/ (* th t_1) (fabs t_1))
(if (<= t_2 0.001)
(* (/ th (fabs (sin kx))) (fabs ky))
(sin th))))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double t_2 = t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th * t_1) / fabs(t_1);
} else if (t_2 <= 0.001) {
tmp = (th / fabs(sin(kx))) * fabs(ky);
} else {
tmp = 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 = t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)));
double tmp;
if (t_2 <= -0.05) {
tmp = (th * t_1) / Math.abs(t_1);
} else if (t_2 <= 0.001) {
tmp = (th / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) t_2 = t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0))) tmp = 0 if t_2 <= -0.05: tmp = (th * t_1) / math.fabs(t_1) elif t_2 <= 0.001: tmp = (th / math.fabs(math.sin(kx))) * math.fabs(ky) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) t_2 = Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) tmp = 0.0 if (t_2 <= -0.05) tmp = Float64(Float64(th * t_1) / abs(t_1)); elseif (t_2 <= 0.001) tmp = Float64(Float64(th / abs(sin(kx))) * abs(ky)); else tmp = 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 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_2 <= -0.05) tmp = (th * t_1) / abs(t_1); elseif (t_2 <= 0.001) tmp = (th / abs(sin(kx))) * abs(ky); else tmp = 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[(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]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$2, -0.05], N[(N[(th * t$95$1), $MachinePrecision] / N[Abs[t$95$1], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.001], N[(N[(th / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
t_2 := \frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}}\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;t\_2 \leq -0.05:\\
\;\;\;\;\frac{th \cdot t\_1}{\left|t\_1\right|}\\
\mathbf{elif}\;t\_2 \leq 0.001:\\
\;\;\;\;\frac{th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < -0.050000000000000003Initial program 93.7%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6440.6%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6444.3%
Applied rewrites44.3%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-fabs.f64N/A
lower-sin.f6429.2%
Applied rewrites29.2%
if -0.050000000000000003 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.5%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6421.4%
Applied rewrites21.4%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1.0 ky)
(if (<= (/ t_1 (sqrt (+ (pow (sin kx) 2.0) (pow t_1 2.0)))) 0.001)
(* (/ th (fabs (sin kx))) (fabs ky))
(sin th)))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if ((t_1 / sqrt((pow(sin(kx), 2.0) + pow(t_1, 2.0)))) <= 0.001) {
tmp = (th / fabs(sin(kx))) * fabs(ky);
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if ((t_1 / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(t_1, 2.0)))) <= 0.001) {
tmp = (th / Math.abs(Math.sin(kx))) * Math.abs(ky);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if (t_1 / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(t_1, 2.0)))) <= 0.001: tmp = (th / math.fabs(math.sin(kx))) * math.fabs(ky) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (Float64(t_1 / sqrt(Float64((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) <= 0.001) tmp = Float64(Float64(th / abs(sin(kx))) * abs(ky)); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if ((t_1 / sqrt(((sin(kx) ^ 2.0) + (t_1 ^ 2.0)))) <= 0.001) tmp = (th / abs(sin(kx))) * abs(ky); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[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], 0.001], N[(N[(th / N[Abs[N[Sin[kx], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_1}{\sqrt{{\sin kx}^{2} + {t\_1}^{2}}} \leq 0.001:\\
\;\;\;\;\frac{th}{\left|\sin kx\right|} \cdot \left|ky\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.5%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
Taylor expanded in th around 0
lower-/.f64N/A
lower-fabs.f64N/A
lower-sin.f6421.4%
Applied rewrites21.4%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(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 5e-73)
(* (/ (sin th) (fabs kx)) (fabs ky))
(if (<= t_3 5e-5) (/ (* (fabs ky) th) (fabs t_2)) (sin th))))))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 <= 5e-73) {
tmp = (sin(th) / fabs(kx)) * fabs(ky);
} else if (t_3 <= 5e-5) {
tmp = (fabs(ky) * th) / fabs(t_2);
} else {
tmp = 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.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 <= 5e-73) {
tmp = (Math.sin(th) / Math.abs(kx)) * Math.abs(ky);
} else if (t_3 <= 5e-5) {
tmp = (Math.abs(ky) * th) / Math.abs(t_2);
} else {
tmp = 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.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 <= 5e-73: tmp = (math.sin(th) / math.fabs(kx)) * math.fabs(ky) elif t_3 <= 5e-5: tmp = (math.fabs(ky) * th) / math.fabs(t_2) else: tmp = math.sin(th) 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 <= 5e-73) tmp = Float64(Float64(sin(th) / abs(kx)) * abs(ky)); elseif (t_3 <= 5e-5) tmp = Float64(Float64(abs(ky) * th) / abs(t_2)); else tmp = 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 = sin(abs(kx)); t_3 = t_1 / sqrt(((t_2 ^ 2.0) + (t_1 ^ 2.0))); tmp = 0.0; if (t_3 <= 5e-73) tmp = (sin(th) / abs(kx)) * abs(ky); elseif (t_3 <= 5e-5) tmp = (abs(ky) * th) / abs(t_2); else tmp = 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[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, 5e-73], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 5e-5], N[(N[(N[Abs[ky], $MachinePrecision] * th), $MachinePrecision] / N[Abs[t$95$2], $MachinePrecision]), $MachinePrecision], N[Sin[th], $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 5 \cdot 10^{-73}:\\
\;\;\;\;\frac{\sin th}{\left|kx\right|} \cdot \left|ky\right|\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\left|ky\right| \cdot th}{\left|t\_2\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 4.9999999999999998e-73Initial 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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.5%
Applied rewrites16.5%
if 4.9999999999999998e-73 < (/.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))))) < 5.0000000000000002e-5Initial 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.6%
Applied rewrites35.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6436.5%
lift-sqrt.f64N/A
lift-pow.f64N/A
unpow2N/A
rem-sqrt-squareN/A
lower-fabs.f6439.6%
Applied rewrites39.6%
Taylor expanded in th around 0
lower-/.f64N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-sin.f6419.8%
Applied rewrites19.8%
if 5.0000000000000002e-5 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1.0 ky)
(if (<=
(/ t_1 (sqrt (+ (pow (sin (fabs kx)) 2.0) (pow t_1 2.0))))
0.001)
(* (/ (sin th) (fabs kx)) (fabs ky))
(sin th)))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if ((t_1 / sqrt((pow(sin(fabs(kx)), 2.0) + pow(t_1, 2.0)))) <= 0.001) {
tmp = (sin(th) / fabs(kx)) * fabs(ky);
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if ((t_1 / Math.sqrt((Math.pow(Math.sin(Math.abs(kx)), 2.0) + Math.pow(t_1, 2.0)))) <= 0.001) {
tmp = (Math.sin(th) / Math.abs(kx)) * Math.abs(ky);
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if (t_1 / math.sqrt((math.pow(math.sin(math.fabs(kx)), 2.0) + math.pow(t_1, 2.0)))) <= 0.001: tmp = (math.sin(th) / math.fabs(kx)) * math.fabs(ky) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (Float64(t_1 / sqrt(Float64((sin(abs(kx)) ^ 2.0) + (t_1 ^ 2.0)))) <= 0.001) tmp = Float64(Float64(sin(th) / abs(kx)) * abs(ky)); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if ((t_1 / sqrt(((sin(abs(kx)) ^ 2.0) + (t_1 ^ 2.0)))) <= 0.001) tmp = (sin(th) / abs(kx)) * abs(ky); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.001], N[(N[(N[Sin[th], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision] * N[Abs[ky], $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_1}{\sqrt{{\sin \left(\left|kx\right|\right)}^{2} + {t\_1}^{2}}} \leq 0.001:\\
\;\;\;\;\frac{\sin th}{\left|kx\right|} \cdot \left|ky\right|\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6416.5%
Applied rewrites16.5%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1.0 ky)
(if (<=
(/ t_1 (sqrt (+ (pow (sin (fabs kx)) 2.0) (pow t_1 2.0))))
0.001)
(* (sin th) (/ (fabs ky) (fabs kx)))
(sin th)))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if ((t_1 / sqrt((pow(sin(fabs(kx)), 2.0) + pow(t_1, 2.0)))) <= 0.001) {
tmp = sin(th) * (fabs(ky) / fabs(kx));
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if ((t_1 / Math.sqrt((Math.pow(Math.sin(Math.abs(kx)), 2.0) + Math.pow(t_1, 2.0)))) <= 0.001) {
tmp = Math.sin(th) * (Math.abs(ky) / Math.abs(kx));
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if (t_1 / math.sqrt((math.pow(math.sin(math.fabs(kx)), 2.0) + math.pow(t_1, 2.0)))) <= 0.001: tmp = math.sin(th) * (math.fabs(ky) / math.fabs(kx)) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (Float64(t_1 / sqrt(Float64((sin(abs(kx)) ^ 2.0) + (t_1 ^ 2.0)))) <= 0.001) tmp = Float64(sin(th) * Float64(abs(ky) / abs(kx))); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if ((t_1 / sqrt(((sin(abs(kx)) ^ 2.0) + (t_1 ^ 2.0)))) <= 0.001) tmp = sin(th) * (abs(ky) / abs(kx)); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.001], N[(N[Sin[th], $MachinePrecision] * N[(N[Abs[ky], $MachinePrecision] / N[Abs[kx], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_1}{\sqrt{{\sin \left(\left|kx\right|\right)}^{2} + {t\_1}^{2}}} \leq 0.001:\\
\;\;\;\;\sin th \cdot \frac{\left|ky\right|}{\left|kx\right|}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1e-3Initial 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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6416.5%
Applied rewrites16.5%
if 1e-3 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (sin (fabs ky))))
(*
(copysign 1.0 ky)
(if (<=
(/ t_1 (sqrt (+ (pow (sin (fabs kx)) 2.0) (pow t_1 2.0))))
5e-5)
(/ 1.0 (/ (fabs kx) (* th (fabs ky))))
(sin th)))))double code(double kx, double ky, double th) {
double t_1 = sin(fabs(ky));
double tmp;
if ((t_1 / sqrt((pow(sin(fabs(kx)), 2.0) + pow(t_1, 2.0)))) <= 5e-5) {
tmp = 1.0 / (fabs(kx) / (th * fabs(ky)));
} else {
tmp = sin(th);
}
return copysign(1.0, ky) * tmp;
}
public static double code(double kx, double ky, double th) {
double t_1 = Math.sin(Math.abs(ky));
double tmp;
if ((t_1 / Math.sqrt((Math.pow(Math.sin(Math.abs(kx)), 2.0) + Math.pow(t_1, 2.0)))) <= 5e-5) {
tmp = 1.0 / (Math.abs(kx) / (th * Math.abs(ky)));
} else {
tmp = Math.sin(th);
}
return Math.copySign(1.0, ky) * tmp;
}
def code(kx, ky, th): t_1 = math.sin(math.fabs(ky)) tmp = 0 if (t_1 / math.sqrt((math.pow(math.sin(math.fabs(kx)), 2.0) + math.pow(t_1, 2.0)))) <= 5e-5: tmp = 1.0 / (math.fabs(kx) / (th * math.fabs(ky))) else: tmp = math.sin(th) return math.copysign(1.0, ky) * tmp
function code(kx, ky, th) t_1 = sin(abs(ky)) tmp = 0.0 if (Float64(t_1 / sqrt(Float64((sin(abs(kx)) ^ 2.0) + (t_1 ^ 2.0)))) <= 5e-5) tmp = Float64(1.0 / Float64(abs(kx) / Float64(th * abs(ky)))); else tmp = sin(th); end return Float64(copysign(1.0, ky) * tmp) end
function tmp_2 = code(kx, ky, th) t_1 = sin(abs(ky)); tmp = 0.0; if ((t_1 / sqrt(((sin(abs(kx)) ^ 2.0) + (t_1 ^ 2.0)))) <= 5e-5) tmp = 1.0 / (abs(kx) / (th * abs(ky))); else tmp = sin(th); end tmp_2 = (sign(ky) * abs(1.0)) * tmp; end
code[kx_, ky_, th_] := Block[{t$95$1 = N[Sin[N[Abs[ky], $MachinePrecision]], $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[ky]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(t$95$1 / N[Sqrt[N[(N[Power[N[Sin[N[Abs[kx], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-5], N[(1.0 / N[(N[Abs[kx], $MachinePrecision] / N[(th * N[Abs[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
t_1 := \sin \left(\left|ky\right|\right)\\
\mathsf{copysign}\left(1, ky\right) \cdot \begin{array}{l}
\mathbf{if}\;\frac{t\_1}{\sqrt{{\sin \left(\left|kx\right|\right)}^{2} + {t\_1}^{2}}} \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\frac{1}{\frac{\left|kx\right|}{th \cdot \left|ky\right|}}\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000002e-5Initial 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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
Taylor expanded in th around 0
lower-*.f6412.8%
Applied rewrites12.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6412.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.8%
Applied rewrites12.8%
if 5.0000000000000002e-5 < (/.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 kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
lower-sin.f64N/A
lower-sqrt.f64N/A
lower-pow.f64N/A
lower-sin.f6441.0%
Applied rewrites41.0%
Taylor expanded in ky around 0
lower-sin.f6423.7%
Applied rewrites23.7%
(FPCore (kx ky th) :precision binary64 (/ 1.0 (/ (fabs kx) (* th ky))))
double code(double kx, double ky, double th) {
return 1.0 / (fabs(kx) / (th * 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 = 1.0d0 / (abs(kx) / (th * ky))
end function
public static double code(double kx, double ky, double th) {
return 1.0 / (Math.abs(kx) / (th * ky));
}
def code(kx, ky, th): return 1.0 / (math.fabs(kx) / (th * ky))
function code(kx, ky, th) return Float64(1.0 / Float64(abs(kx) / Float64(th * ky))) end
function tmp = code(kx, ky, th) tmp = 1.0 / (abs(kx) / (th * ky)); end
code[kx_, ky_, th_] := N[(1.0 / N[(N[Abs[kx], $MachinePrecision] / N[(th * ky), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{1}{\frac{\left|kx\right|}{th \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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
Taylor expanded in th around 0
lower-*.f6412.8%
Applied rewrites12.8%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6412.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.8%
Applied rewrites12.8%
(FPCore (kx ky th) :precision binary64 (* (/ 1.0 (fabs kx)) (* th ky)))
double code(double kx, double ky, double th) {
return (1.0 / fabs(kx)) * (th * 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 = (1.0d0 / abs(kx)) * (th * ky)
end function
public static double code(double kx, double ky, double th) {
return (1.0 / Math.abs(kx)) * (th * ky);
}
def code(kx, ky, th): return (1.0 / math.fabs(kx)) * (th * ky)
function code(kx, ky, th) return Float64(Float64(1.0 / abs(kx)) * Float64(th * ky)) end
function tmp = code(kx, ky, th) tmp = (1.0 / abs(kx)) * (th * ky); end
code[kx_, ky_, th_] := N[(N[(1.0 / N[Abs[kx], $MachinePrecision]), $MachinePrecision] * N[(th * ky), $MachinePrecision]), $MachinePrecision]
\frac{1}{\left|kx\right|} \cdot \left(th \cdot ky\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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
Taylor expanded in th around 0
lower-*.f6412.8%
Applied rewrites12.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6412.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6412.8%
Applied rewrites12.8%
(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.6%
Applied rewrites35.6%
Taylor expanded in kx around 0
lower-/.f64N/A
lower-*.f64N/A
lower-sin.f6415.7%
Applied rewrites15.7%
Taylor expanded in th around 0
lower-*.f6412.8%
Applied rewrites12.8%
herbie shell --seed 2025258
(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)))