
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re 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_im * y_46_re) - (x_46_re * 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_46im * y_46re) - (x_46re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - Float64(x_46_re * 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_im * y_46_re) - (x_46_re * 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$im * y$46$re), $MachinePrecision] - N[(x$46$re * 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.im \cdot y.re - x.re \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.im y.re) (* x.re 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_im * y_46_re) - (x_46_re * 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_46im * y_46re) - (x_46re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - (x_46_re * 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_im * y_46_re) - Float64(x_46_re * 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_im * y_46_re) - (x_46_re * 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$im * y$46$re), $MachinePrecision] - N[(x$46$re * 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.im \cdot y.re - x.re \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 -3.8e+109)
(/ (- x.im (* (/ x.re y.re) y.im)) y.re)
(if (<= y.re -4.6e-113)
(- (* (/ x.im t_0) y.re) (* (/ x.re t_0) y.im))
(if (<= y.re 1.6e-111)
(/ (fma -1.0 x.re (/ (* x.im y.re) y.im)) y.im)
(if (<= y.re 9e+151)
(/ (- (* y.re x.im) (* y.im x.re)) t_0)
(/ x.im 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 <= -3.8e+109) {
tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= -4.6e-113) {
tmp = ((x_46_im / t_0) * y_46_re) - ((x_46_re / t_0) * y_46_im);
} else if (y_46_re <= 1.6e-111) {
tmp = fma(-1.0, x_46_re, ((x_46_im * y_46_re) / y_46_im)) / y_46_im;
} else if (y_46_re <= 9e+151) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / t_0;
} else {
tmp = x_46_im / 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 <= -3.8e+109) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re); elseif (y_46_re <= -4.6e-113) tmp = Float64(Float64(Float64(x_46_im / t_0) * y_46_re) - Float64(Float64(x_46_re / t_0) * y_46_im)); elseif (y_46_re <= 1.6e-111) tmp = Float64(fma(-1.0, x_46_re, Float64(Float64(x_46_im * y_46_re) / y_46_im)) / y_46_im); elseif (y_46_re <= 9e+151) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / t_0); else tmp = Float64(x_46_im / 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, -3.8e+109], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -4.6e-113], N[(N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[(x$46$re / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.6e-111], N[(N[(-1.0 * x$46$re + N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 9e+151], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(x$46$im / y$46$re), $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 -3.8 \cdot 10^{+109}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{elif}\;y.re \leq -4.6 \cdot 10^{-113}:\\
\;\;\;\;\frac{x.im}{t\_0} \cdot y.re - \frac{x.re}{t\_0} \cdot y.im\\
\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-111}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 9 \cdot 10^{+151}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -3.80000000000000039e109Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -3.80000000000000039e109 < y.re < -4.60000000000000016e-113Initial program 62.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites59.2%
if -4.60000000000000016e-113 < y.re < 1.5999999999999999e-111Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
if 1.5999999999999999e-111 < y.re < 8.9999999999999997e151Initial program 62.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
sqr-neg-revN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lower-fma.f6462.5
Applied rewrites62.5%
if 8.9999999999999997e151 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f6442.5
Applied rewrites42.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/ (- (* y.re x.im) (* y.im x.re)) (fma y.im y.im (* y.re y.re)))))
(if (<= y.re -5e+120)
(/ (- x.im (* (/ x.re y.re) y.im)) y.re)
(if (<= y.re -1.25e-117)
t_0
(if (<= y.re 1.6e-111)
(/ (fma -1.0 x.re (/ (* x.im y.re) y.im)) y.im)
(if (<= y.re 9e+151) t_0 (/ x.im y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double tmp;
if (y_46_re <= -5e+120) {
tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= -1.25e-117) {
tmp = t_0;
} else if (y_46_re <= 1.6e-111) {
tmp = fma(-1.0, x_46_re, ((x_46_im * y_46_re) / y_46_im)) / y_46_im;
} else if (y_46_re <= 9e+151) {
tmp = t_0;
} else {
tmp = x_46_im / y_46_re;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) tmp = 0.0 if (y_46_re <= -5e+120) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re); elseif (y_46_re <= -1.25e-117) tmp = t_0; elseif (y_46_re <= 1.6e-111) tmp = Float64(fma(-1.0, x_46_re, Float64(Float64(x_46_im * y_46_re) / y_46_im)) / y_46_im); elseif (y_46_re <= 9e+151) tmp = t_0; else tmp = Float64(x_46_im / 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[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * 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, -5e+120], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.25e-117], t$95$0, If[LessEqual[y$46$re, 1.6e-111], N[(N[(-1.0 * x$46$re + N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 9e+151], t$95$0, N[(x$46$im / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{if}\;y.re \leq -5 \cdot 10^{+120}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{elif}\;y.re \leq -1.25 \cdot 10^{-117}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{-111}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 9 \cdot 10^{+151}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -5.00000000000000019e120Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -5.00000000000000019e120 < y.re < -1.25e-117 or 1.5999999999999999e-111 < y.re < 8.9999999999999997e151Initial program 62.5%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.5
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
fp-cancel-sub-sign-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
distribute-rgt-neg-outN/A
sqr-neg-revN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lower-fma.f6462.5
Applied rewrites62.5%
if -1.25e-117 < y.re < 1.5999999999999999e-111Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
if 8.9999999999999997e151 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f6442.5
Applied rewrites42.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.4e-38)
(/ (- x.im (* (/ x.re y.re) y.im)) y.re)
(if (<= y.re 2.9e-89)
(/ (fma -1.0 x.re (/ (* x.im y.re) y.im)) y.im)
(if (<= y.re 9.5e+16)
(/ (* x.im y.re) (+ (* y.re y.re) (* y.im y.im)))
(- (/ x.im y.re) (* (/ x.re (* y.re y.re)) 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-38) {
tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= 2.9e-89) {
tmp = fma(-1.0, x_46_re, ((x_46_im * y_46_re) / y_46_im)) / y_46_im;
} else if (y_46_re <= 9.5e+16) {
tmp = (x_46_im * y_46_re) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = (x_46_im / y_46_re) - ((x_46_re / (y_46_re * y_46_re)) * 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-38) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re); elseif (y_46_re <= 2.9e-89) tmp = Float64(fma(-1.0, x_46_re, Float64(Float64(x_46_im * y_46_re) / y_46_im)) / y_46_im); elseif (y_46_re <= 9.5e+16) tmp = Float64(Float64(x_46_im * y_46_re) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = Float64(Float64(x_46_im / y_46_re) - Float64(Float64(x_46_re / Float64(y_46_re * y_46_re)) * y_46_im)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1.4e-38], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.9e-89], N[(N[(-1.0 * x$46$re + N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 9.5e+16], N[(N[(x$46$im * y$46$re), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im / y$46$re), $MachinePrecision] - N[(N[(x$46$re / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-38}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{elif}\;y.re \leq 2.9 \cdot 10^{-89}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 9.5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re} - \frac{x.re}{y.re \cdot y.re} \cdot y.im\\
\end{array}
\end{array}
if y.re < -1.4e-38Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -1.4e-38 < y.re < 2.89999999999999992e-89Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
if 2.89999999999999992e-89 < y.re < 9.5e16Initial program 62.5%
Taylor expanded in x.re around 0
lower-*.f6440.1
Applied rewrites40.1%
if 9.5e16 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
distribute-frac-neg2N/A
distribute-neg-fracN/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identityN/A
lower-*.f6447.8
Applied rewrites47.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.im (* (/ x.re y.re) y.im)) y.re)))
(if (<= y.re -1.4e-38)
t_0
(if (<= y.re 2.9e-89)
(/ (fma -1.0 x.re (/ (* x.im y.re) y.im)) y.im)
(if (<= y.re 9.5e+16)
(/ (* x.im y.re) (+ (* 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 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.4e-38) {
tmp = t_0;
} else if (y_46_re <= 2.9e-89) {
tmp = fma(-1.0, x_46_re, ((x_46_im * y_46_re) / y_46_im)) / y_46_im;
} else if (y_46_re <= 9.5e+16) {
tmp = (x_46_im * y_46_re) / ((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(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -1.4e-38) tmp = t_0; elseif (y_46_re <= 2.9e-89) tmp = Float64(fma(-1.0, x_46_re, Float64(Float64(x_46_im * y_46_re) / y_46_im)) / y_46_im); elseif (y_46_re <= 9.5e+16) tmp = Float64(Float64(x_46_im * y_46_re) / 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[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.4e-38], t$95$0, If[LessEqual[y$46$re, 2.9e-89], N[(N[(-1.0 * x$46$re + N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 9.5e+16], N[(N[(x$46$im * y$46$re), $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{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 2.9 \cdot 10^{-89}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}\\
\mathbf{elif}\;y.re \leq 9.5 \cdot 10^{+16}:\\
\;\;\;\;\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.4e-38 or 9.5e16 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -1.4e-38 < y.re < 2.89999999999999992e-89Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
if 2.89999999999999992e-89 < y.re < 9.5e16Initial program 62.5%
Taylor expanded in x.re around 0
lower-*.f6440.1
Applied rewrites40.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.im (* (/ x.re y.re) y.im)) y.re)))
(if (<= y.re -1.4e-38)
t_0
(if (<= y.re 5.5e+26)
(/ (fma -1.0 x.re (/ (* x.im 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 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.4e-38) {
tmp = t_0;
} else if (y_46_re <= 5.5e+26) {
tmp = fma(-1.0, x_46_re, ((x_46_im * 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(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -1.4e-38) tmp = t_0; elseif (y_46_re <= 5.5e+26) tmp = Float64(fma(-1.0, x_46_re, Float64(Float64(x_46_im * y_46_re) / 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$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.4e-38], t$95$0, If[LessEqual[y$46$re, 5.5e+26], N[(N[(-1.0 * x$46$re + N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 5.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.4e-38 or 5.4999999999999997e26 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -1.4e-38 < y.re < 5.4999999999999997e26Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.im (* (/ x.re y.re) y.im)) y.re)))
(if (<= y.re -1.4e-38)
t_0
(if (<= y.re 1.06e+27) (/ (fma (/ y.re y.im) x.im (- x.re)) 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 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.4e-38) {
tmp = t_0;
} else if (y_46_re <= 1.06e+27) {
tmp = fma((y_46_re / y_46_im), x_46_im, -x_46_re) / 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(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -1.4e-38) tmp = t_0; elseif (y_46_re <= 1.06e+27) tmp = Float64(fma(Float64(y_46_re / y_46_im), x_46_im, Float64(-x_46_re)) / 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[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.4e-38], t$95$0, If[LessEqual[y$46$re, 1.06e+27], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$im + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 1.06 \cdot 10^{+27}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, -x.re\right)}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.4e-38 or 1.05999999999999994e27 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -1.4e-38 < y.re < 1.05999999999999994e27Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
Applied rewrites54.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im)))
(if (<= y.im -3.1e+20)
t_0
(if (<= y.im 3.4e+104) (/ (- x.im (/ (* x.re 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 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -3.1e+20) {
tmp = t_0;
} else if (y_46_im <= 3.4e+104) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = -x_46re / y_46im
if (y_46im <= (-3.1d+20)) then
tmp = t_0
else if (y_46im <= 3.4d+104) then
tmp = (x_46im - ((x_46re * y_46im) / y_46re)) / y_46re
else
tmp = t_0
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 t_0 = -x_46_re / y_46_im;
double tmp;
if (y_46_im <= -3.1e+20) {
tmp = t_0;
} else if (y_46_im <= 3.4e+104) {
tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = -x_46_re / y_46_im tmp = 0 if y_46_im <= -3.1e+20: tmp = t_0 elif y_46_im <= 3.4e+104: tmp = (x_46_im - ((x_46_re * 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(Float64(-x_46_re) / y_46_im) tmp = 0.0 if (y_46_im <= -3.1e+20) tmp = t_0; elseif (y_46_im <= 3.4e+104) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = -x_46_re / y_46_im; tmp = 0.0; if (y_46_im <= -3.1e+20) tmp = t_0; elseif (y_46_im <= 3.4e+104) tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -3.1e+20], t$95$0, If[LessEqual[y$46$im, 3.4e+104], N[(N[(x$46$im - N[(N[(x$46$re * 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{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -3.1 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 3.4 \cdot 10^{+104}:\\
\;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -3.1e20 or 3.3999999999999997e104 < y.im Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
Taylor expanded in x.re around inf
lower-*.f6443.0
Applied rewrites43.0%
lift-*.f64N/A
mul-1-negN/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
lift-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity43.0
Applied rewrites43.0%
if -3.1e20 < y.im < 3.3999999999999997e104Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
remove-double-negN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
mul-1-negN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity52.6
Applied rewrites52.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (/ (- x.im (* (/ x.re y.re) y.im)) y.re))) (if (<= y.re -1.35e-38) t_0 (if (<= y.re 5.4e-89) (/ (- x.re) 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 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.35e-38) {
tmp = t_0;
} else if (y_46_re <= 5.4e-89) {
tmp = -x_46_re / y_46_im;
} else {
tmp = t_0;
}
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) :: t_0
real(8) :: tmp
t_0 = (x_46im - ((x_46re / y_46re) * y_46im)) / y_46re
if (y_46re <= (-1.35d-38)) then
tmp = t_0
else if (y_46re <= 5.4d-89) then
tmp = -x_46re / y_46im
else
tmp = t_0
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 t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -1.35e-38) {
tmp = t_0;
} else if (y_46_re <= 5.4e-89) {
tmp = -x_46_re / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re tmp = 0 if y_46_re <= -1.35e-38: tmp = t_0 elif y_46_re <= 5.4e-89: tmp = -x_46_re / 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(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -1.35e-38) tmp = t_0; elseif (y_46_re <= 5.4e-89) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re; tmp = 0.0; if (y_46_re <= -1.35e-38) tmp = t_0; elseif (y_46_re <= 5.4e-89) tmp = -x_46_re / y_46_im; else tmp = t_0; end tmp_2 = 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[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.35e-38], t$95$0, If[LessEqual[y$46$re, 5.4e-89], N[((-x$46$re) / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -1.35 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 5.4 \cdot 10^{-89}:\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -1.35000000000000003e-38 or 5.39999999999999975e-89 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.6
Applied rewrites52.6%
Applied rewrites53.8%
if -1.35000000000000003e-38 < y.re < 5.39999999999999975e-89Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
Taylor expanded in x.re around inf
lower-*.f6443.0
Applied rewrites43.0%
lift-*.f64N/A
mul-1-negN/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
lift-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity43.0
Applied rewrites43.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -4.2e+66) (/ x.im y.re) (if (<= y.re 3.7e+28) (/ (- x.re) y.im) (/ x.im 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 <= -4.2e+66) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 3.7e+28) {
tmp = -x_46_re / y_46_im;
} else {
tmp = x_46_im / y_46_re;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-4.2d+66)) then
tmp = x_46im / y_46re
else if (y_46re <= 3.7d+28) then
tmp = -x_46re / y_46im
else
tmp = x_46im / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -4.2e+66) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 3.7e+28) {
tmp = -x_46_re / y_46_im;
} else {
tmp = x_46_im / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -4.2e+66: tmp = x_46_im / y_46_re elif y_46_re <= 3.7e+28: tmp = -x_46_re / y_46_im else: tmp = x_46_im / 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 <= -4.2e+66) tmp = Float64(x_46_im / y_46_re); elseif (y_46_re <= 3.7e+28) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(x_46_im / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -4.2e+66) tmp = x_46_im / y_46_re; elseif (y_46_re <= 3.7e+28) tmp = -x_46_re / y_46_im; else tmp = x_46_im / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -4.2e+66], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 3.7e+28], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.2 \cdot 10^{+66}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.re \leq 3.7 \cdot 10^{+28}:\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -4.20000000000000011e66 or 3.6999999999999999e28 < y.re Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f6442.5
Applied rewrites42.5%
if -4.20000000000000011e66 < y.re < 3.6999999999999999e28Initial program 62.5%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.3
Applied rewrites52.3%
Taylor expanded in x.re around inf
lower-*.f6443.0
Applied rewrites43.0%
lift-*.f64N/A
mul-1-negN/A
*-rgt-identityN/A
metadata-evalN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
lift-*.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
metadata-evalN/A
*-rgt-identity43.0
Applied rewrites43.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
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_46re
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_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_re) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.re}
\end{array}
Initial program 62.5%
Taylor expanded in y.re around inf
lower-/.f6442.5
Applied rewrites42.5%
herbie shell --seed 2025149
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, imaginary part"
:precision binary64
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))