
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = (sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)
end function
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th
\end{array}
(FPCore (kx ky th) :precision binary64 (* (/ (sin th) (hypot (sin kx) (sin ky))) (sin ky)))
double code(double kx, double ky, double th) {
return (sin(th) / hypot(sin(kx), sin(ky))) * sin(ky);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(th) / Math.hypot(Math.sin(kx), Math.sin(ky))) * Math.sin(ky);
}
def code(kx, ky, th): return (math.sin(th) / math.hypot(math.sin(kx), math.sin(ky))) * math.sin(ky)
function code(kx, ky, th) return Float64(Float64(sin(th) / hypot(sin(kx), sin(ky))) * sin(ky)) end
function tmp = code(kx, ky, th) tmp = (sin(th) / hypot(sin(kx), sin(ky))) * sin(ky); end
code[kx_, ky_, th_] := N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky
\end{array}
Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
*-lft-identityN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
(FPCore (kx ky th) :precision binary64 (* (/ (sin ky) (hypot (sin ky) (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
(FPCore (kx ky th) :precision binary64 (if (<= th 5.5e-12) (* (/ (sin ky) (hypot (sin ky) (sin kx))) th) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 5.5e-12) {
tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th;
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 5.5e-12) {
tmp = (Math.sin(ky) / Math.hypot(Math.sin(ky), Math.sin(kx))) * th;
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 5.5e-12: tmp = (math.sin(ky) / math.hypot(math.sin(ky), math.sin(kx))) * th else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 5.5e-12) tmp = Float64(Float64(sin(ky) / hypot(sin(ky), sin(kx))) * th); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 5.5e-12) tmp = (sin(ky) / hypot(sin(ky), sin(kx))) * th; else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 5.5e-12], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[Sin[ky], $MachinePrecision] ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 5.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{\sin ky}{\mathsf{hypot}\left(\sin ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if th < 5.5000000000000004e-12Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in th around 0
Applied rewrites50.5%
if 5.5000000000000004e-12 < th Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th) :precision binary64 (if (<= th 1.08e-13) (* (/ th (hypot (sin kx) (sin ky))) (sin ky)) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.08e-13) {
tmp = (th / hypot(sin(kx), sin(ky))) * sin(ky);
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.08e-13) {
tmp = (th / Math.hypot(Math.sin(kx), Math.sin(ky))) * Math.sin(ky);
} else {
tmp = Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1.08e-13: tmp = (th / math.hypot(math.sin(kx), math.sin(ky))) * math.sin(ky) else: tmp = math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1.08e-13) tmp = Float64(Float64(th / hypot(sin(kx), sin(ky))) * sin(ky)); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1.08e-13) tmp = (th / hypot(sin(kx), sin(ky))) * sin(ky); else tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1.08e-13], N[(N[(th / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[ky], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.08 \cdot 10^{-13}:\\
\;\;\;\;\frac{th}{\mathsf{hypot}\left(\sin kx, \sin ky\right)} \cdot \sin ky\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if th < 1.0799999999999999e-13Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
*-lft-identityN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in th around 0
Applied rewrites50.5%
if 1.0799999999999999e-13 < th Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (fma (* ky ky) -0.16666666666666666 1.0) ky)))
(if (<= ky 2.1)
(* (/ (sin th) (hypot (sin kx) t_1)) t_1)
(* (/ (sin ky) (sqrt (- 0.5 (* (cos (+ ky ky)) 0.5)))) (sin th)))))
double code(double kx, double ky, double th) {
double t_1 = fma((ky * ky), -0.16666666666666666, 1.0) * ky;
double tmp;
if (ky <= 2.1) {
tmp = (sin(th) / hypot(sin(kx), t_1)) * t_1;
} else {
tmp = (sin(ky) / sqrt((0.5 - (cos((ky + ky)) * 0.5)))) * sin(th);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) tmp = 0.0 if (ky <= 2.1) tmp = Float64(Float64(sin(th) / hypot(sin(kx), t_1)) * t_1); else tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(cos(Float64(ky + ky)) * 0.5)))) * sin(th)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision]}, If[LessEqual[ky, 2.1], N[(N[(N[Sin[th], $MachinePrecision] / N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky\\
\mathbf{if}\;ky \leq 2.1:\\
\;\;\;\;\frac{\sin th}{\mathsf{hypot}\left(\sin kx, t\_1\right)} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{0.5 - \cos \left(ky + ky\right) \cdot 0.5}} \cdot \sin th\\
\end{array}
\end{array}
if ky < 2.10000000000000009Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
lift-/.f64N/A
lift-*.f64N/A
lift-sin.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
*-lft-identityN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f6499.6
Applied rewrites99.6%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6451.4
Applied rewrites51.4%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6453.2
Applied rewrites53.2%
if 2.10000000000000009 < ky Initial program 94.3%
Taylor expanded in kx around 0
unpow2N/A
lower-fma.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
Taylor expanded in kx around 0
pow2N/A
sqr-sin-a-revN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
count-2-revN/A
lower-+.f6431.6
Applied rewrites31.6%
(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.98)
(/
(* (fma (* th th) -0.16666666666666666 1.0) th)
(/
(hypot (* (fma (* kx kx) -0.16666666666666666 1.0) kx) (sin ky))
(sin ky)))
(if (<= t_1 5e-264)
(* (/ (sin ky) (sqrt (- 0.5 (* (cos (+ kx kx)) 0.5)))) (sin th))
(/ (sin th) (/ (hypot ky (sin kx)) ky))))))
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.98) {
tmp = (fma((th * th), -0.16666666666666666, 1.0) * th) / (hypot((fma((kx * kx), -0.16666666666666666, 1.0) * kx), sin(ky)) / sin(ky));
} else if (t_1 <= 5e-264) {
tmp = (sin(ky) / sqrt((0.5 - (cos((kx + kx)) * 0.5)))) * sin(th);
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
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.98) tmp = Float64(Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) / Float64(hypot(Float64(fma(Float64(kx * kx), -0.16666666666666666, 1.0) * kx), sin(ky)) / sin(ky))); elseif (t_1 <= 5e-264) tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(cos(Float64(kx + kx)) * 0.5)))) * sin(th)); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return 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.98], N[(N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision] / N[(N[Sqrt[N[(N[(N[(kx * kx), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * kx), $MachinePrecision] ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-264], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}}\\
\mathbf{if}\;t\_1 \leq -0.98:\\
\;\;\;\;\frac{\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th}{\frac{\mathsf{hypot}\left(\mathsf{fma}\left(kx \cdot kx, -0.16666666666666666, 1\right) \cdot kx, \sin ky\right)}{\sin ky}}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-264}:\\
\;\;\;\;\frac{\sin ky}{\sqrt{0.5 - \cos \left(kx + kx\right) \cdot 0.5}} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\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.97999999999999998Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
Taylor expanded in th around 0
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6432.7
Applied rewrites32.7%
if -0.97999999999999998 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 5.0000000000000001e-264Initial program 94.3%
Taylor expanded in kx around 0
unpow2N/A
lower-fma.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
Taylor expanded in ky around 0
pow2N/A
sqr-sin-a-revN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
count-2-revN/A
lower-+.f6431.3
Applied rewrites31.3%
if 5.0000000000000001e-264 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) -0.02)
(/
(* (fma (* th th) -0.16666666666666666 1.0) th)
(/ (hypot kx (sin ky)) (sin ky)))
(/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= -0.02) {
tmp = (fma((th * th), -0.16666666666666666, 1.0) * th) / (hypot(kx, sin(ky)) / sin(ky));
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= -0.02) tmp = Float64(Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) / Float64(hypot(kx, sin(ky)) / sin(ky))); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.02], N[(N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision] / N[(N[Sqrt[kx ^ 2 + N[Sin[ky], $MachinePrecision] ^ 2], $MachinePrecision] / N[Sin[ky], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq -0.02:\\
\;\;\;\;\frac{\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th}{\frac{\mathsf{hypot}\left(kx, \sin ky\right)}{\sin ky}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\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.0200000000000000004Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
Taylor expanded in th around 0
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
Taylor expanded in kx around 0
Applied rewrites32.9%
if -0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) -0.02) (* (/ (sin ky) (sqrt (fma kx kx (- 0.5 (* 0.5 (cos (* 2.0 ky))))))) th) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= -0.02) {
tmp = (sin(ky) / sqrt(fma(kx, kx, (0.5 - (0.5 * cos((2.0 * ky))))))) * th;
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= -0.02) tmp = Float64(Float64(sin(ky) / sqrt(fma(kx, kx, Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * ky))))))) * th); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(kx * kx + N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * ky), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq -0.02:\\
\;\;\;\;\frac{\sin ky}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5 - 0.5 \cdot \cos \left(2 \cdot ky\right)\right)}} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\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.0200000000000000004Initial program 94.3%
Taylor expanded in kx around 0
unpow2N/A
lower-fma.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
Taylor expanded in th around 0
Applied rewrites26.2%
if -0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) -0.02) (/ (* (sin ky) th) (sqrt (- (fma kx kx 0.5) (* (cos (+ ky ky)) 0.5)))) (/ (sin th) (/ (hypot ky (sin kx)) ky))))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= -0.02) {
tmp = (sin(ky) * th) / sqrt((fma(kx, kx, 0.5) - (cos((ky + ky)) * 0.5)));
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= -0.02) tmp = Float64(Float64(sin(ky) * th) / sqrt(Float64(fma(kx, kx, 0.5) - Float64(cos(Float64(ky + ky)) * 0.5)))); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.02], N[(N[(N[Sin[ky], $MachinePrecision] * th), $MachinePrecision] / N[Sqrt[N[(N[(kx * kx + 0.5), $MachinePrecision] - N[(N[Cos[N[(ky + ky), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq -0.02:\\
\;\;\;\;\frac{\sin ky \cdot th}{\sqrt{\mathsf{fma}\left(kx, kx, 0.5\right) - \cos \left(ky + ky\right) \cdot 0.5}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\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.0200000000000000004Initial program 94.3%
Taylor expanded in kx around 0
unpow2N/A
lower-fma.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
associate-*l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6442.5
lift-fma.f64N/A
Applied rewrites34.8%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
lift-sin.f6421.6
Applied rewrites21.6%
if -0.0200000000000000004 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th)
:precision binary64
(let* ((t_1 (* (fma (* ky ky) -0.16666666666666666 1.0) ky)))
(if (<= (sin ky) -0.3)
(/
(* (fma (* th th) -0.16666666666666666 1.0) th)
(/ (hypot (sin kx) t_1) t_1))
(/ (sin th) (/ (hypot ky (sin kx)) ky)))))
double code(double kx, double ky, double th) {
double t_1 = fma((ky * ky), -0.16666666666666666, 1.0) * ky;
double tmp;
if (sin(ky) <= -0.3) {
tmp = (fma((th * th), -0.16666666666666666, 1.0) * th) / (hypot(sin(kx), t_1) / t_1);
} else {
tmp = sin(th) / (hypot(ky, sin(kx)) / ky);
}
return tmp;
}
function code(kx, ky, th) t_1 = Float64(fma(Float64(ky * ky), -0.16666666666666666, 1.0) * ky) tmp = 0.0 if (sin(ky) <= -0.3) tmp = Float64(Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) / Float64(hypot(sin(kx), t_1) / t_1)); else tmp = Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)); end return tmp end
code[kx_, ky_, th_] := Block[{t$95$1 = N[(N[(N[(ky * ky), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * ky), $MachinePrecision]}, If[LessEqual[N[Sin[ky], $MachinePrecision], -0.3], N[(N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision] / N[(N[Sqrt[N[Sin[kx], $MachinePrecision] ^ 2 + t$95$1 ^ 2], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(ky \cdot ky, -0.16666666666666666, 1\right) \cdot ky\\
\mathbf{if}\;\sin ky \leq -0.3:\\
\;\;\;\;\frac{\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th}{\frac{\mathsf{hypot}\left(\sin kx, t\_1\right)}{t\_1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}\\
\end{array}
\end{array}
if (sin.f64 ky) < -0.299999999999999989Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
Taylor expanded in th around 0
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6426.5
Applied rewrites26.5%
Taylor expanded in ky around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6427.4
Applied rewrites27.4%
if -0.299999999999999989 < (sin.f64 ky) Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th) :precision binary64 (/ (sin th) (/ (hypot ky (sin kx)) ky)))
double code(double kx, double ky, double th) {
return sin(th) / (hypot(ky, sin(kx)) / ky);
}
public static double code(double kx, double ky, double th) {
return Math.sin(th) / (Math.hypot(ky, Math.sin(kx)) / ky);
}
def code(kx, ky, th): return math.sin(th) / (math.hypot(ky, math.sin(kx)) / ky)
function code(kx, ky, th) return Float64(sin(th) / Float64(hypot(ky, sin(kx)) / ky)) end
function tmp = code(kx, ky, th) tmp = sin(th) / (hypot(ky, sin(kx)) / ky); end
code[kx_, ky_, th_] := N[(N[Sin[th], $MachinePrecision] / N[(N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin th}{\frac{\mathsf{hypot}\left(ky, \sin kx\right)}{ky}}
\end{array}
Initial program 94.3%
lift-/.f64N/A
lift-sin.f64N/A
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
division-flipN/A
lower-/.f64N/A
lower-special-/N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in ky around 0
Applied rewrites51.8%
Taylor expanded in ky around 0
Applied rewrites64.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
associate-*l/N/A
*-lft-identityN/A
lower-/.f64N/A
lift-sin.f6464.7
Applied rewrites64.7%
(FPCore (kx ky th) :precision binary64 (* (/ ky (hypot ky (sin kx))) (sin th)))
double code(double kx, double ky, double th) {
return (ky / hypot(ky, sin(kx))) * sin(th);
}
public static double code(double kx, double ky, double th) {
return (ky / Math.hypot(ky, Math.sin(kx))) * Math.sin(th);
}
def code(kx, ky, th): return (ky / math.hypot(ky, math.sin(kx))) * math.sin(th)
function code(kx, ky, th) return Float64(Float64(ky / hypot(ky, sin(kx))) * sin(th)) end
function tmp = code(kx, ky, th) tmp = (ky / hypot(ky, sin(kx))) * sin(th); end
code[kx_, ky_, th_] := N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot \sin th
\end{array}
Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) -0.1)
(* (/ (sin ky) (sqrt (- 0.5 (* (cos (+ kx kx)) 0.5)))) th)
(if (<= (sin kx) 0.17)
(*
(/
ky
(hypot
ky
(*
(fma
(fma 0.008333333333333333 (* kx kx) -0.16666666666666666)
(* kx kx)
1.0)
kx)))
(sin th))
(/ (* (sin th) ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= -0.1) {
tmp = (sin(ky) / sqrt((0.5 - (cos((kx + kx)) * 0.5)))) * th;
} else if (sin(kx) <= 0.17) {
tmp = (ky / hypot(ky, (fma(fma(0.008333333333333333, (kx * kx), -0.16666666666666666), (kx * kx), 1.0) * kx))) * sin(th);
} else {
tmp = (sin(th) * ky) / sin(kx);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= -0.1) tmp = Float64(Float64(sin(ky) / sqrt(Float64(0.5 - Float64(cos(Float64(kx + kx)) * 0.5)))) * th); elseif (sin(kx) <= 0.17) tmp = Float64(Float64(ky / hypot(ky, Float64(fma(fma(0.008333333333333333, Float64(kx * kx), -0.16666666666666666), Float64(kx * kx), 1.0) * kx))) * sin(th)); else tmp = Float64(Float64(sin(th) * ky) / sin(kx)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], -0.1], N[(N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(0.5 - N[(N[Cos[N[(kx + kx), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.17], N[(N[(ky / N[Sqrt[ky ^ 2 + N[(N[(N[(0.008333333333333333 * N[(kx * kx), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision] * kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq -0.1:\\
\;\;\;\;\frac{\sin ky}{\sqrt{0.5 - \cos \left(kx + kx\right) \cdot 0.5}} \cdot th\\
\mathbf{elif}\;\sin kx \leq 0.17:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, kx \cdot kx, -0.16666666666666666\right), kx \cdot kx, 1\right) \cdot kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < -0.10000000000000001Initial program 94.3%
Taylor expanded in kx around 0
unpow2N/A
lower-fma.f64N/A
unpow2N/A
sqr-sin-aN/A
lower--.f64N/A
lower-*.f64N/A
lower-cos.f64N/A
lower-*.f6443.6
Applied rewrites43.6%
Taylor expanded in ky around 0
pow2N/A
sqr-sin-a-revN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-cos.f64N/A
count-2-revN/A
lower-+.f6431.3
Applied rewrites31.3%
Taylor expanded in th around 0
Applied rewrites16.6%
if -0.10000000000000001 < (sin.f64 kx) < 0.170000000000000012Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-flipN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.9
Applied rewrites45.9%
if 0.170000000000000012 < (sin.f64 kx) Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6423.8
Applied rewrites23.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) 1e-306)
(* (/ ky (hypot ky (sin kx))) th)
(if (<= (sin kx) 0.17)
(*
(/
ky
(hypot
ky
(*
(fma
(fma 0.008333333333333333 (* kx kx) -0.16666666666666666)
(* kx kx)
1.0)
kx)))
(sin th))
(/ (* (sin th) ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 1e-306) {
tmp = (ky / hypot(ky, sin(kx))) * th;
} else if (sin(kx) <= 0.17) {
tmp = (ky / hypot(ky, (fma(fma(0.008333333333333333, (kx * kx), -0.16666666666666666), (kx * kx), 1.0) * kx))) * sin(th);
} else {
tmp = (sin(th) * ky) / sin(kx);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 1e-306) tmp = Float64(Float64(ky / hypot(ky, sin(kx))) * th); elseif (sin(kx) <= 0.17) tmp = Float64(Float64(ky / hypot(ky, Float64(fma(fma(0.008333333333333333, Float64(kx * kx), -0.16666666666666666), Float64(kx * kx), 1.0) * kx))) * sin(th)); else tmp = Float64(Float64(sin(th) * ky) / sin(kx)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-306], N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.17], N[(N[(ky / N[Sqrt[ky ^ 2 + N[(N[(N[(0.008333333333333333 * N[(kx * kx), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(kx * kx), $MachinePrecision] + 1.0), $MachinePrecision] * kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 10^{-306}:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;\sin kx \leq 0.17:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, kx \cdot kx, -0.16666666666666666\right), kx \cdot kx, 1\right) \cdot kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 1.00000000000000003e-306Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in th around 0
Applied rewrites33.4%
if 1.00000000000000003e-306 < (sin.f64 kx) < 0.170000000000000012Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-flipN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6445.9
Applied rewrites45.9%
if 0.170000000000000012 < (sin.f64 kx) Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6423.8
Applied rewrites23.8%
(FPCore (kx ky th)
:precision binary64
(if (<= (sin kx) 1e-306)
(* (/ ky (hypot ky (sin kx))) th)
(if (<= (sin kx) 0.01)
(*
(/ ky (hypot ky (* (fma (* kx kx) -0.16666666666666666 1.0) kx)))
(sin th))
(/ (* (sin th) ky) (sin kx)))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 1e-306) {
tmp = (ky / hypot(ky, sin(kx))) * th;
} else if (sin(kx) <= 0.01) {
tmp = (ky / hypot(ky, (fma((kx * kx), -0.16666666666666666, 1.0) * kx))) * sin(th);
} else {
tmp = (sin(th) * ky) / sin(kx);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 1e-306) tmp = Float64(Float64(ky / hypot(ky, sin(kx))) * th); elseif (sin(kx) <= 0.01) tmp = Float64(Float64(ky / hypot(ky, Float64(fma(Float64(kx * kx), -0.16666666666666666, 1.0) * kx))) * sin(th)); else tmp = Float64(Float64(sin(th) * ky) / sin(kx)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 1e-306], N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], If[LessEqual[N[Sin[kx], $MachinePrecision], 0.01], N[(N[(ky / N[Sqrt[ky ^ 2 + N[(N[(N[(kx * kx), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * kx), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[th], $MachinePrecision] * ky), $MachinePrecision] / N[Sin[kx], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 10^{-306}:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot th\\
\mathbf{elif}\;\sin kx \leq 0.01:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \mathsf{fma}\left(kx \cdot kx, -0.16666666666666666, 1\right) \cdot kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin th \cdot ky}{\sin kx}\\
\end{array}
\end{array}
if (sin.f64 kx) < 1.00000000000000003e-306Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in th around 0
Applied rewrites33.4%
if 1.00000000000000003e-306 < (sin.f64 kx) < 0.0100000000000000002Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in kx around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6446.0
Applied rewrites46.0%
if 0.0100000000000000002 < (sin.f64 kx) Initial program 94.3%
Taylor expanded in ky around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-sin.f64N/A
lift-sin.f6423.8
Applied rewrites23.8%
(FPCore (kx ky th) :precision binary64 (if (<= th 1.7e-9) (* (/ ky (hypot ky (sin kx))) th) (* (/ ky (hypot ky kx)) (sin th))))
double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.7e-9) {
tmp = (ky / hypot(ky, sin(kx))) * th;
} else {
tmp = (ky / hypot(ky, kx)) * sin(th);
}
return tmp;
}
public static double code(double kx, double ky, double th) {
double tmp;
if (th <= 1.7e-9) {
tmp = (ky / Math.hypot(ky, Math.sin(kx))) * th;
} else {
tmp = (ky / Math.hypot(ky, kx)) * Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if th <= 1.7e-9: tmp = (ky / math.hypot(ky, math.sin(kx))) * th else: tmp = (ky / math.hypot(ky, kx)) * math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (th <= 1.7e-9) tmp = Float64(Float64(ky / hypot(ky, sin(kx))) * th); else tmp = Float64(Float64(ky / hypot(ky, kx)) * sin(th)); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (th <= 1.7e-9) tmp = (ky / hypot(ky, sin(kx))) * th; else tmp = (ky / hypot(ky, kx)) * sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[th, 1.7e-9], N[(N[(ky / N[Sqrt[ky ^ 2 + N[Sin[kx], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * th), $MachinePrecision], N[(N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;th \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, \sin kx\right)} \cdot th\\
\mathbf{else}:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, kx\right)} \cdot \sin th\\
\end{array}
\end{array}
if th < 1.6999999999999999e-9Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in th around 0
Applied rewrites33.4%
if 1.6999999999999999e-9 < th Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in kx around 0
Applied rewrites46.7%
(FPCore (kx ky th) :precision binary64 (if (<= (sin kx) 0.197) (* (/ ky (hypot ky kx)) (sin th)) (/ (* (fma (* th th) -0.16666666666666666 1.0) th) (/ (sin kx) ky))))
double code(double kx, double ky, double th) {
double tmp;
if (sin(kx) <= 0.197) {
tmp = (ky / hypot(ky, kx)) * sin(th);
} else {
tmp = (fma((th * th), -0.16666666666666666, 1.0) * th) / (sin(kx) / ky);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (sin(kx) <= 0.197) tmp = Float64(Float64(ky / hypot(ky, kx)) * sin(th)); else tmp = Float64(Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) / Float64(sin(kx) / ky)); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[Sin[kx], $MachinePrecision], 0.197], N[(N[(ky / N[Sqrt[ky ^ 2 + kx ^ 2], $MachinePrecision]), $MachinePrecision] * N[Sin[th], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin kx \leq 0.197:\\
\;\;\;\;\frac{ky}{\mathsf{hypot}\left(ky, kx\right)} \cdot \sin th\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th}{\frac{\sin kx}{ky}}\\
\end{array}
\end{array}
if (sin.f64 kx) < 0.19700000000000001Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
Taylor expanded in ky around 0
Applied rewrites50.5%
Taylor expanded in ky around 0
Applied rewrites64.7%
Taylor expanded in kx around 0
Applied rewrites46.7%
if 0.19700000000000001 < (sin.f64 kx) Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
Taylor expanded in th around 0
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
Taylor expanded in ky around 0
lower-/.f64N/A
lift-sin.f6415.3
Applied rewrites15.3%
(FPCore (kx ky th) :precision binary64 (if (<= (/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0)))) 2e-10) (/ (* (fma (* th th) -0.16666666666666666 1.0) th) (/ (sin kx) ky)) (sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 2e-10) {
tmp = (fma((th * th), -0.16666666666666666, 1.0) * th) / (sin(kx) / ky);
} else {
tmp = sin(th);
}
return tmp;
}
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 2e-10) tmp = Float64(Float64(fma(Float64(th * th), -0.16666666666666666, 1.0) * th) / Float64(sin(kx) / ky)); else tmp = sin(th); end return tmp end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-10], N[(N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * th), $MachinePrecision] / N[(N[Sin[kx], $MachinePrecision] / ky), $MachinePrecision]), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\mathsf{fma}\left(th \cdot th, -0.16666666666666666, 1\right) \cdot th}{\frac{\sin kx}{ky}}\\
\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))))) < 2.00000000000000007e-10Initial program 94.3%
lift-sqrt.f64N/A
lift-+.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
lift-pow.f64N/A
lift-sin.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
lower-hypot.f64N/A
lift-sin.f64N/A
lift-sin.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lift-sin.f64N/A
lower-hypot.f64N/A
lift-sin.f64N/A
Applied rewrites99.6%
Taylor expanded in th around 0
*-lft-identityN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6450.2
Applied rewrites50.2%
Taylor expanded in ky around 0
lower-/.f64N/A
lift-sin.f6415.3
Applied rewrites15.3%
if 2.00000000000000007e-10 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
(FPCore (kx ky th)
:precision binary64
(if (<=
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
1.55e-23)
(* (* (* th th) th) -0.16666666666666666)
(sin th)))
double code(double kx, double ky, double th) {
double tmp;
if ((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) <= 1.55e-23) {
tmp = ((th * th) * th) * -0.16666666666666666;
} else {
tmp = sin(th);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if ((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) <= 1.55d-23) then
tmp = ((th * th) * th) * (-0.16666666666666666d0)
else
tmp = sin(th)
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if ((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) <= 1.55e-23) {
tmp = ((th * th) * th) * -0.16666666666666666;
} else {
tmp = Math.sin(th);
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if (math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) <= 1.55e-23: tmp = ((th * th) * th) * -0.16666666666666666 else: tmp = math.sin(th) return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1.55e-23) tmp = Float64(Float64(Float64(th * th) * th) * -0.16666666666666666); else tmp = sin(th); end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if ((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) <= 1.55e-23) tmp = ((th * th) * th) * -0.16666666666666666; else tmp = sin(th); end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[N[(N[Sin[ky], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Sin[kx], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[ky], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.55e-23], N[(N[(N[(th * th), $MachinePrecision] * th), $MachinePrecision] * -0.16666666666666666), $MachinePrecision], N[Sin[th], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \leq 1.55 \cdot 10^{-23}:\\
\;\;\;\;\left(\left(th \cdot th\right) \cdot th\right) \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;\sin th\\
\end{array}
\end{array}
if (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) < 1.5499999999999999e-23Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.5
Applied rewrites13.5%
Taylor expanded in th around inf
*-commutativeN/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6410.9
Applied rewrites10.9%
if 1.5499999999999999e-23 < (/.f64 (sin.f64 ky) (sqrt.f64 (+.f64 (pow.f64 (sin.f64 kx) #s(literal 2 binary64)) (pow.f64 (sin.f64 ky) #s(literal 2 binary64))))) Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
1e-299)
(* (* (* th th) -0.16666666666666666) th)
th))
double code(double kx, double ky, double th) {
double tmp;
if (((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th)) <= 1e-299) {
tmp = ((th * th) * -0.16666666666666666) * th;
} else {
tmp = th;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)) <= 1d-299) then
tmp = ((th * th) * (-0.16666666666666666d0)) * th
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th)) <= 1e-299) {
tmp = ((th * th) * -0.16666666666666666) * th;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ((math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)) <= 1e-299: tmp = ((th * th) * -0.16666666666666666) * th else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) <= 1e-299) tmp = Float64(Float64(Float64(th * th) * -0.16666666666666666) * th); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) <= 1e-299) tmp = ((th * th) * -0.16666666666666666) * th; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 1e-299], N[(N[(N[(th * th), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * th), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \leq 10^{-299}:\\
\;\;\;\;\left(\left(th \cdot th\right) \cdot -0.16666666666666666\right) \cdot th\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (*.f64 (/.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))))) (sin.f64 th)) < 9.99999999999999992e-300Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.5
Applied rewrites13.5%
Taylor expanded in th around inf
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6410.9
Applied rewrites10.9%
if 9.99999999999999992e-300 < (*.f64 (/.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))))) (sin.f64 th)) Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
Taylor expanded in th around 0
Applied rewrites13.8%
(FPCore (kx ky th)
:precision binary64
(if (<=
(*
(/ (sin ky) (sqrt (+ (pow (sin kx) 2.0) (pow (sin ky) 2.0))))
(sin th))
1e-299)
(* (* (* th th) th) -0.16666666666666666)
th))
double code(double kx, double ky, double th) {
double tmp;
if (((sin(ky) / sqrt((pow(sin(kx), 2.0) + pow(sin(ky), 2.0)))) * sin(th)) <= 1e-299) {
tmp = ((th * th) * th) * -0.16666666666666666;
} else {
tmp = th;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
real(8) :: tmp
if (((sin(ky) / sqrt(((sin(kx) ** 2.0d0) + (sin(ky) ** 2.0d0)))) * sin(th)) <= 1d-299) then
tmp = ((th * th) * th) * (-0.16666666666666666d0)
else
tmp = th
end if
code = tmp
end function
public static double code(double kx, double ky, double th) {
double tmp;
if (((Math.sin(ky) / Math.sqrt((Math.pow(Math.sin(kx), 2.0) + Math.pow(Math.sin(ky), 2.0)))) * Math.sin(th)) <= 1e-299) {
tmp = ((th * th) * th) * -0.16666666666666666;
} else {
tmp = th;
}
return tmp;
}
def code(kx, ky, th): tmp = 0 if ((math.sin(ky) / math.sqrt((math.pow(math.sin(kx), 2.0) + math.pow(math.sin(ky), 2.0)))) * math.sin(th)) <= 1e-299: tmp = ((th * th) * th) * -0.16666666666666666 else: tmp = th return tmp
function code(kx, ky, th) tmp = 0.0 if (Float64(Float64(sin(ky) / sqrt(Float64((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) <= 1e-299) tmp = Float64(Float64(Float64(th * th) * th) * -0.16666666666666666); else tmp = th; end return tmp end
function tmp_2 = code(kx, ky, th) tmp = 0.0; if (((sin(ky) / sqrt(((sin(kx) ^ 2.0) + (sin(ky) ^ 2.0)))) * sin(th)) <= 1e-299) tmp = ((th * th) * th) * -0.16666666666666666; else tmp = th; end tmp_2 = tmp; end
code[kx_, ky_, th_] := If[LessEqual[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], 1e-299], N[(N[(N[(th * th), $MachinePrecision] * th), $MachinePrecision] * -0.16666666666666666), $MachinePrecision], th]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\sin ky}{\sqrt{{\sin kx}^{2} + {\sin ky}^{2}}} \cdot \sin th \leq 10^{-299}:\\
\;\;\;\;\left(\left(th \cdot th\right) \cdot th\right) \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;th\\
\end{array}
\end{array}
if (*.f64 (/.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))))) (sin.f64 th)) < 9.99999999999999992e-300Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
Taylor expanded in th around 0
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6413.5
Applied rewrites13.5%
Taylor expanded in th around inf
*-commutativeN/A
lower-*.f64N/A
unpow3N/A
pow2N/A
lower-*.f64N/A
pow2N/A
lift-*.f6410.9
Applied rewrites10.9%
if 9.99999999999999992e-300 < (*.f64 (/.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))))) (sin.f64 th)) Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
Taylor expanded in th around 0
Applied rewrites13.8%
(FPCore (kx ky th) :precision binary64 th)
double code(double kx, double ky, double th) {
return th;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(kx, ky, th)
use fmin_fmax_functions
real(8), intent (in) :: kx
real(8), intent (in) :: ky
real(8), intent (in) :: th
code = th
end function
public static double code(double kx, double ky, double th) {
return th;
}
def code(kx, ky, th): return th
function code(kx, ky, th) return th end
function tmp = code(kx, ky, th) tmp = th; end
code[kx_, ky_, th_] := th
\begin{array}{l}
\\
th
\end{array}
Initial program 94.3%
Taylor expanded in kx around 0
lift-sin.f6424.2
Applied rewrites24.2%
Taylor expanded in th around 0
Applied rewrites13.8%
herbie shell --seed 2025132
(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)))