
(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 y.im y.im (* y.re y.re))))
(if (<= y.re -1.32e+75)
(/ (fma (/ x.im y.re) y.im x.re) y.re)
(if (<= y.re -2.15e-119)
(/ (fma y.im x.im (* y.re x.re)) t_0)
(if (<= y.re 1.9e-52)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.re 3.9e+151)
(fma x.re (/ y.re t_0) (* y.im (/ x.im t_0)))
(fma
(/ (/ (fma (- x.re) (/ y.im y.re) x.im) y.re) 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 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double tmp;
if (y_46_re <= -1.32e+75) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else if (y_46_re <= -2.15e-119) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / t_0;
} else if (y_46_re <= 1.9e-52) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_re <= 3.9e+151) {
tmp = fma(x_46_re, (y_46_re / t_0), (y_46_im * (x_46_im / t_0)));
} else {
tmp = fma(((fma(-x_46_re, (y_46_im / y_46_re), x_46_im) / y_46_re) / 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 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) tmp = 0.0 if (y_46_re <= -1.32e+75) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); elseif (y_46_re <= -2.15e-119) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / t_0); elseif (y_46_re <= 1.9e-52) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_re <= 3.9e+151) tmp = fma(x_46_re, Float64(y_46_re / t_0), Float64(y_46_im * Float64(x_46_im / t_0))); else tmp = fma(Float64(Float64(fma(Float64(-x_46_re), Float64(y_46_im / y_46_re), x_46_im) / y_46_re) / 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[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.32e+75], 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$re, -2.15e-119], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.9e-52], 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$re, 3.9e+151], N[(x$46$re * N[(y$46$re / t$95$0), $MachinePrecision] + N[(y$46$im * N[(x$46$im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[((-x$46$re) * N[(y$46$im / y$46$re), $MachinePrecision] + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision] * y$46$im + N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -1.32 \cdot 10^{+75}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{elif}\;y.re \leq -2.15 \cdot 10^{-119}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{t\_0}\\
\mathbf{elif}\;y.re \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{fma}\left(x.re, \frac{y.re}{t\_0}, y.im \cdot \frac{x.im}{t\_0}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{\mathsf{fma}\left(-x.re, \frac{y.im}{y.re}, x.im\right)}{y.re}}{y.re}, y.im, \frac{x.re}{y.re}\right)\\
\end{array}
\end{array}
if y.re < -1.3200000000000001e75Initial program 30.6%
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-/.f6481.4
Applied rewrites81.4%
if -1.3200000000000001e75 < y.re < -2.15e-119Initial program 83.0%
Applied rewrites83.0%
if -2.15e-119 < y.re < 1.9000000000000002e-52Initial program 70.4%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-*l/N/A
associate-*l/N/A
unpow2N/A
associate-/r*N/A
div-addN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.0
Applied rewrites93.0%
if 1.9000000000000002e-52 < y.re < 3.89999999999999976e151Initial program 75.2%
Applied rewrites85.5%
if 3.89999999999999976e151 < y.re Initial program 31.7%
Taylor expanded in y.re around inf
Applied rewrites93.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma y.im y.im (* y.re y.re)))
(t_1 (/ (fma (/ x.im y.re) y.im x.re) y.re)))
(if (<= y.re -1.32e+75)
t_1
(if (<= y.re -2.15e-119)
(/ (fma y.im x.im (* y.re x.re)) t_0)
(if (<= y.re 1.9e-52)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.re 3.9e+151)
(fma x.re (/ y.re t_0) (* y.im (/ x.im 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, y_46_im, (y_46_re * y_46_re));
double t_1 = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -1.32e+75) {
tmp = t_1;
} else if (y_46_re <= -2.15e-119) {
tmp = fma(y_46_im, x_46_im, (y_46_re * x_46_re)) / t_0;
} else if (y_46_re <= 1.9e-52) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_re <= 3.9e+151) {
tmp = fma(x_46_re, (y_46_re / t_0), (y_46_im * (x_46_im / t_0)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)) t_1 = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -1.32e+75) tmp = t_1; elseif (y_46_re <= -2.15e-119) tmp = Float64(fma(y_46_im, x_46_im, Float64(y_46_re * x_46_re)) / t_0); elseif (y_46_re <= 1.9e-52) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_re <= 3.9e+151) tmp = fma(x_46_re, Float64(y_46_re / t_0), Float64(y_46_im * Float64(x_46_im / 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[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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$re, -1.32e+75], t$95$1, If[LessEqual[y$46$re, -2.15e-119], N[(N[(y$46$im * x$46$im + N[(y$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.9e-52], 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$re, 3.9e+151], N[(x$46$re * N[(y$46$re / t$95$0), $MachinePrecision] + N[(y$46$im * N[(x$46$im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -1.32 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq -2.15 \cdot 10^{-119}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y.im, x.im, y.re \cdot x.re\right)}{t\_0}\\
\mathbf{elif}\;y.re \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{fma}\left(x.re, \frac{y.re}{t\_0}, y.im \cdot \frac{x.im}{t\_0}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.re < -1.3200000000000001e75 or 3.89999999999999976e151 < y.re Initial program 31.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-/.f6484.2
Applied rewrites84.2%
if -1.3200000000000001e75 < y.re < -2.15e-119Initial program 83.0%
Applied rewrites83.0%
if -2.15e-119 < y.re < 1.9000000000000002e-52Initial program 70.4%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-*l/N/A
associate-*l/N/A
unpow2N/A
associate-/r*N/A
div-addN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.0
Applied rewrites93.0%
if 1.9000000000000002e-52 < y.re < 3.89999999999999976e151Initial program 75.2%
Applied rewrites85.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.im y.re) y.im x.re) y.re)))
(if (<= y.re -1.32e+75)
t_0
(if (<= y.re -2.15e-119)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(if (<= y.re 5.2e-93)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.re 9e+93)
(/ (+ (* 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_im / y_46_re), y_46_im, x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -1.32e+75) {
tmp = t_0;
} else if (y_46_re <= -2.15e-119) {
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_re <= 5.2e-93) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_re <= 9e+93) {
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_im / y_46_re), y_46_im, x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -1.32e+75) tmp = t_0; elseif (y_46_re <= -2.15e-119) 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_re <= 5.2e-93) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_re <= 9e+93) 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$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.32e+75], t$95$0, If[LessEqual[y$46$re, -2.15e-119], 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$re, 5.2e-93], 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$re, 9e+93], 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.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -1.32 \cdot 10^{+75}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq -2.15 \cdot 10^{-119}:\\
\;\;\;\;\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.re \leq 5.2 \cdot 10^{-93}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 9 \cdot 10^{+93}:\\
\;\;\;\;\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.re < -1.3200000000000001e75 or 8.99999999999999981e93 < y.re Initial program 34.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-/.f6482.5
Applied rewrites82.5%
if -1.3200000000000001e75 < y.re < -2.15e-119Initial program 83.0%
Applied rewrites83.0%
if -2.15e-119 < y.re < 5.1999999999999997e-93Initial program 69.9%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-*l/N/A
associate-*l/N/A
unpow2N/A
associate-/r*N/A
div-addN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
if 5.1999999999999997e-93 < y.re < 8.99999999999999981e93Initial program 85.0%
(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.im y.re) y.im x.re) y.re)))
(if (<= y.re -1.32e+75)
t_1
(if (<= y.re -2.15e-119)
t_0
(if (<= y.re 5.2e-93)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.re 9e+93) 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_im / y_46_re), y_46_im, x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -1.32e+75) {
tmp = t_1;
} else if (y_46_re <= -2.15e-119) {
tmp = t_0;
} else if (y_46_re <= 5.2e-93) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_re <= 9e+93) {
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_im / y_46_re), y_46_im, x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -1.32e+75) tmp = t_1; elseif (y_46_re <= -2.15e-119) tmp = t_0; elseif (y_46_re <= 5.2e-93) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_re <= 9e+93) 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$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.32e+75], t$95$1, If[LessEqual[y$46$re, -2.15e-119], t$95$0, If[LessEqual[y$46$re, 5.2e-93], 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$re, 9e+93], 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.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -1.32 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq -2.15 \cdot 10^{-119}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 5.2 \cdot 10^{-93}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 9 \cdot 10^{+93}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.re < -1.3200000000000001e75 or 8.99999999999999981e93 < y.re Initial program 34.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-/.f6482.5
Applied rewrites82.5%
if -1.3200000000000001e75 < y.re < -2.15e-119 or 5.1999999999999997e-93 < y.re < 8.99999999999999981e93Initial program 84.2%
Applied rewrites84.2%
if -2.15e-119 < y.re < 5.1999999999999997e-93Initial program 69.9%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-*l/N/A
associate-*l/N/A
unpow2N/A
associate-/r*N/A
div-addN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6493.5
Applied rewrites93.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.4e-88)
(/ x.re y.re)
(if (<= y.re 1.42e-99)
(/ x.im y.im)
(if (<= y.re 3.5e+106)
(* (/ x.re (fma y.im y.im (* y.re y.re))) y.re)
(if (<= y.re 4.8e+165)
(* (/ (/ x.im y.re) 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 <= -1.4e-88) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 1.42e-99) {
tmp = x_46_im / y_46_im;
} else if (y_46_re <= 3.5e+106) {
tmp = (x_46_re / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * y_46_re;
} else if (y_46_re <= 4.8e+165) {
tmp = ((x_46_im / y_46_re) / y_46_re) * 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_re <= -1.4e-88) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 1.42e-99) tmp = Float64(x_46_im / y_46_im); elseif (y_46_re <= 3.5e+106) tmp = Float64(Float64(x_46_re / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * y_46_re); elseif (y_46_re <= 4.8e+165) tmp = Float64(Float64(Float64(x_46_im / y_46_re) / y_46_re) * y_46_im); else tmp = 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, -1.4e-88], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 1.42e-99], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 3.5e+106], N[(N[(x$46$re / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 4.8e+165], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-88}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 1.42 \cdot 10^{-99}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.re \leq 3.5 \cdot 10^{+106}:\\
\;\;\;\;\frac{x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.re\\
\mathbf{elif}\;y.re \leq 4.8 \cdot 10^{+165}:\\
\;\;\;\;\frac{\frac{x.im}{y.re}}{y.re} \cdot y.im\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -1.39999999999999988e-88 or 4.80000000000000001e165 < y.re Initial program 41.8%
Taylor expanded in y.re around inf
lower-/.f6468.5
Applied rewrites68.5%
if -1.39999999999999988e-88 < y.re < 1.42e-99Initial program 70.0%
Taylor expanded in y.re around 0
lower-/.f6480.8
Applied rewrites80.8%
if 1.42e-99 < y.re < 3.49999999999999981e106Initial program 82.7%
Taylor expanded in x.re around inf
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.3
Applied rewrites57.3%
if 3.49999999999999981e106 < y.re < 4.80000000000000001e165Initial program 47.1%
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-/.f6470.3
Applied rewrites70.3%
Taylor expanded in x.re around 0
Applied rewrites63.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.im y.re) y.im x.re) y.re)))
(if (<= y.re -1.4e-88)
t_0
(if (<= y.re 3.8e-101)
(/ x.im y.im)
(if (<= y.re 1.4e+89)
(/ (* x.re y.re) (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_im / y_46_re), y_46_im, x_46_re) / y_46_re;
double tmp;
if (y_46_re <= -1.4e-88) {
tmp = t_0;
} else if (y_46_re <= 3.8e-101) {
tmp = x_46_im / y_46_im;
} else if (y_46_re <= 1.4e+89) {
tmp = (x_46_re * y_46_re) / 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 = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re) tmp = 0.0 if (y_46_re <= -1.4e-88) tmp = t_0; elseif (y_46_re <= 3.8e-101) tmp = Float64(x_46_im / y_46_im); elseif (y_46_re <= 1.4e+89) tmp = Float64(Float64(x_46_re * y_46_re) / 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[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.4e-88], t$95$0, If[LessEqual[y$46$re, 3.8e-101], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.4e+89], N[(N[(x$46$re * y$46$re), $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 := \frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-88}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{-101}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.re \leq 1.4 \cdot 10^{+89}:\\
\;\;\;\;\frac{x.re \cdot y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.39999999999999988e-88 or 1.3999999999999999e89 < y.re Initial program 42.3%
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-/.f6476.9
Applied rewrites76.9%
if -1.39999999999999988e-88 < y.re < 3.8000000000000001e-101Initial program 70.0%
Taylor expanded in y.re around 0
lower-/.f6480.8
Applied rewrites80.8%
if 3.8000000000000001e-101 < y.re < 1.3999999999999999e89Initial program 86.1%
Applied rewrites86.1%
Taylor expanded in x.re around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.9
Applied rewrites60.9%
Applied rewrites60.9%
Final simplification75.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.4e-88)
(/ x.re y.re)
(if (<= y.re 3.8e-101)
(/ x.im y.im)
(if (<= y.re 1.28e+154)
(* (/ y.re (fma y.re y.re (* y.im y.im))) x.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_re <= -1.4e-88) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 3.8e-101) {
tmp = x_46_im / y_46_im;
} else if (y_46_re <= 1.28e+154) {
tmp = (y_46_re / fma(y_46_re, y_46_re, (y_46_im * y_46_im))) * x_46_re;
} 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_re <= -1.4e-88) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 3.8e-101) tmp = Float64(x_46_im / y_46_im); elseif (y_46_re <= 1.28e+154) tmp = Float64(Float64(y_46_re / fma(y_46_re, y_46_re, Float64(y_46_im * y_46_im))) * x_46_re); else tmp = 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, -1.4e-88], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 3.8e-101], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.28e+154], N[(N[(y$46$re / N[(y$46$re * y$46$re + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-88}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{-101}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.re \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;\frac{y.re}{\mathsf{fma}\left(y.re, y.re, y.im \cdot y.im\right)} \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -1.39999999999999988e-88 or 1.2800000000000001e154 < y.re Initial program 41.4%
Taylor expanded in y.re around inf
lower-/.f6467.8
Applied rewrites67.8%
if -1.39999999999999988e-88 < y.re < 3.8000000000000001e-101Initial program 70.0%
Taylor expanded in y.re around 0
lower-/.f6480.8
Applied rewrites80.8%
if 3.8000000000000001e-101 < y.re < 1.2800000000000001e154Initial program 75.9%
Applied rewrites75.9%
Taylor expanded in x.re around inf
*-commutativeN/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
unpow2N/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6457.6
Applied rewrites57.6%
Final simplification70.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.4e-88)
(/ x.re y.re)
(if (<= y.re 4.6e-52)
(/ x.im y.im)
(if (<= y.re 2.9e+153)
(* (/ x.im (fma y.im y.im (* y.re 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 <= -1.4e-88) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 4.6e-52) {
tmp = x_46_im / y_46_im;
} else if (y_46_re <= 2.9e+153) {
tmp = (x_46_im / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * 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_re <= -1.4e-88) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 4.6e-52) tmp = Float64(x_46_im / y_46_im); elseif (y_46_re <= 2.9e+153) tmp = Float64(Float64(x_46_im / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * y_46_im); else tmp = 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, -1.4e-88], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 4.6e-52], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 2.9e+153], 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], N[(x$46$re / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-88}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 4.6 \cdot 10^{-52}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.re \leq 2.9 \cdot 10^{+153}:\\
\;\;\;\;\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.im\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -1.39999999999999988e-88 or 2.90000000000000002e153 < y.re Initial program 41.4%
Taylor expanded in y.re around inf
lower-/.f6467.8
Applied rewrites67.8%
if -1.39999999999999988e-88 < y.re < 4.59999999999999989e-52Initial program 71.3%
Taylor expanded in y.re around 0
lower-/.f6477.8
Applied rewrites77.8%
if 4.59999999999999989e-52 < y.re < 2.90000000000000002e153Initial program 73.8%
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-*.f6450.2
Applied rewrites50.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -4.8e-15) (not (<= y.re 2.1e+96))) (/ (fma (/ x.im y.re) y.im x.re) y.re) (/ (fma (/ x.re y.im) 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 <= -4.8e-15) || !(y_46_re <= 2.1e+96)) {
tmp = fma((x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re;
} else {
tmp = fma((x_46_re / y_46_im), y_46_re, 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 <= -4.8e-15) || !(y_46_re <= 2.1e+96)) tmp = Float64(fma(Float64(x_46_im / y_46_re), y_46_im, x_46_re) / y_46_re); else tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -4.8e-15], N[Not[LessEqual[y$46$re, 2.1e+96]], $MachinePrecision]], N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im + x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.8 \cdot 10^{-15} \lor \neg \left(y.re \leq 2.1 \cdot 10^{+96}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.im}{y.re}, y.im, x.re\right)}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\end{array}
\end{array}
if y.re < -4.7999999999999999e-15 or 2.1000000000000001e96 < y.re Initial program 37.9%
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-/.f6480.9
Applied rewrites80.9%
if -4.7999999999999999e-15 < y.re < 2.1000000000000001e96Initial program 75.2%
Taylor expanded in y.re around 0
+-commutativeN/A
associate-*l/N/A
associate-*l/N/A
unpow2N/A
associate-/r*N/A
div-addN/A
+-commutativeN/A
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f6481.7
Applied rewrites81.7%
Final simplification81.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -1.4e-88) (not (<= y.re 2.8e+89))) (/ 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.4e-88) || !(y_46_re <= 2.8e+89)) {
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.4d-88)) .or. (.not. (y_46re <= 2.8d+89))) 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.4e-88) || !(y_46_re <= 2.8e+89)) {
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.4e-88) or not (y_46_re <= 2.8e+89): 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.4e-88) || !(y_46_re <= 2.8e+89)) 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.4e-88) || ~((y_46_re <= 2.8e+89))) 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.4e-88], N[Not[LessEqual[y$46$re, 2.8e+89]], $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.4 \cdot 10^{-88} \lor \neg \left(y.re \leq 2.8 \cdot 10^{+89}\right):\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.re < -1.39999999999999988e-88 or 2.7999999999999998e89 < y.re Initial program 42.3%
Taylor expanded in y.re around inf
lower-/.f6464.5
Applied rewrites64.5%
if -1.39999999999999988e-88 < y.re < 2.7999999999999998e89Initial program 74.6%
Taylor expanded in y.re around 0
lower-/.f6468.4
Applied rewrites68.4%
Final simplification66.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 60.3%
Taylor expanded in y.re around 0
lower-/.f6447.2
Applied rewrites47.2%
herbie shell --seed 2024364
(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))))