
(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 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
(if (<= y.re -2.45e+131)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.re -5e-86)
(/ (+ (* x.re y.re) (* x.im y.im)) (fma y.re y.re (* y.im y.im)))
(if (<= y.re 6.8e-149)
(/ (fma x.re (/ y.re y.im) x.im) y.im)
(if (<= y.re 5.9e+91)
(*
(/ (fma x.re (/ y.re x.im) y.im) (fma y.im y.im (* y.re y.re)))
x.im)
(/ (- (* (/ 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_re <= -2.45e+131) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_re <= -5e-86) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
} else if (y_46_re <= 6.8e-149) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_re <= 5.9e+91) {
tmp = (fma(x_46_re, (y_46_re / x_46_im), y_46_im) / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * x_46_im;
} else {
tmp = (((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_re <= -2.45e+131) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_re <= -5e-86) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))); elseif (y_46_re <= 6.8e-149) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_re <= 5.9e+91) tmp = Float64(Float64(fma(x_46_re, Float64(y_46_re / x_46_im), y_46_im) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * x_46_im); else tmp = Float64(Float64(Float64(Float64(x_46_im / y_46_re) * y_46_im) - Float64(-x_46_re)) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -2.45e+131], 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$re, -5e-86], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$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$re, 6.8e-149], 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$re, 5.9e+91], N[(N[(N[(x$46$re * N[(y$46$re / x$46$im), $MachinePrecision] + y$46$im), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision], N[(N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision] - (-x$46$re)), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.45 \cdot 10^{+131}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.re \leq -5 \cdot 10^{-86}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{elif}\;y.re \leq 6.8 \cdot 10^{-149}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 5.9 \cdot 10^{+91}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{x.im}, y.im\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot x.im\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x.im}{y.re} \cdot y.im - \left(-x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.re < -2.45000000000000016e131Initial program 34.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6486.8
Applied rewrites86.8%
if -2.45000000000000016e131 < y.re < -4.9999999999999999e-86Initial program 74.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6474.5
Applied rewrites74.5%
if -4.9999999999999999e-86 < y.re < 6.7999999999999998e-149Initial program 71.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.6
Applied rewrites90.6%
if 6.7999999999999998e-149 < y.re < 5.9000000000000002e91Initial program 77.5%
Taylor expanded in x.im around inf
*-commutativeN/A
lower-*.f64N/A
associate-/r*N/A
div-add-revN/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6469.9
Applied rewrites69.9%
if 5.9000000000000002e91 < y.re Initial program 39.6%
Taylor expanded in y.re around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites65.6%
Taylor expanded in y.re around inf
div-subN/A
associate-*r/N/A
associate-*l/N/A
associate-*r/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-/.f64N/A
mul-1-negN/A
lift-neg.f6484.9
Applied rewrites84.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (+ (* x.re y.re) (* x.im y.im)) (fma y.re y.re (* y.im y.im)))))
(if (<= y.re -2.45e+131)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.re -5e-86)
t_0
(if (<= y.re 5.3e-145)
(/ (fma x.re (/ y.re y.im) x.im) y.im)
(if (<= y.re 4.9e+98)
t_0
(/ (- (* (/ 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 t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / fma(y_46_re, y_46_re, (y_46_im * y_46_im));
double tmp;
if (y_46_re <= -2.45e+131) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_re <= -5e-86) {
tmp = t_0;
} else if (y_46_re <= 5.3e-145) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else if (y_46_re <= 4.9e+98) {
tmp = t_0;
} else {
tmp = (((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) t_0 = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))) tmp = 0.0 if (y_46_re <= -2.45e+131) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_re <= -5e-86) tmp = t_0; elseif (y_46_re <= 5.3e-145) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); elseif (y_46_re <= 4.9e+98) tmp = t_0; else tmp = Float64(Float64(Float64(Float64(x_46_im / y_46_re) * y_46_im) - Float64(-x_46_re)) / y_46_re); 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$re), $MachinePrecision] + N[(x$46$im * y$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$re, -2.45e+131], 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$re, -5e-86], t$95$0, If[LessEqual[y$46$re, 5.3e-145], 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$re, 4.9e+98], t$95$0, N[(N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision] - (-x$46$re)), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.re \cdot y.re + x.im \cdot y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{if}\;y.re \leq -2.45 \cdot 10^{+131}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.re \leq -5 \cdot 10^{-86}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 5.3 \cdot 10^{-145}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 4.9 \cdot 10^{+98}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x.im}{y.re} \cdot y.im - \left(-x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.re < -2.45000000000000016e131Initial program 34.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6486.8
Applied rewrites86.8%
if -2.45000000000000016e131 < y.re < -4.9999999999999999e-86 or 5.29999999999999999e-145 < y.re < 4.89999999999999979e98Initial program 76.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6476.0
Applied rewrites76.0%
if -4.9999999999999999e-86 < y.re < 5.29999999999999999e-145Initial program 71.3%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6490.5
Applied rewrites90.5%
if 4.89999999999999979e98 < y.re Initial program 38.5%
Taylor expanded in y.re around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites65.5%
Taylor expanded in y.re around inf
div-subN/A
associate-*r/N/A
associate-*l/N/A
associate-*r/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-/.f64N/A
mul-1-negN/A
lift-neg.f6485.3
Applied rewrites85.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma (/ x.re y.im) (/ y.re y.im) (/ x.im y.im))))
(if (<= y.im -2.9e-11)
t_0
(if (<= y.im 2.7e-162)
(-
(/
(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 3e+153)
(/ (+ (* x.re y.re) (* x.im y.im)) (fma 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 / y_46_im), (x_46_im / y_46_im));
double tmp;
if (y_46_im <= -2.9e-11) {
tmp = t_0;
} else if (y_46_im <= 2.7e-162) {
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 <= 3e+153) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / fma(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 = fma(Float64(x_46_re / y_46_im), Float64(y_46_re / y_46_im), Float64(x_46_im / y_46_im)) tmp = 0.0 if (y_46_im <= -2.9e-11) tmp = t_0; elseif (y_46_im <= 2.7e-162) tmp = Float64(-Float64(fma(Float64(fma(y_46_im, x_46_im, Float64(-Float64(Float64(Float64(y_46_im * y_46_im) * x_46_re) / y_46_re))) / y_46_re), -1.0, Float64(-x_46_re)) / y_46_re)); elseif (y_46_im <= 3e+153) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / fma(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[(x$46$re / y$46$im), $MachinePrecision] * N[(y$46$re / y$46$im), $MachinePrecision] + N[(x$46$im / y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2.9e-11], t$95$0, If[LessEqual[y$46$im, 2.7e-162], (-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, 3e+153], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{x.re}{y.im}, \frac{y.re}{y.im}, \frac{x.im}{y.im}\right)\\
\mathbf{if}\;y.im \leq -2.9 \cdot 10^{-11}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 2.7 \cdot 10^{-162}:\\
\;\;\;\;-\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 3 \cdot 10^{+153}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -2.9e-11 or 3.00000000000000019e153 < y.im Initial program 43.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-/.f6480.3
Applied rewrites80.3%
if -2.9e-11 < y.im < 2.69999999999999984e-162Initial program 73.7%
Taylor expanded in y.re around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites85.9%
if 2.69999999999999984e-162 < y.im < 3.00000000000000019e153Initial program 74.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6474.4
Applied rewrites74.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.45e+129)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.re 130000000.0)
(/ (fma x.re (/ y.re y.im) x.im) y.im)
(/ (- (* (/ 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_re <= -2.45e+129) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_re <= 130000000.0) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_46_im) / y_46_im;
} else {
tmp = (((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_re <= -2.45e+129) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_re <= 130000000.0) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_46_im) / y_46_im); else tmp = Float64(Float64(Float64(Float64(x_46_im / y_46_re) * y_46_im) - Float64(-x_46_re)) / y_46_re); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -2.45e+129], 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$re, 130000000.0], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision] - (-x$46$re)), $MachinePrecision] / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.45 \cdot 10^{+129}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.re \leq 130000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x.im}{y.re} \cdot y.im - \left(-x.re\right)}{y.re}\\
\end{array}
\end{array}
if y.re < -2.45e129Initial program 34.7%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6486.4
Applied rewrites86.4%
if -2.45e129 < y.re < 1.3e8Initial program 73.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.6
Applied rewrites73.6%
if 1.3e8 < y.re Initial program 49.4%
Taylor expanded in y.re around -inf
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
Applied rewrites64.0%
Taylor expanded in y.re around inf
div-subN/A
associate-*r/N/A
associate-*l/N/A
associate-*r/N/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-*.f64N/A
lift-/.f64N/A
mul-1-negN/A
lift-neg.f6478.4
Applied rewrites78.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma x.im (/ y.im y.re) x.re) y.re)))
(if (<= y.re -2.45e+129)
t_0
(if (<= y.re 130000000.0) (/ (fma x.re (/ y.re y.im) x.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_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -2.45e+129) {
tmp = t_0;
} else if (y_46_re <= 130000000.0) {
tmp = fma(x_46_re, (y_46_re / y_46_im), x_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(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -2.45e+129) tmp = t_0; elseif (y_46_re <= 130000000.0) tmp = Float64(fma(x_46_re, Float64(y_46_re / y_46_im), x_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[(x$46$im * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -2.45e+129], t$95$0, If[LessEqual[y$46$re, 130000000.0], N[(N[(x$46$re * N[(y$46$re / y$46$im), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -2.45 \cdot 10^{+129}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 130000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re, \frac{y.re}{y.im}, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -2.45e129 or 1.3e8 < y.re Initial program 43.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6480.7
Applied rewrites80.7%
if -2.45e129 < y.re < 1.3e8Initial program 73.9%
Taylor expanded in y.im around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6473.6
Applied rewrites73.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -9.2e-11)
(/ x.im y.im)
(if (<= y.im 2e-21)
(/ (fma x.im (/ y.im y.re) x.re) y.re)
(if (<= y.im 3.5e+153)
(* x.im (/ y.im (fma y.im y.im (* y.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_im <= -9.2e-11) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2e-21) {
tmp = fma(x_46_im, (y_46_im / y_46_re), x_46_re) / y_46_re;
} else if (y_46_im <= 3.5e+153) {
tmp = x_46_im * (y_46_im / fma(y_46_im, y_46_im, (y_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_im <= -9.2e-11) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2e-21) tmp = Float64(fma(x_46_im, Float64(y_46_im / y_46_re), x_46_re) / y_46_re); elseif (y_46_im <= 3.5e+153) tmp = Float64(x_46_im * Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)))); 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_] := If[LessEqual[y$46$im, -9.2e-11], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2e-21], 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, 3.5e+153], N[(x$46$im * N[(y$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -9.2 \cdot 10^{-11}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, \frac{y.im}{y.re}, x.re\right)}{y.re}\\
\mathbf{elif}\;y.im \leq 3.5 \cdot 10^{+153}:\\
\;\;\;\;x.im \cdot \frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -9.20000000000000054e-11 or 3.4999999999999999e153 < y.im Initial program 43.2%
Taylor expanded in y.re around 0
lower-/.f6468.9
Applied rewrites68.9%
if -9.20000000000000054e-11 < y.im < 1.99999999999999982e-21Initial program 75.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
if 1.99999999999999982e-21 < y.im < 3.4999999999999999e153Initial program 70.5%
Taylor expanded in x.re around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6458.2
Applied rewrites58.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.25e-12)
(/ x.im y.im)
(if (<= y.im 2.95e-117)
(/ (fma y.im x.im (* y.re x.re)) (* y.re y.re))
(if (<= y.im 3.5e+153)
(* x.im (/ y.im (fma y.re y.re (* y.im 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.25e-12) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.95e-117) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / (y_46_re * y_46_re);
} else if (y_46_im <= 3.5e+153) {
tmp = x_46_im * (y_46_im / fma(y_46_re, y_46_re, (y_46_im * y_46_im)));
} 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_im <= -1.25e-12) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2.95e-117) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / Float64(y_46_re * y_46_re)); elseif (y_46_im <= 3.5e+153) tmp = Float64(x_46_im * Float64(y_46_im / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im)))); 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_] := If[LessEqual[y$46$im, -1.25e-12], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.95e-117], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 3.5e+153], N[(x$46$im * N[(y$46$im / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.25 \cdot 10^{-12}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2.95 \cdot 10^{-117}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{y.re \cdot y.re}\\
\mathbf{elif}\;y.im \leq 3.5 \cdot 10^{+153}:\\
\;\;\;\;x.im \cdot \frac{y.im}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.24999999999999992e-12 or 3.4999999999999999e153 < y.im Initial program 43.3%
Taylor expanded in y.re around 0
lower-/.f6468.7
Applied rewrites68.7%
if -1.24999999999999992e-12 < y.im < 2.9500000000000002e-117Initial program 74.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
Taylor expanded in y.re around 0
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f6464.6
Applied rewrites64.6%
if 2.9500000000000002e-117 < y.im < 3.4999999999999999e153Initial program 73.9%
Taylor expanded in x.re around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6454.9
Applied rewrites54.9%
lift-*.f64N/A
lift-fma.f64N/A
pow2N/A
pow2N/A
+-commutativeN/A
pow2N/A
pow2N/A
lift-fma.f64N/A
lift-*.f6454.9
Applied rewrites54.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.25e-12)
(/ x.im y.im)
(if (<= y.im 2.95e-117)
(/ (fma y.im x.im (* y.re x.re)) (* y.re y.re))
(if (<= y.im 3.5e+153)
(* x.im (/ y.im (fma y.im y.im (* y.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_im <= -1.25e-12) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2.95e-117) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / (y_46_re * y_46_re);
} else if (y_46_im <= 3.5e+153) {
tmp = x_46_im * (y_46_im / fma(y_46_im, y_46_im, (y_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_im <= -1.25e-12) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2.95e-117) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / Float64(y_46_re * y_46_re)); elseif (y_46_im <= 3.5e+153) tmp = Float64(x_46_im * Float64(y_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)))); 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_] := If[LessEqual[y$46$im, -1.25e-12], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2.95e-117], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 3.5e+153], N[(x$46$im * N[(y$46$im / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.25 \cdot 10^{-12}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2.95 \cdot 10^{-117}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{y.re \cdot y.re}\\
\mathbf{elif}\;y.im \leq 3.5 \cdot 10^{+153}:\\
\;\;\;\;x.im \cdot \frac{y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.24999999999999992e-12 or 3.4999999999999999e153 < y.im Initial program 43.3%
Taylor expanded in y.re around 0
lower-/.f6468.7
Applied rewrites68.7%
if -1.24999999999999992e-12 < y.im < 2.9500000000000002e-117Initial program 74.1%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6485.8
Applied rewrites85.8%
Taylor expanded in y.re around 0
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f6464.6
Applied rewrites64.6%
if 2.9500000000000002e-117 < y.im < 3.4999999999999999e153Initial program 73.9%
Taylor expanded in x.re around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
lift-*.f6454.9
Applied rewrites54.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -1.25e-12)
(/ x.im y.im)
(if (<= y.im 1.6e-21)
(/ (fma y.im x.im (* y.re x.re)) (* y.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_im <= -1.25e-12) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 1.6e-21) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / (y_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_im <= -1.25e-12) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 1.6e-21) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / Float64(y_46_re * y_46_re)); 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_] := If[LessEqual[y$46$im, -1.25e-12], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 1.6e-21], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -1.25 \cdot 10^{-12}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 1.6 \cdot 10^{-21}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{y.re \cdot y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.24999999999999992e-12 or 1.6000000000000001e-21 < y.im Initial program 50.4%
Taylor expanded in y.re around 0
lower-/.f6463.2
Applied rewrites63.2%
if -1.24999999999999992e-12 < y.im < 1.6000000000000001e-21Initial program 75.0%
Taylor expanded in y.re around inf
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6482.9
Applied rewrites82.9%
Taylor expanded in y.re around 0
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lower-*.f6462.1
Applied rewrites62.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -1.25e-11) (/ x.im y.im) (if (<= y.im 2e-21) (/ 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_im <= -1.25e-11) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2e-21) {
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_46im <= (-1.25d-11)) then
tmp = x_46im / y_46im
else if (y_46im <= 2d-21) 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_im <= -1.25e-11) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 2e-21) {
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_im <= -1.25e-11: tmp = x_46_im / y_46_im elif y_46_im <= 2e-21: 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_im <= -1.25e-11) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 2e-21) 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_im <= -1.25e-11) tmp = x_46_im / y_46_im; elseif (y_46_im <= 2e-21) 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[LessEqual[y$46$im, -1.25e-11], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 2e-21], 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.im \leq -1.25 \cdot 10^{-11}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 2 \cdot 10^{-21}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -1.25000000000000005e-11 or 1.99999999999999982e-21 < y.im Initial program 50.4%
Taylor expanded in y.re around 0
lower-/.f6463.3
Applied rewrites63.3%
if -1.25000000000000005e-11 < y.im < 1.99999999999999982e-21Initial program 75.0%
Taylor expanded in y.re around inf
lower-/.f6465.4
Applied rewrites65.4%
(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.3%
Taylor expanded in y.re around 0
lower-/.f6442.1
Applied rewrites42.1%
herbie shell --seed 2025101
(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))))