
(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}
Herbie found 9 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
(if (<= y.im -2.4e+97)
(/ (fma y.re (/ x.re y.im) x.im) y.im)
(if (<= y.im -2.55e-103)
(/ (fma y.re x.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))
(if (<= y.im 8.6e-125)
(/
(fma
(/ (fma y.im x.im (/ (* (* y.im y.im) x.re) (- y.re))) y.re)
-1.0
(- x.re))
(- y.re))
(if (<= y.im 2.7e+56)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(fma (/ x.re y.im) (/ y.re y.im) (/ x.im y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -2.4e+97) {
tmp = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_im <= -2.55e-103) {
tmp = fma(y_46_re, x_46_re, (y_46_im * x_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
} else if (y_46_im <= 8.6e-125) {
tmp = fma((fma(y_46_im, x_46_im, (((y_46_im * y_46_im) * x_46_re) / -y_46_re)) / y_46_re), -1.0, -x_46_re) / -y_46_re;
} else if (y_46_im <= 2.7e+56) {
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 {
tmp = fma((x_46_re / y_46_im), (y_46_re / y_46_im), (x_46_im / y_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -2.4e+97) tmp = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_im <= -2.55e-103) tmp = Float64(fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))); elseif (y_46_im <= 8.6e-125) tmp = Float64(fma(Float64(fma(y_46_im, x_46_im, Float64(Float64(Float64(y_46_im * y_46_im) * x_46_re) / Float64(-y_46_re))) / y_46_re), -1.0, Float64(-x_46_re)) / Float64(-y_46_re)); elseif (y_46_im <= 2.7e+56) 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))); else tmp = fma(Float64(x_46_re / y_46_im), Float64(y_46_re / y_46_im), Float64(x_46_im / y_46_im)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.4e+97], N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -2.55e-103], N[(N[(y$46$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 8.6e-125], N[(N[(N[(N[(y$46$im * x$46$im + N[(N[(N[(y$46$im * y$46$im), $MachinePrecision] * x$46$re), $MachinePrecision] / (-y$46$re)), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision] * -1.0 + (-x$46$re)), $MachinePrecision] / (-y$46$re)), $MachinePrecision], If[LessEqual[y$46$im, 2.7e+56], 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], N[(N[(x$46$re / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision] + N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.4 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq -2.55 \cdot 10^{-103}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.im \leq 8.6 \cdot 10^{-125}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(y.im, x.im, \frac{\left(y.im \cdot y.im\right) \cdot x.re}{-y.re}\right)}{y.re}, -1, -x.re\right)}{-y.re}\\
\mathbf{elif}\;y.im \leq 2.7 \cdot 10^{+56}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x.re}{y.im}, \frac{y.re}{y.im}, \frac{x.im}{y.im}\right)\\
\end{array}
\end{array}
if y.im < -2.4e97Initial program 40.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-/.f6487.8
Applied rewrites87.8%
if -2.4e97 < y.im < -2.5499999999999999e-103Initial program 67.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6467.7
Applied rewrites67.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.7
Applied rewrites67.7%
if -2.5499999999999999e-103 < y.im < 8.6000000000000004e-125Initial program 65.4%
Taylor expanded in y.re around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites90.6%
if 8.6000000000000004e-125 < y.im < 2.7000000000000001e56Initial program 85.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.1
Applied rewrites85.1%
if 2.7000000000000001e56 < y.im Initial program 37.2%
Taylor expanded in y.re around 0
+-commutativeN/A
pow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
Final simplification85.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.4e+97)
(/ (fma y.re (/ x.re y.im) x.im) y.im)
(if (<= y.im -2.6e-103)
(/ (fma y.re x.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))
(if (<= y.im 9.5e-125)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 2.7e+56)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(fma (/ x.re y.im) (/ y.re y.im) (/ x.im y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -2.4e+97) {
tmp = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_im <= -2.6e-103) {
tmp = fma(y_46_re, x_46_re, (y_46_im * x_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
} else if (y_46_im <= 9.5e-125) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 2.7e+56) {
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 {
tmp = fma((x_46_re / y_46_im), (y_46_re / y_46_im), (x_46_im / y_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -2.4e+97) tmp = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_im <= -2.6e-103) tmp = Float64(fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))); elseif (y_46_im <= 9.5e-125) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 2.7e+56) 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))); else tmp = fma(Float64(x_46_re / y_46_im), Float64(y_46_re / y_46_im), Float64(x_46_im / y_46_im)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.4e+97], N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -2.6e-103], N[(N[(y$46$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9.5e-125], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.7e+56], 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], N[(N[(x$46$re / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision] + N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.4 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-103}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.im \leq 9.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 2.7 \cdot 10^{+56}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x.re}{y.im}, \frac{y.re}{y.im}, \frac{x.im}{y.im}\right)\\
\end{array}
\end{array}
if y.im < -2.4e97Initial program 40.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-/.f6487.8
Applied rewrites87.8%
if -2.4e97 < y.im < -2.59999999999999996e-103Initial program 67.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6467.7
Applied rewrites67.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.7
Applied rewrites67.7%
if -2.59999999999999996e-103 < y.im < 9.50000000000000031e-125Initial program 65.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
if 9.50000000000000031e-125 < y.im < 2.7000000000000001e56Initial program 85.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.1
Applied rewrites85.1%
if 2.7000000000000001e56 < y.im Initial program 37.2%
Taylor expanded in y.re around 0
+-commutativeN/A
pow2N/A
times-fracN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.re x.re (* y.im x.im)) (* y.im y.im)))
(t_1 (/ (fma x.im (/ y.im y.re) x.re) y.re)))
(if (<= y.im -2.2e+97)
(/ x.im y.im)
(if (<= y.im -13000000.0)
t_1
(if (<= y.im -1.95e-95)
t_0
(if (<= y.im 7.2e-67)
t_1
(if (<= y.im 1.8e+134) 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 = fma(y_46_re, x_46_re, (y_46_im * x_46_im)) / (y_46_im * y_46_im);
double t_1 = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
double tmp;
if (y_46_im <= -2.2e+97) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= -13000000.0) {
tmp = t_1;
} else if (y_46_im <= -1.95e-95) {
tmp = t_0;
} else if (y_46_im <= 7.2e-67) {
tmp = t_1;
} else if (y_46_im <= 1.8e+134) {
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(fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im)) / Float64(y_46_im * y_46_im)) t_1 = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re) tmp = 0.0 if (y_46_im <= -2.2e+97) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= -13000000.0) tmp = t_1; elseif (y_46_im <= -1.95e-95) tmp = t_0; elseif (y_46_im <= 7.2e-67) tmp = t_1; elseif (y_46_im <= 1.8e+134) 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$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$im, -2.2e+97], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -13000000.0], t$95$1, If[LessEqual[y$46$im, -1.95e-95], t$95$0, If[LessEqual[y$46$im, 7.2e-67], t$95$1, If[LessEqual[y$46$im, 1.8e+134], t$95$0, N[(x$46$im / y$46$im), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)}{y.im \cdot y.im}\\
t_1 := \frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{if}\;y.im \leq -2.2 \cdot 10^{+97}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq -13000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq -1.95 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 7.2 \cdot 10^{-67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 1.8 \cdot 10^{+134}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -2.2000000000000001e97 or 1.79999999999999994e134 < y.im Initial program 34.0%
Taylor expanded in y.re around 0
lower-/.f6480.8
Applied rewrites80.8%
if -2.2000000000000001e97 < y.im < -1.3e7 or -1.95e-95 < y.im < 7.19999999999999998e-67Initial program 66.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6484.4
Applied rewrites84.4%
if -1.3e7 < y.im < -1.95e-95 or 7.19999999999999998e-67 < y.im < 1.79999999999999994e134Initial program 76.4%
Taylor expanded in y.re around 0
pow2N/A
lift-*.f6467.6
Applied rewrites67.6%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.6
Applied rewrites67.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -2.4e+97)
(/ (fma y.re (/ x.re y.im) x.im) y.im)
(if (<= y.im -2.6e-103)
(/ (fma y.re x.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))
(if (<= y.im 9.5e-125)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 2.7e+56)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(/ (fma x.re (/ y.re y.im) x.im) y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -2.4e+97) {
tmp = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_im <= -2.6e-103) {
tmp = fma(y_46_re, x_46_re, (y_46_im * x_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
} else if (y_46_im <= 9.5e-125) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 2.7e+56) {
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 {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -2.4e+97) tmp = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_im <= -2.6e-103) tmp = Float64(fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))); elseif (y_46_im <= 9.5e-125) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 2.7e+56) 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))); else tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.4e+97], N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -2.6e-103], N[(N[(y$46$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9.5e-125], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.7e+56], 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], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -2.4 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-103}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.im \leq 9.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 2.7 \cdot 10^{+56}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\end{array}
\end{array}
if y.im < -2.4e97Initial program 40.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-/.f6487.8
Applied rewrites87.8%
if -2.4e97 < y.im < -2.59999999999999996e-103Initial program 67.6%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6467.7
Applied rewrites67.7%
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.7
Applied rewrites67.7%
if -2.59999999999999996e-103 < y.im < 9.50000000000000031e-125Initial program 65.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
if 9.50000000000000031e-125 < y.im < 2.7000000000000001e56Initial program 85.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.1
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6485.1
Applied rewrites85.1%
if 2.7000000000000001e56 < y.im Initial program 37.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
(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)))))
(if (<= y.im -2.4e+97)
(/ (fma y.re (/ x.re y.im) x.im) y.im)
(if (<= y.im -2.6e-103)
t_0
(if (<= y.im 9.5e-125)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 2.7e+56) t_0 (/ (fma x.re (/ y.re y.im) 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 = 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 tmp;
if (y_46_im <= -2.4e+97) {
tmp = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_im <= -2.6e-103) {
tmp = t_0;
} else if (y_46_im <= 9.5e-125) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 2.7e+56) {
tmp = t_0;
} else {
tmp = fma(x_46_re, (y_46_re / y_46_im), 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(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))) tmp = 0.0 if (y_46_im <= -2.4e+97) tmp = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_im <= -2.6e-103) tmp = t_0; elseif (y_46_im <= 9.5e-125) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 2.7e+56) tmp = t_0; else tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), 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 * 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.4e+97], N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -2.6e-103], t$95$0, If[LessEqual[y$46$im, 9.5e-125], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.7e+56], t$95$0, N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]]]]]]
\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)}\\
\mathbf{if}\;y.im \leq -2.4 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-103}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 9.5 \cdot 10^{-125}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 2.7 \cdot 10^{+56}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\end{array}
\end{array}
if y.im < -2.4e97Initial program 40.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-/.f6487.8
Applied rewrites87.8%
if -2.4e97 < y.im < -2.59999999999999996e-103 or 9.50000000000000031e-125 < y.im < 2.7000000000000001e56Initial program 75.1%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.1
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6475.1
Applied rewrites75.1%
if -2.59999999999999996e-103 < y.im < 9.50000000000000031e-125Initial program 65.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
if 2.7000000000000001e56 < y.im Initial program 37.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6488.6
Applied rewrites88.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -1.95e-95) (not (<= y.im 7.2e-67))) (/ (fma x.re (/ y.re y.im) x.im) y.im) (/ (fma x.im (/ y.im y.re) 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 <= -1.95e-95) || !(y_46_im <= 7.2e-67)) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else {
tmp = fma(x_46_im, (y_46_im / y_46_re), 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 <= -1.95e-95) || !(y_46_im <= 7.2e-67)) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); else tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), 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, -1.95e-95], N[Not[LessEqual[y$46$im, 7.2e-67]], $MachinePrecision]], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.95 \cdot 10^{-95} \lor \neg \left(y.im \leq 7.2 \cdot 10^{-67}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.im < -1.95e-95 or 7.19999999999999998e-67 < y.im Initial program 51.6%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
if -1.95e-95 < y.im < 7.19999999999999998e-67Initial program 69.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6489.5
Applied rewrites89.5%
Final simplification80.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.95e-95)
(/ (fma x.re (/ y.re y.im) x.im) y.im)
(if (<= y.im 3.3e-66)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(/ (fma y.re (/ x.re y.im) x.im) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -1.95e-95) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_im <= 3.3e-66) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else {
tmp = fma(y_46_re, (x_46_re / y_46_im), x_46_im) / y_46_im;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -1.95e-95) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_im <= 3.3e-66) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); else tmp = Float64(fma(y_46_re, Float64(x_46_re / y_46_im), x_46_im) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -1.95e-95], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 3.3e-66], N[(N[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(y$46$re * N[(x$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.95 \cdot 10^{-95}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.im \leq 3.3 \cdot 10^{-66}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.re}{y.im}, x.im\right)}{y.im}\\
\end{array}
\end{array}
if y.im < -1.95e-95Initial program 53.3%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6470.9
Applied rewrites70.9%
if -1.95e-95 < y.im < 3.2999999999999999e-66Initial program 69.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6489.5
Applied rewrites89.5%
if 3.2999999999999999e-66 < y.im Initial program 49.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6482.0
Applied rewrites82.0%
lift-/.f64N/A
lift-/.f64N/A
lift-fma.f64N/A
div-addN/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
div-add-revN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-/.f6482.0
Applied rewrites82.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -1.16e+25) (not (<= y.re 4.4e+74))) (/ x.re y.re) (/ x.im y.im)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -1.16e+25) || !(y_46_re <= 4.4e+74)) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / y_46_im;
}
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_46re <= (-1.16d+25)) .or. (.not. (y_46re <= 4.4d+74))) then
tmp = x_46re / y_46re
else
tmp = x_46im / y_46im
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_re <= -1.16e+25) || !(y_46_re <= 4.4e+74)) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -1.16e+25) or not (y_46_re <= 4.4e+74): tmp = x_46_re / y_46_re else: tmp = x_46_im / y_46_im return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -1.16e+25) || !(y_46_re <= 4.4e+74)) tmp = Float64(x_46_re / y_46_re); else tmp = Float64(x_46_im / y_46_im); 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_re <= -1.16e+25) || ~((y_46_re <= 4.4e+74))) tmp = x_46_re / y_46_re; else tmp = x_46_im / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -1.16e+25], N[Not[LessEqual[y$46$re, 4.4e+74]], $MachinePrecision]], N[(x$46$re / y$46$re), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.16 \cdot 10^{+25} \lor \neg \left(y.re \leq 4.4 \cdot 10^{+74}\right):\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.re < -1.15999999999999992e25 or 4.4000000000000002e74 < y.re Initial program 44.3%
Taylor expanded in y.re around inf
lower-/.f6469.6
Applied rewrites69.6%
if -1.15999999999999992e25 < y.re < 4.4000000000000002e74Initial program 67.3%
Taylor expanded in y.re around 0
lower-/.f6465.0
Applied rewrites65.0%
Final simplification66.9%
(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 57.9%
Taylor expanded in y.re around 0
lower-/.f6446.1
Applied rewrites46.1%
herbie shell --seed 2025076
(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))))