
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -2.95e+103)
t_0
(if (<= y.im -1.75e-141)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(if (<= y.im 2.1e-72)
(/
(-
x.re
(/
(fma
(- x.im)
y.im
(/
(fma (* y.im y.im) x.re (/ (* (pow y.im 3.0) x.im) y.re))
y.re))
y.re))
y.re)
(if (<= y.im 1.8e+69)
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -2.95e+103) {
tmp = t_0;
} else if (y_46_im <= -1.75e-141) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
} else if (y_46_im <= 2.1e-72) {
tmp = (x_46_re - (fma(-x_46_im, y_46_im, (fma((y_46_im * y_46_im), x_46_re, ((pow(y_46_im, 3.0) * x_46_im) / y_46_re)) / y_46_re)) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.8e+69) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -2.95e+103) tmp = t_0; elseif (y_46_im <= -1.75e-141) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))); elseif (y_46_im <= 2.1e-72) tmp = Float64(Float64(x_46_re - Float64(fma(Float64(-x_46_im), y_46_im, Float64(fma(Float64(y_46_im * y_46_im), x_46_re, Float64(Float64((y_46_im ^ 3.0) * x_46_im) / y_46_re)) / y_46_re)) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.8e+69) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.95e+103], t$95$0, If[LessEqual[y$46$im, -1.75e-141], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.1e-72], N[(N[(x$46$re - N[(N[((-x$46$im) * y$46$im + N[(N[(N[(y$46$im * y$46$im), $MachinePrecision] * x$46$re + N[(N[(N[Power[y$46$im, 3.0], $MachinePrecision] * x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+69], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -2.95 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -1.75 \cdot 10^{-141}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{-72}:\\
\;\;\;\;\frac{x.re - \frac{\mathsf{fma}\left(-x.im, y.im, \frac{\mathsf{fma}\left(y.im \cdot y.im, x.re, \frac{{y.im}^{3} \cdot x.im}{y.re}\right)}{y.re}\right)}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -2.9499999999999999e103 or 1.8000000000000001e69 < y.im Initial program 42.0%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -2.9499999999999999e103 < y.im < -1.7500000000000001e-141Initial program 88.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6488.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6488.8
Applied rewrites88.8%
if -1.7500000000000001e-141 < y.im < 2.1e-72Initial program 63.7%
Taylor expanded in y.re around inf
Applied rewrites91.4%
if 2.1e-72 < y.im < 1.8000000000000001e69Initial program 91.4%
Final simplification88.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (+ (* x.re y.re) (* x.im y.im)))
(t_1 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -2.95e+103)
t_1
(if (<= y.im -8.2e-98)
(/ t_0 (* (fma y.re (/ y.re (* y.im y.im)) 1.0) (* y.im y.im)))
(if (<= y.im 2.1e-72)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.im 1.8e+69)
(/ t_0 (+ (* y.re y.re) (* y.im y.im)))
t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re * y_46_re) + (x_46_im * y_46_im);
double t_1 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -2.95e+103) {
tmp = t_1;
} else if (y_46_im <= -8.2e-98) {
tmp = t_0 / (fma(y_46_re, (y_46_re / (y_46_im * y_46_im)), 1.0) * (y_46_im * y_46_im));
} else if (y_46_im <= 2.1e-72) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.8e+69) {
tmp = t_0 / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) t_1 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -2.95e+103) tmp = t_1; elseif (y_46_im <= -8.2e-98) tmp = Float64(t_0 / Float64(fma(y_46_re, Float64(y_46_re / Float64(y_46_im * y_46_im)), 1.0) * Float64(y_46_im * y_46_im))); elseif (y_46_im <= 2.1e-72) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.8e+69) tmp = Float64(t_0 / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.95e+103], t$95$1, If[LessEqual[y$46$im, -8.2e-98], N[(t$95$0 / N[(N[(y$46$re * N[(y$46$re / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] * N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.1e-72], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+69], N[(t$95$0 / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x.re \cdot y.re + x.im \cdot y.im\\
t_1 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -2.95 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -8.2 \cdot 10^{-98}:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(y.re, \frac{y.re}{y.im \cdot y.im}, 1\right) \cdot \left(y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;\frac{t\_0}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -2.9499999999999999e103 or 1.8000000000000001e69 < y.im Initial program 42.0%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -2.9499999999999999e103 < y.im < -8.1999999999999996e-98Initial program 86.8%
Taylor expanded in y.im around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6486.7
Applied rewrites86.7%
Applied rewrites86.8%
if -8.1999999999999996e-98 < y.im < 2.1e-72Initial program 68.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.1
Applied rewrites68.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
if 2.1e-72 < y.im < 1.8000000000000001e69Initial program 91.4%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -2.95e+103)
t_0
(if (<= y.im -8e-98)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(if (<= y.im 2.1e-72)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.im 1.8e+69)
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -2.95e+103) {
tmp = t_0;
} else if (y_46_im <= -8e-98) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
} else if (y_46_im <= 2.1e-72) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.8e+69) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -2.95e+103) tmp = t_0; elseif (y_46_im <= -8e-98) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))); elseif (y_46_im <= 2.1e-72) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.8e+69) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.95e+103], t$95$0, If[LessEqual[y$46$im, -8e-98], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.1e-72], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+69], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -2.95 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -8 \cdot 10^{-98}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -2.9499999999999999e103 or 1.8000000000000001e69 < y.im Initial program 42.0%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -2.9499999999999999e103 < y.im < -7.99999999999999951e-98Initial program 86.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6486.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6486.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6486.8
Applied rewrites86.8%
if -7.99999999999999951e-98 < y.im < 2.1e-72Initial program 68.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.1
Applied rewrites68.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
if 2.1e-72 < y.im < 1.8000000000000001e69Initial program 91.4%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re))))
(t_1 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -2.95e+103)
t_1
(if (<= y.im -8e-98)
t_0
(if (<= y.im 2.1e-72)
(/ (fma (/ y.im y.re) x.im x.re) y.re)
(if (<= y.im 1.8e+69) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -2.95e+103) {
tmp = t_1;
} else if (y_46_im <= -8e-98) {
tmp = t_0;
} else if (y_46_im <= 2.1e-72) {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.8e+69) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) t_1 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -2.95e+103) tmp = t_1; elseif (y_46_im <= -8e-98) tmp = t_0; elseif (y_46_im <= 2.1e-72) tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.8e+69) tmp = t_0; else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.95e+103], t$95$1, If[LessEqual[y$46$im, -8e-98], t$95$0, If[LessEqual[y$46$im, 2.1e-72], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.8e+69], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
t_1 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -2.95 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -8 \cdot 10^{-98}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.1 \cdot 10^{-72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+69}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -2.9499999999999999e103 or 1.8000000000000001e69 < y.im Initial program 42.0%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6483.8
Applied rewrites83.8%
if -2.9499999999999999e103 < y.im < -7.99999999999999951e-98 or 2.1e-72 < y.im < 1.8000000000000001e69Initial program 88.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6488.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6488.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6488.7
Applied rewrites88.7%
if -7.99999999999999951e-98 < y.im < 2.1e-72Initial program 68.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6468.1
lift-*.f64N/A
*-commutativeN/A
lower-*.f6468.1
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6468.1
Applied rewrites68.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
Final simplification87.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (/ y.im (fma y.re y.re (* y.im y.im))) x.im)))
(if (<= y.im -3.5e+100)
(/ x.im y.im)
(if (<= y.im -6200.0)
t_0
(if (<= y.im 0.00041)
(/ (fma (/ x.im y.re) y.im x.re) y.re)
(if (<= y.im 1.85e+118) t_0 (/ x.im y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (y_46_im / fma(y_46_re, y_46_re, (y_46_im * y_46_im))) * x_46_im;
double tmp;
if (y_46_im <= -3.5e+100) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= -6200.0) {
tmp = t_0;
} else if (y_46_im <= 0.00041) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else if (y_46_im <= 1.85e+118) {
tmp = t_0;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(y_46_im / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))) * x_46_im) tmp = 0.0 if (y_46_im <= -3.5e+100) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= -6200.0) tmp = t_0; elseif (y_46_im <= 0.00041) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); elseif (y_46_im <= 1.85e+118) tmp = t_0; else tmp = Float64(x_46_im / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$im / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.5e+100], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -6200.0], t$95$0, If[LessEqual[y$46$im, 0.00041], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.85e+118], t$95$0, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot x.im\\
\mathbf{if}\;y.im \leq -3.5 \cdot 10^{+100}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq -6200:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 0.00041:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 1.85 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -3.49999999999999976e100 or 1.84999999999999993e118 < y.im Initial program 38.5%
Taylor expanded in y.re around 0
lower-/.f6476.3
Applied rewrites76.3%
if -3.49999999999999976e100 < y.im < -6200 or 4.0999999999999999e-4 < y.im < 1.84999999999999993e118Initial program 82.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6482.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.8
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.8
Applied rewrites82.8%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
unpow2N/A
distribute-lft-neg-outN/A
metadata-evalN/A
associate-*r*N/A
unpow2N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6472.9
Applied rewrites72.9%
if -6200 < y.im < 4.0999999999999999e-4Initial program 71.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-outN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
Final simplification79.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (/ y.im (fma y.re y.re (* y.im y.im))) x.im)))
(if (<= y.im -3.5e+100)
(/ x.im y.im)
(if (<= y.im -1.25e-95)
t_0
(if (<= y.im 2.4e-73)
(/ x.re y.re)
(if (<= y.im 3.7e+114) t_0 (/ x.im y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (y_46_im / fma(y_46_re, y_46_re, (y_46_im * y_46_im))) * x_46_im;
double tmp;
if (y_46_im <= -3.5e+100) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= -1.25e-95) {
tmp = t_0;
} else if (y_46_im <= 2.4e-73) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 3.7e+114) {
tmp = t_0;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(y_46_im / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))) * x_46_im) tmp = 0.0 if (y_46_im <= -3.5e+100) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= -1.25e-95) tmp = t_0; elseif (y_46_im <= 2.4e-73) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 3.7e+114) tmp = t_0; else tmp = Float64(x_46_im / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$im / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.5e+100], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -1.25e-95], t$95$0, If[LessEqual[y$46$im, 2.4e-73], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 3.7e+114], t$95$0, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot x.im\\
\mathbf{if}\;y.im \leq -3.5 \cdot 10^{+100}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq -1.25 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.4 \cdot 10^{-73}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 3.7 \cdot 10^{+114}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -3.49999999999999976e100 or 3.7000000000000001e114 < y.im Initial program 39.9%
Taylor expanded in y.re around 0
lower-/.f6474.6
Applied rewrites74.6%
if -3.49999999999999976e100 < y.im < -1.2499999999999999e-95 or 2.40000000000000006e-73 < y.im < 3.7000000000000001e114Initial program 82.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6482.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6482.7
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6482.7
Applied rewrites82.7%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
fp-cancel-sub-sign-invN/A
unpow2N/A
distribute-lft-neg-outN/A
metadata-evalN/A
associate-*r*N/A
unpow2N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6469.2
Applied rewrites69.2%
if -1.2499999999999999e-95 < y.im < 2.40000000000000006e-73Initial program 67.8%
Taylor expanded in y.re around inf
lower-/.f6476.9
Applied rewrites76.9%
Final simplification74.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (/ x.im (fma y.im y.im (* y.re y.re))) y.im)))
(if (<= y.im -2.35e+94)
(/ x.im y.im)
(if (<= y.im -1.25e-95)
t_0
(if (<= y.im 2.4e-73)
(/ x.re y.re)
(if (<= y.im 1.5e+111) t_0 (/ x.im y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * y_46_im;
double tmp;
if (y_46_im <= -2.35e+94) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= -1.25e-95) {
tmp = t_0;
} else if (y_46_im <= 2.4e-73) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 1.5e+111) {
tmp = t_0;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * y_46_im) tmp = 0.0 if (y_46_im <= -2.35e+94) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= -1.25e-95) tmp = t_0; elseif (y_46_im <= 2.4e-73) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 1.5e+111) tmp = t_0; else tmp = Float64(x_46_im / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.35e+94], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -1.25e-95], t$95$0, If[LessEqual[y$46$im, 2.4e-73], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.5e+111], t$95$0, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.im\\
\mathbf{if}\;y.im \leq -2.35 \cdot 10^{+94}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq -1.25 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.4 \cdot 10^{-73}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 1.5 \cdot 10^{+111}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -2.35000000000000008e94 or 1.5e111 < y.im Initial program 42.8%
Taylor expanded in y.re around 0
lower-/.f6472.9
Applied rewrites72.9%
if -2.35000000000000008e94 < y.im < -1.2499999999999999e-95 or 2.40000000000000006e-73 < y.im < 1.5e111Initial program 82.0%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6468.8
Applied rewrites68.8%
if -1.2499999999999999e-95 < y.im < 2.40000000000000006e-73Initial program 67.8%
Taylor expanded in y.re around inf
lower-/.f6476.9
Applied rewrites76.9%
Final simplification73.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6600.0) (not (<= y.im 3.4e-5))) (/ (fma (/ x.re y.im) y.re x.im) y.im) (/ (fma (/ y.im y.re) x.im x.re) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -6600.0) || !(y_46_im <= 3.4e-5)) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else {
tmp = fma((y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -6600.0) || !(y_46_im <= 3.4e-5)) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); else tmp = Float64(fma(Float64(y_46_im / y_46_re), x_46_im, x_46_re) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -6600.0], N[Not[LessEqual[y$46$im, 3.4e-5]], $MachinePrecision]], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -6600 \lor \neg \left(y.im \leq 3.4 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.im}{y.re}, x.im, x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.im < -6600 or 3.4e-5 < y.im Initial program 54.6%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.3
Applied rewrites79.3%
if -6600 < y.im < 3.4e-5Initial program 71.0%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6471.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6471.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6471.0
Applied rewrites71.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6486.6
Applied rewrites86.6%
Final simplification82.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6600.0) (not (<= y.im 3.4e-5))) (/ (fma (/ x.re y.im) y.re x.im) y.im) (/ (fma (/ x.im y.re) y.im x.re) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -6600.0) || !(y_46_im <= 3.4e-5)) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -6600.0) || !(y_46_im <= 3.4e-5)) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); else tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -6600.0], N[Not[LessEqual[y$46$im, 3.4e-5]], $MachinePrecision]], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -6600 \lor \neg \left(y.im \leq 3.4 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.im < -6600 or 3.4e-5 < y.im Initial program 54.6%
Taylor expanded in y.re around 0
unpow2N/A
associate-/r*N/A
div-addN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6479.3
Applied rewrites79.3%
if -6600 < y.im < 3.4e-5Initial program 71.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-outN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
remove-double-negN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
*-commutativeN/A
mul-1-negN/A
mul-1-negN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f6485.0
Applied rewrites85.0%
Final simplification82.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -6200.0) (not (<= y.im 0.0009))) (/ x.im y.im) (/ x.re y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -6200.0) || !(y_46_im <= 0.0009)) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46im <= (-6200.0d0)) .or. (.not. (y_46im <= 0.0009d0))) then
tmp = x_46im / y_46im
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -6200.0) || !(y_46_im <= 0.0009)) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -6200.0) or not (y_46_im <= 0.0009): tmp = x_46_im / y_46_im else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -6200.0) || !(y_46_im <= 0.0009)) tmp = Float64(x_46_im / y_46_im); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -6200.0) || ~((y_46_im <= 0.0009))) tmp = x_46_im / y_46_im; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -6200.0], N[Not[LessEqual[y$46$im, 0.0009]], $MachinePrecision]], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -6200 \lor \neg \left(y.im \leq 0.0009\right):\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.im < -6200 or 8.9999999999999998e-4 < y.im Initial program 54.6%
Taylor expanded in y.re around 0
lower-/.f6468.3
Applied rewrites68.3%
if -6200 < y.im < 8.9999999999999998e-4Initial program 71.0%
Taylor expanded in y.re around inf
lower-/.f6469.1
Applied rewrites69.1%
Final simplification68.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.im))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = x_46im / y_46im
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_im) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_im; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.im}
\end{array}
Initial program 62.6%
Taylor expanded in y.re around 0
lower-/.f6444.2
Applied rewrites44.2%
Final simplification44.2%
herbie shell --seed 2025017
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))