
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.1e+72)
(/ (+ x.re (* (/ x.im y.re) y.im)) y.re)
(if (<= y.re -2.8e-43)
(/ (fma x.im y.im (* x.re y.re)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.re 2.05e-76)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
(/ (+ x.re (* (/ y.im y.re) 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 <= -2.1e+72) {
tmp = (x_46_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= -2.8e-43) {
tmp = fma(x_46_im, y_46_im, (x_46_re * y_46_re)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_re <= 2.05e-76) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = (x_46_re + ((y_46_im / y_46_re) * 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 <= -2.1e+72) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im / y_46_re) * y_46_im)) / y_46_re); elseif (y_46_re <= -2.8e-43) tmp = Float64(fma(x_46_im, y_46_im, Float64(x_46_re * y_46_re)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); elseif (y_46_re <= 2.05e-76) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = Float64(Float64(x_46_re + Float64(Float64(y_46_im / y_46_re) * x_46_im)) / 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.1e+72], N[(N[(x$46$re + N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -2.8e-43], N[(N[(x$46$im * y$46$im + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2.05e-76], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$re + N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.1 \cdot 10^{+72}:\\
\;\;\;\;\frac{x.re + \frac{x.im}{y.re} \cdot y.im}{y.re}\\
\mathbf{elif}\;y.re \leq -2.8 \cdot 10^{-43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.im, x.re \cdot y.re\right)}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.re \leq 2.05 \cdot 10^{-76}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re + \frac{y.im}{y.re} \cdot x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -2.1000000000000001e72Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.1%
if -2.1000000000000001e72 < y.re < -2.7999999999999998e-43Initial program 60.8%
Taylor expanded in x.re around 0
Applied rewrites60.8%
if -2.7999999999999998e-43 < y.re < 2.0499999999999999e-76Initial program 60.8%
Taylor expanded in y.im around inf
Applied rewrites52.9%
if 2.0499999999999999e-76 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2e+72)
(/ (+ x.re (* (/ x.im y.re) y.im)) y.re)
(if (<= y.re -2.8e-43)
(/ (fma x.im y.im (* x.re y.re)) (* (- y.im y.re) (- y.im y.re)))
(if (<= y.re 2.05e-76)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
(/ (+ x.re (* (/ y.im y.re) 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 <= -2e+72) {
tmp = (x_46_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= -2.8e-43) {
tmp = fma(x_46_im, y_46_im, (x_46_re * y_46_re)) / ((y_46_im - y_46_re) * (y_46_im - y_46_re));
} else if (y_46_re <= 2.05e-76) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = (x_46_re + ((y_46_im / y_46_re) * 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 <= -2e+72) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im / y_46_re) * y_46_im)) / y_46_re); elseif (y_46_re <= -2.8e-43) tmp = Float64(fma(x_46_im, y_46_im, Float64(x_46_re * y_46_re)) / Float64(Float64(y_46_im - y_46_re) * Float64(y_46_im - y_46_re))); elseif (y_46_re <= 2.05e-76) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = Float64(Float64(x_46_re + Float64(Float64(y_46_im / y_46_re) * x_46_im)) / 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, -2e+72], N[(N[(x$46$re + N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -2.8e-43], N[(N[(x$46$im * y$46$im + N[(x$46$re * y$46$re), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$im - y$46$re), $MachinePrecision] * N[(y$46$im - y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2.05e-76], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$re + N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2 \cdot 10^{+72}:\\
\;\;\;\;\frac{x.re + \frac{x.im}{y.re} \cdot y.im}{y.re}\\
\mathbf{elif}\;y.re \leq -2.8 \cdot 10^{-43}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.im, y.im, x.re \cdot y.re\right)}{\left(y.im - y.re\right) \cdot \left(y.im - y.re\right)}\\
\mathbf{elif}\;y.re \leq 2.05 \cdot 10^{-76}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re + \frac{y.im}{y.re} \cdot x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -1.99999999999999989e72Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.1%
if -1.99999999999999989e72 < y.re < -2.7999999999999998e-43Initial program 60.8%
Taylor expanded in x.re around 0
Applied rewrites60.8%
Applied rewrites59.9%
if -2.7999999999999998e-43 < y.re < 2.0499999999999999e-76Initial program 60.8%
Taylor expanded in y.im around inf
Applied rewrites52.9%
if 2.0499999999999999e-76 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -2.95e-43)
(/ (+ x.re (* (/ x.im y.re) y.im)) y.re)
(if (<= y.re 2.05e-76)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
(/ (+ x.re (* (/ y.im y.re) 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 <= -2.95e-43) {
tmp = (x_46_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= 2.05e-76) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = (x_46_re + ((y_46_im / y_46_re) * 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 <= (-2.95d-43)) then
tmp = (x_46re + ((x_46im / y_46re) * y_46im)) / y_46re
else if (y_46re <= 2.05d-76) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = (x_46re + ((y_46im / y_46re) * 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 <= -2.95e-43) {
tmp = (x_46_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re;
} else if (y_46_re <= 2.05e-76) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = (x_46_re + ((y_46_im / y_46_re) * 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 <= -2.95e-43: tmp = (x_46_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re elif y_46_re <= 2.05e-76: tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im else: tmp = (x_46_re + ((y_46_im / y_46_re) * 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 <= -2.95e-43) tmp = Float64(Float64(x_46_re + Float64(Float64(x_46_im / y_46_re) * y_46_im)) / y_46_re); elseif (y_46_re <= 2.05e-76) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = Float64(Float64(x_46_re + Float64(Float64(y_46_im / y_46_re) * 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 <= -2.95e-43) tmp = (x_46_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re; elseif (y_46_re <= 2.05e-76) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = (x_46_re + ((y_46_im / y_46_re) * 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, -2.95e-43], N[(N[(x$46$re + N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.05e-76], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$re + N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.95 \cdot 10^{-43}:\\
\;\;\;\;\frac{x.re + \frac{x.im}{y.re} \cdot y.im}{y.re}\\
\mathbf{elif}\;y.re \leq 2.05 \cdot 10^{-76}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re + \frac{y.im}{y.re} \cdot x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -2.94999999999999988e-43Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.1%
if -2.94999999999999988e-43 < y.re < 2.0499999999999999e-76Initial program 60.8%
Taylor expanded in y.im around inf
Applied rewrites52.9%
if 2.0499999999999999e-76 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (+ x.re (* (/ x.im y.re) y.im)) y.re)))
(if (<= y.re -2.95e-43)
t_0
(if (<= y.re 2.05e-76) (/ (+ x.im (/ (* x.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_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -2.95e-43) {
tmp = t_0;
} else if (y_46_re <= 2.05e-76) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / 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_46re + ((x_46im / y_46re) * y_46im)) / y_46re
if (y_46re <= (-2.95d-43)) then
tmp = t_0
else if (y_46re <= 2.05d-76) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / 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_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re;
double tmp;
if (y_46_re <= -2.95e-43) {
tmp = t_0;
} else if (y_46_re <= 2.05e-76) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / 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_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re tmp = 0 if y_46_re <= -2.95e-43: tmp = t_0 elif y_46_re <= 2.05e-76: tmp = (x_46_im + ((x_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_re + Float64(Float64(x_46_im / y_46_re) * y_46_im)) / y_46_re) tmp = 0.0 if (y_46_re <= -2.95e-43) tmp = t_0; elseif (y_46_re <= 2.05e-76) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / 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_re + ((x_46_im / y_46_re) * y_46_im)) / y_46_re; tmp = 0.0; if (y_46_re <= -2.95e-43) tmp = t_0; elseif (y_46_re <= 2.05e-76) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / 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$re + N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -2.95e-43], t$95$0, If[LessEqual[y$46$re, 2.05e-76], N[(N[(x$46$im + N[(N[(x$46$re * 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.re + \frac{x.im}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -2.95 \cdot 10^{-43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 2.05 \cdot 10^{-76}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -2.94999999999999988e-43 or 2.0499999999999999e-76 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites51.7%
Applied rewrites53.1%
if -2.94999999999999988e-43 < y.re < 2.0499999999999999e-76Initial program 60.8%
Taylor expanded in y.im around inf
Applied rewrites52.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.7e-34)
(/ x.re y.re)
(if (<= y.re 7.2e+53)
(/ (+ x.im (/ (* x.re y.re) y.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 <= -1.7e-34) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 7.2e+53) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = x_46_re / 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 <= (-1.7d-34)) then
tmp = x_46re / y_46re
else if (y_46re <= 7.2d+53) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = x_46re / 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 <= -1.7e-34) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 7.2e+53) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = x_46_re / 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 <= -1.7e-34: tmp = x_46_re / y_46_re elif y_46_re <= 7.2e+53: tmp = (x_46_im + ((x_46_re * y_46_re) / y_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 <= -1.7e-34) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 7.2e+53) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = Float64(x_46_re / 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 <= -1.7e-34) tmp = x_46_re / y_46_re; elseif (y_46_re <= 7.2e+53) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = x_46_re / 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, -1.7e-34], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 7.2e+53], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $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.7 \cdot 10^{-34}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 7.2 \cdot 10^{+53}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -1.7e-34 or 7.2e53 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites41.8%
if -1.7e-34 < y.re < 7.2e53Initial program 60.8%
Taylor expanded in y.im around inf
Applied rewrites52.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.7e-34)
(/ x.re y.re)
(if (<= y.re 7.2e+53)
(/ (+ x.im (* (/ x.re y.im) y.re)) y.im)
(/ x.re y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.7e-34) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 7.2e+53) {
tmp = (x_46_im + ((x_46_re / y_46_im) * y_46_re)) / y_46_im;
} else {
tmp = x_46_re / 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 <= (-1.7d-34)) then
tmp = x_46re / y_46re
else if (y_46re <= 7.2d+53) then
tmp = (x_46im + ((x_46re / y_46im) * y_46re)) / y_46im
else
tmp = x_46re / 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 <= -1.7e-34) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 7.2e+53) {
tmp = (x_46_im + ((x_46_re / y_46_im) * y_46_re)) / y_46_im;
} else {
tmp = x_46_re / 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 <= -1.7e-34: tmp = x_46_re / y_46_re elif y_46_re <= 7.2e+53: tmp = (x_46_im + ((x_46_re / y_46_im) * 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.7e-34) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 7.2e+53) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re / y_46_im) * y_46_re)) / y_46_im); else tmp = Float64(x_46_re / 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 <= -1.7e-34) tmp = x_46_re / y_46_re; elseif (y_46_re <= 7.2e+53) tmp = (x_46_im + ((x_46_re / y_46_im) * y_46_re)) / y_46_im; else tmp = x_46_re / 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, -1.7e-34], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 7.2e+53], N[(N[(x$46$im + N[(N[(x$46$re / y$46$im), $MachinePrecision] * y$46$re), $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.7 \cdot 10^{-34}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 7.2 \cdot 10^{+53}:\\
\;\;\;\;\frac{x.im + \frac{x.re}{y.im} \cdot y.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -1.7e-34 or 7.2e53 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites41.8%
if -1.7e-34 < y.re < 7.2e53Initial program 60.8%
Taylor expanded in y.im around inf
Applied rewrites52.9%
Applied rewrites54.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -1.15e-34) (/ x.re y.re) (if (<= y.re 1.05e-40) (/ 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 <= -1.15e-34) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 1.05e-40) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / 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 <= (-1.15d-34)) then
tmp = x_46re / y_46re
else if (y_46re <= 1.05d-40) then
tmp = x_46im / y_46im
else
tmp = x_46re / 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 <= -1.15e-34) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 1.05e-40) {
tmp = x_46_im / y_46_im;
} else {
tmp = x_46_re / 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 <= -1.15e-34: tmp = x_46_re / y_46_re elif y_46_re <= 1.05e-40: tmp = 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 <= -1.15e-34) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 1.05e-40) tmp = Float64(x_46_im / y_46_im); else tmp = Float64(x_46_re / 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 <= -1.15e-34) tmp = x_46_re / y_46_re; elseif (y_46_re <= 1.05e-40) tmp = x_46_im / y_46_im; else tmp = x_46_re / 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, -1.15e-34], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 1.05e-40], N[(x$46$im / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.15 \cdot 10^{-34}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 1.05 \cdot 10^{-40}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
\end{array}
if y.re < -1.15000000000000006e-34 or 1.05000000000000009e-40 < y.re Initial program 60.8%
Taylor expanded in y.re around inf
Applied rewrites41.8%
if -1.15000000000000006e-34 < y.re < 1.05000000000000009e-40Initial program 60.8%
Taylor expanded in y.re around 0
Applied rewrites43.3%
(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.8%
Taylor expanded in y.re around 0
Applied rewrites43.3%
(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}
\\
x.im \cdot y.im
\end{array}
Initial program 60.8%
Taylor expanded in y.re around 0
Applied rewrites43.3%
Applied rewrites11.4%
Applied rewrites5.4%
herbie shell --seed 2025159
(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))))