
(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 10 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.re x.re (* y.im x.im))))
(if (<=
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
INFINITY)
(/ 1.0 (fma (/ y.re t_0) y.re (* (/ y.im t_0) y.im)))
(/ (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 t_0 = fma(y_46_re, x_46_re, (y_46_im * x_46_im));
double tmp;
if ((((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= ((double) INFINITY)) {
tmp = 1.0 / fma((y_46_re / t_0), y_46_re, ((y_46_im / t_0) * y_46_im));
} 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) t_0 = fma(y_46_re, x_46_re, Float64(y_46_im * x_46_im)) tmp = 0.0 if (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))) <= Inf) tmp = Float64(1.0 / fma(Float64(y_46_re / t_0), y_46_re, Float64(Float64(y_46_im / t_0) * y_46_im))); 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_] := Block[{t$95$0 = N[(y$46$re * x$46$re + N[(y$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(1.0 / N[(N[(y$46$re / t$95$0), $MachinePrecision] * y$46$re + N[(N[(y$46$im / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \mathsf{fma}\left(y.re, x.re, y.im \cdot x.im\right)\\
\mathbf{if}\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{y.re}{t\_0}, y.re, \frac{y.im}{t\_0} \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < +inf.0Initial program 61.8%
Applied rewrites61.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
div-addN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites75.0%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-outN/A
*-lft-identityN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.0
Applied rewrites75.0%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
fp-cancel-sign-sub-invN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-outN/A
*-lft-identityN/A
distribute-lft-neg-outN/A
metadata-evalN/A
distribute-lft-neg-outN/A
metadata-evalN/A
*-lft-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.0
Applied rewrites75.0%
if +inf.0 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (fma x.im y.im (* x.re y.re))))
(if (<=
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))
INFINITY)
(/ 1.0 (fma (/ y.re t_0) y.re (* (/ y.im t_0) y.im)))
(/ (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 t_0 = fma(x_46_im, y_46_im, (x_46_re * y_46_re));
double tmp;
if ((((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))) <= ((double) INFINITY)) {
tmp = 1.0 / fma((y_46_re / t_0), y_46_re, ((y_46_im / t_0) * y_46_im));
} 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) t_0 = fma(x_46_im, y_46_im, Float64(x_46_re * y_46_re)) tmp = 0.0 if (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))) <= Inf) tmp = Float64(1.0 / fma(Float64(y_46_re / t_0), y_46_re, Float64(Float64(y_46_im / t_0) * y_46_im))); 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_] := Block[{t$95$0 = N[(x$46$im * y$46$im + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[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], Infinity], N[(1.0 / N[(N[(y$46$re / t$95$0), $MachinePrecision] * y$46$re + N[(N[(y$46$im / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \mathsf{fma}\left(x.im, y.im, x.re \cdot y.re\right)\\
\mathbf{if}\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \leq \infty:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{y.re}{t\_0}, y.re, \frac{y.im}{t\_0} \cdot y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < +inf.0Initial program 61.8%
Applied rewrites61.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
div-addN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites75.0%
if +inf.0 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
(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 (/ y.re t_0) x.re (* (/ x.im t_0) y.im)))
(t_2 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -1.02e+109)
t_2
(if (<= y.im -1.55e-139)
t_1
(if (<= y.im 2.2e-29)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.im 1.5e+92) t_1 t_2))))))
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((y_46_re / t_0), x_46_re, ((x_46_im / t_0) * y_46_im));
double t_2 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -1.02e+109) {
tmp = t_2;
} else if (y_46_im <= -1.55e-139) {
tmp = t_1;
} else if (y_46_im <= 2.2e-29) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_im <= 1.5e+92) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = fma(Float64(y_46_re / t_0), x_46_re, Float64(Float64(x_46_im / t_0) * y_46_im)) t_2 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -1.02e+109) tmp = t_2; elseif (y_46_im <= -1.55e-139) tmp = t_1; elseif (y_46_im <= 2.2e-29) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_im <= 1.5e+92) tmp = t_1; else tmp = t_2; 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[(y$46$re / t$95$0), $MachinePrecision] * x$46$re + N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.02e+109], t$95$2, If[LessEqual[y$46$im, -1.55e-139], t$95$1, If[LessEqual[y$46$im, 2.2e-29], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 1.5e+92], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \mathsf{fma}\left(\frac{y.re}{t\_0}, x.re, \frac{x.im}{t\_0} \cdot y.im\right)\\
t_2 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -1.02 \cdot 10^{+109}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq -1.55 \cdot 10^{-139}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 2.2 \cdot 10^{-29}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 1.5 \cdot 10^{+92}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y.im < -1.01999999999999994e109 or 1.50000000000000007e92 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
if -1.01999999999999994e109 < y.im < -1.55e-139 or 2.1999999999999999e-29 < y.im < 1.50000000000000007e92Initial program 61.8%
Applied rewrites61.7%
if -1.55e-139 < y.im < 2.1999999999999999e-29Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.1
Applied rewrites52.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.95e+130)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.re -1.6e-99)
(/ (fma y.re x.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))
(if (<= y.re 1.85e-155)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.re 3e+115)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re 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_re <= -2.95e+130) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_re <= -1.6e-99) {
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_re <= 1.85e-155) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_re <= 3e+115) {
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 = 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.95e+130) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_re <= -1.6e-99) 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_re <= 1.85e-155) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_re <= 3e+115) 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(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.95e+130], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.6e-99], 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$re, 1.85e-155], 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, 3e+115], 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[(x$46$re / y$46$re), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.95 \cdot 10^{+130}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.re \leq -1.6 \cdot 10^{-99}:\\
\;\;\;\;\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.re \leq 1.85 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 3 \cdot 10^{+115}:\\
\;\;\;\;\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{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -2.9499999999999999e130Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.1
Applied rewrites52.1%
if -2.9499999999999999e130 < y.re < -1.6e-99Initial program 61.8%
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
mult-flipN/A
sub-negateN/A
add-flipN/A
+-commutativeN/A
distribute-neg-inN/A
Applied rewrites61.8%
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f6461.8
Applied rewrites61.8%
if -1.6e-99 < y.re < 1.85e-155Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
if 1.85e-155 < y.re < 3e115Initial program 61.8%
Applied rewrites61.8%
if 3e115 < y.re Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f6442.7
Applied rewrites42.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))))
(if (<= y.re -2.95e+130)
(/ (+ x.re (/ (* x.im y.im) y.re)) y.re)
(if (<= y.re -1.6e-99)
t_0
(if (<= y.re 1.85e-155)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(if (<= y.re 3e+115) t_0 (/ 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, 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_re <= -2.95e+130) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else if (y_46_re <= -1.6e-99) {
tmp = t_0;
} else if (y_46_re <= 1.85e-155) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else if (y_46_re <= 3e+115) {
tmp = t_0;
} else {
tmp = 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(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_re <= -2.95e+130) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); elseif (y_46_re <= -1.6e-99) tmp = t_0; elseif (y_46_re <= 1.85e-155) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im); elseif (y_46_re <= 3e+115) tmp = t_0; 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_] := 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$re, -2.95e+130], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.6e-99], t$95$0, If[LessEqual[y$46$re, 1.85e-155], 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, 3e+115], t$95$0, N[(x$46$re / y$46$re), $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.re \leq -2.95 \cdot 10^{+130}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.re \leq -1.6 \cdot 10^{-99}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 1.85 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 3 \cdot 10^{+115}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -2.9499999999999999e130Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.1
Applied rewrites52.1%
if -2.9499999999999999e130 < y.re < -1.6e-99 or 1.85e-155 < y.re < 3e115Initial program 61.8%
Applied rewrites61.8%
if -1.6e-99 < y.re < 1.85e-155Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
if 3e115 < y.re Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f6442.7
Applied rewrites42.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im)))))
(if (<= t_0 -1e-271)
(/ (fma y.im x.im (* y.re x.re)) (fma y.im y.im (* y.re y.re)))
(if (<= t_0 0.0)
(/ 1.0 (fma (/ y.re (fma x.im y.im (* x.re y.re))) y.re (/ y.im x.im)))
(if (<= t_0 5e+271)
(/ (fma y.re x.re (* y.im x.im)) (fma y.re y.re (* y.im y.im)))
(/ (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 t_0 = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
double tmp;
if (t_0 <= -1e-271) {
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 (t_0 <= 0.0) {
tmp = 1.0 / fma((y_46_re / fma(x_46_im, y_46_im, (x_46_re * y_46_re))), y_46_re, (y_46_im / x_46_im));
} else if (t_0 <= 5e+271) {
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 {
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) t_0 = 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))) tmp = 0.0 if (t_0 <= -1e-271) 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 (t_0 <= 0.0) tmp = Float64(1.0 / fma(Float64(y_46_re / fma(x_46_im, y_46_im, Float64(x_46_re * y_46_re))), y_46_re, Float64(y_46_im / x_46_im))); elseif (t_0 <= 5e+271) 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))); 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_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -1e-271], 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[t$95$0, 0.0], N[(1.0 / N[(N[(y$46$re / N[(x$46$im * y$46$im + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y$46$re + N[(y$46$im / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+271], 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], 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}
t_0 := \frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-271}:\\
\;\;\;\;\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}\;t\_0 \leq 0:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\frac{y.re}{\mathsf{fma}\left(x.im, y.im, x.re \cdot y.re\right)}, y.re, \frac{y.im}{x.im}\right)}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+271}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\end{array}
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < -9.99999999999999963e-272Initial program 61.8%
Applied rewrites61.8%
if -9.99999999999999963e-272 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < -0.0Initial program 61.8%
Applied rewrites61.6%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
div-addN/A
+-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites75.0%
Taylor expanded in x.re around 0
lower-/.f6468.1
Applied rewrites68.1%
if -0.0 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 5.0000000000000003e271Initial program 61.8%
*-lft-identityN/A
metadata-evalN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
*-rgt-identityN/A
lft-mult-inverseN/A
associate-*l*N/A
mult-flipN/A
sub-negateN/A
add-flipN/A
+-commutativeN/A
distribute-neg-inN/A
Applied rewrites61.8%
lift-+.f64N/A
lift-*.f64N/A
lift-fma.f6461.8
Applied rewrites61.8%
if 5.0000000000000003e271 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma (/ x.re y.im) y.re x.im) y.im)))
(if (<= y.im -3e-72)
t_0
(if (<= y.im 1.25e+48) (/ (+ x.re (/ (* x.im y.im) y.re)) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
double tmp;
if (y_46_im <= -3e-72) {
tmp = t_0;
} else if (y_46_im <= 1.25e+48) {
tmp = (x_46_re + ((x_46_im * y_46_im) / y_46_re)) / y_46_re;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im) tmp = 0.0 if (y_46_im <= -3e-72) tmp = t_0; elseif (y_46_im <= 1.25e+48) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im * y_46_im) / y_46_re)) / y_46_re); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3e-72], t$95$0, If[LessEqual[y$46$im, 1.25e+48], N[(N[(x$46$re + N[(N[(x$46$im * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{if}\;y.im \leq -3 \cdot 10^{-72}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.25 \cdot 10^{+48}:\\
\;\;\;\;\frac{x.re + \frac{x.im \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -3e-72 or 1.24999999999999993e48 < y.im Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
if -3e-72 < y.im < 1.24999999999999993e48Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.1
Applied rewrites52.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -8500.0)
(/ x.re y.re)
(if (<= y.re 3.8e+74)
(/ (fma (/ x.re y.im) y.re x.im) y.im)
(/ x.re y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -8500.0) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 3.8e+74) {
tmp = fma((x_46_re / y_46_im), y_46_re, x_46_im) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -8500.0) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 3.8e+74) tmp = Float64(fma(Float64(x_46_re / y_46_im), y_46_re, x_46_im) / 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, -8500.0], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 3.8e+74], N[(N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re + x$46$im), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -8500:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 3.8 \cdot 10^{+74}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{x.re}{y.im}, y.re, x.im\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -8500 or 3.7999999999999998e74 < y.re Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f6442.7
Applied rewrites42.7%
if -8500 < y.re < 3.7999999999999998e74Initial program 61.8%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.7
Applied rewrites52.7%
Applied rewrites54.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.im -2.7e+44) (/ x.im y.im) (if (<= y.im 8.2e+46) (/ 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 <= -2.7e+44) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 8.2e+46) {
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 <= (-2.7d+44)) then
tmp = x_46im / y_46im
else if (y_46im <= 8.2d+46) 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 <= -2.7e+44) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 8.2e+46) {
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 <= -2.7e+44: tmp = x_46_im / y_46_im elif y_46_im <= 8.2e+46: 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 <= -2.7e+44) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 8.2e+46) 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 <= -2.7e+44) tmp = x_46_im / y_46_im; elseif (y_46_im <= 8.2e+46) 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, -2.7e+44], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 8.2e+46], 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 -2.7 \cdot 10^{+44}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 8.2 \cdot 10^{+46}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
\end{array}
if y.im < -2.7e44 or 8.19999999999999999e46 < y.im Initial program 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.0
Applied rewrites43.0%
if -2.7e44 < y.im < 8.19999999999999999e46Initial program 61.8%
Taylor expanded in y.re around inf
lower-/.f6442.7
Applied rewrites42.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 61.8%
Taylor expanded in y.re around 0
lower-/.f6443.0
Applied rewrites43.0%
herbie shell --seed 2025155
(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))))