
(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]
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
Herbie found 11 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]
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
(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 (* (/ x.re t_0) y.im))
(t_2 (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)))
(if (<= y.im -5.3e+124)
t_2
(if (<= y.im -2.6e-116)
(- (* x.im (/ y.re t_0)) t_1)
(if (<= y.im 7.2e+17)
(/ (- x.im (* (/ y.im y.re) x.re)) y.re)
(if (<= y.im 5.1e+147) (- (* (/ x.im t_0) y.re) 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 = (x_46_re / t_0) * y_46_im;
double t_2 = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -5.3e+124) {
tmp = t_2;
} else if (y_46_im <= -2.6e-116) {
tmp = (x_46_im * (y_46_re / t_0)) - t_1;
} else if (y_46_im <= 7.2e+17) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_im <= 5.1e+147) {
tmp = ((x_46_im / t_0) * y_46_re) - 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 = Float64(Float64(x_46_re / t_0) * y_46_im) t_2 = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -5.3e+124) tmp = t_2; elseif (y_46_im <= -2.6e-116) tmp = Float64(Float64(x_46_im * Float64(y_46_re / t_0)) - t_1); elseif (y_46_im <= 7.2e+17) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re); elseif (y_46_im <= 5.1e+147) tmp = Float64(Float64(Float64(x_46_im / t_0) * y_46_re) - 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[(x$46$re / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -5.3e+124], t$95$2, If[LessEqual[y$46$im, -2.6e-116], N[(N[(x$46$im * N[(y$46$re / t$95$0), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 7.2e+17], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 5.1e+147], N[(N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$1), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := \frac{x.re}{t\_0} \cdot y.im\\
t_2 := \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -5.3 \cdot 10^{+124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-116}:\\
\;\;\;\;x.im \cdot \frac{y.re}{t\_0} - t\_1\\
\mathbf{elif}\;y.im \leq 7.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 5.1 \cdot 10^{+147}:\\
\;\;\;\;\frac{x.im}{t\_0} \cdot y.re - t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y.im < -5.3000000000000003e124 or 5.09999999999999999e147 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.8%
Applied rewrites53.8%
if -5.3000000000000003e124 < y.im < -2.6e-116Initial program 62.2%
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites61.8%
lift-fma.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lower-*.f6461.8%
Applied rewrites61.8%
if -2.6e-116 < y.im < 7.2e17Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.4%
Applied rewrites54.4%
if 7.2e17 < y.im < 5.09999999999999999e147Initial program 62.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
Applied rewrites59.3%
(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 (- (* x.im (/ y.re t_0)) (* (/ x.re t_0) y.im)))
(t_2 (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)))
(if (<= y.im -5.3e+124)
t_2
(if (<= y.im -2.6e-116)
t_1
(if (<= y.im 7.2e+17)
(/ (- x.im (* (/ y.im y.re) x.re)) y.re)
(if (<= y.im 5.1e+147) 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 = (x_46_im * (y_46_re / t_0)) - ((x_46_re / t_0) * y_46_im);
double t_2 = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -5.3e+124) {
tmp = t_2;
} else if (y_46_im <= -2.6e-116) {
tmp = t_1;
} else if (y_46_im <= 7.2e+17) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
} else if (y_46_im <= 5.1e+147) {
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 = Float64(Float64(x_46_im * Float64(y_46_re / t_0)) - Float64(Float64(x_46_re / t_0) * y_46_im)) t_2 = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -5.3e+124) tmp = t_2; elseif (y_46_im <= -2.6e-116) tmp = t_1; elseif (y_46_im <= 7.2e+17) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re); elseif (y_46_im <= 5.1e+147) 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[(x$46$im * N[(y$46$re / t$95$0), $MachinePrecision]), $MachinePrecision] - N[(N[(x$46$re / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -5.3e+124], t$95$2, If[LessEqual[y$46$im, -2.6e-116], t$95$1, If[LessEqual[y$46$im, 7.2e+17], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 5.1e+147], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
t_1 := x.im \cdot \frac{y.re}{t\_0} - \frac{x.re}{t\_0} \cdot y.im\\
t_2 := \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -5.3 \cdot 10^{+124}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 7.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 5.1 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
if y.im < -5.3000000000000003e124 or 5.09999999999999999e147 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.8%
Applied rewrites53.8%
if -5.3000000000000003e124 < y.im < -2.6e-116 or 7.2e17 < y.im < 5.09999999999999999e147Initial program 62.2%
lift-/.f64N/A
lift--.f64N/A
sub-flipN/A
div-addN/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites61.8%
lift-fma.f64N/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
distribute-lft-neg-outN/A
lift-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
remove-double-negN/A
lower-*.f6461.8%
Applied rewrites61.8%
if -2.6e-116 < y.im < 7.2e17Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.4%
Applied rewrites54.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)))
(if (<= y.im -2.45e+126)
t_0
(if (<= y.im -2.6e-116)
(*
(/ 1.0 (fma y.im y.im (* y.re y.re)))
(- (* y.re x.im) (* y.im x.re)))
(if (<= y.im 9.8e+17) (/ (- x.im (* (/ y.im y.re) x.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(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -2.45e+126) {
tmp = t_0;
} else if (y_46_im <= -2.6e-116) {
tmp = (1.0 / fma(y_46_im, y_46_im, (y_46_re * y_46_re))) * ((y_46_re * x_46_im) - (y_46_im * x_46_re));
} else if (y_46_im <= 9.8e+17) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -2.45e+126) tmp = t_0; elseif (y_46_im <= -2.6e-116) tmp = Float64(Float64(1.0 / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) * Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re))); elseif (y_46_im <= 9.8e+17) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_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[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.45e+126], t$95$0, If[LessEqual[y$46$im, -2.6e-116], N[(N[(1.0 / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 9.8e+17], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -2.45 \cdot 10^{+126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-116}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot \left(y.re \cdot x.im - y.im \cdot x.re\right)\\
\mathbf{elif}\;y.im \leq 9.8 \cdot 10^{+17}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -2.45e126 or 9.8e17 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.8%
Applied rewrites53.8%
if -2.45e126 < y.im < -2.6e-116Initial program 62.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites62.0%
if -2.6e-116 < y.im < 9.8e17Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.4%
Applied rewrites54.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)))
(if (<= y.im -2.45e+126)
t_0
(if (<= y.im -2.6e-116)
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
(if (<= y.im 9.8e+17) (/ (- x.im (* (/ y.im y.re) x.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(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -2.45e+126) {
tmp = t_0;
} else if (y_46_im <= -2.6e-116) {
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));
} else if (y_46_im <= 9.8e+17) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -2.45e+126) tmp = t_0; elseif (y_46_im <= -2.6e-116) tmp = 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))); elseif (y_46_im <= 9.8e+17) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_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[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.45e+126], t$95$0, If[LessEqual[y$46$im, -2.6e-116], 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], If[LessEqual[y$46$im, 9.8e+17], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -2.45 \cdot 10^{+126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-116}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.im \leq 9.8 \cdot 10^{+17}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -2.45e126 or 9.8e17 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.8%
Applied rewrites53.8%
if -2.45e126 < y.im < -2.6e-116Initial program 62.2%
if -2.6e-116 < y.im < 9.8e17Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.4%
Applied rewrites54.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)))
(if (<= y.im -5.5e+78)
t_0
(if (<= y.im 9.8e+17) (/ (- x.im (* (/ y.im y.re) x.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(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -5.5e+78) {
tmp = t_0;
} else if (y_46_im <= 9.8e+17) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im) tmp = 0.0 if (y_46_im <= -5.5e+78) tmp = t_0; elseif (y_46_im <= 9.8e+17) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_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[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -5.5e+78], t$95$0, If[LessEqual[y$46$im, 9.8e+17], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -5.5 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 9.8 \cdot 10^{+17}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -5.4999999999999997e78 or 9.8e17 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-fma.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.8%
Applied rewrites53.8%
if -5.4999999999999997e78 < y.im < 9.8e17Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.4%
Applied rewrites54.4%
(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 -2.7e-17)
t_0
(if (<= y.re 5.2e+62) (/ (- (/ (* x.im y.re) y.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 <= -2.7e-17) {
tmp = t_0;
} else if (y_46_re <= 5.2e+62) {
tmp = (((x_46_im * y_46_re) / y_46_im) - 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 <= (-2.7d-17)) then
tmp = t_0
else if (y_46re <= 5.2d+62) then
tmp = (((x_46im * y_46re) / y_46im) - 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 <= -2.7e-17) {
tmp = t_0;
} else if (y_46_re <= 5.2e+62) {
tmp = (((x_46_im * y_46_re) / y_46_im) - 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 <= -2.7e-17: tmp = t_0 elif y_46_re <= 5.2e+62: tmp = (((x_46_im * y_46_re) / y_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 <= -2.7e-17) tmp = t_0; elseif (y_46_re <= 5.2e+62) tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - 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 <= -2.7e-17) tmp = t_0; elseif (y_46_re <= 5.2e+62) tmp = (((x_46_im * y_46_re) / y_46_im) - 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, -2.7e-17], t$95$0, If[LessEqual[y$46$re, 5.2e+62], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -2.7 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 5.2 \cdot 10^{+62}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -2.7000000000000001e-17 or 5.19999999999999968e62 < y.re Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6454.0%
Applied rewrites54.0%
if -2.7000000000000001e-17 < y.re < 5.19999999999999968e62Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
lift-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6452.8%
Applied rewrites52.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im)))
(if (<= y.im -5.5e+78)
t_0
(if (<= y.im 1.4e+95) (/ (- x.im (* (/ y.im y.re) x.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 <= -5.5e+78) {
tmp = t_0;
} else if (y_46_im <= 1.4e+95) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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 <= (-5.5d+78)) then
tmp = t_0
else if (y_46im <= 1.4d+95) then
tmp = (x_46im - ((y_46im / y_46re) * x_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 <= -5.5e+78) {
tmp = t_0;
} else if (y_46_im <= 1.4e+95) {
tmp = (x_46_im - ((y_46_im / y_46_re) * x_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 <= -5.5e+78: tmp = t_0 elif y_46_im <= 1.4e+95: tmp = (x_46_im - ((y_46_im / y_46_re) * x_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 <= -5.5e+78) tmp = t_0; elseif (y_46_im <= 1.4e+95) tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_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 <= -5.5e+78) tmp = t_0; elseif (y_46_im <= 1.4e+95) tmp = (x_46_im - ((y_46_im / y_46_re) * x_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, -5.5e+78], t$95$0, If[LessEqual[y$46$im, 1.4e+95], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -5.5 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.4 \cdot 10^{+95}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -5.4999999999999997e78 or 1.3999999999999999e95 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
Taylor expanded in x.re around inf
lower-*.f6442.5%
Applied rewrites42.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6442.5%
Applied rewrites42.5%
if -5.4999999999999997e78 < y.im < 1.3999999999999999e95Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6454.4%
Applied rewrites54.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- x.re) y.im)))
(if (<= y.im -5.5e+78)
t_0
(if (<= y.im 1.4e+95) (/ (- x.im (* (/ x.re y.re) y.im)) 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 <= -5.5e+78) {
tmp = t_0;
} else if (y_46_im <= 1.4e+95) {
tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / 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 <= (-5.5d+78)) then
tmp = t_0
else if (y_46im <= 1.4d+95) then
tmp = (x_46im - ((x_46re / y_46re) * y_46im)) / 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 <= -5.5e+78) {
tmp = t_0;
} else if (y_46_im <= 1.4e+95) {
tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / 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 <= -5.5e+78: tmp = t_0 elif y_46_im <= 1.4e+95: tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / 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 <= -5.5e+78) tmp = t_0; elseif (y_46_im <= 1.4e+95) tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / 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 <= -5.5e+78) tmp = t_0; elseif (y_46_im <= 1.4e+95) tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / 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, -5.5e+78], t$95$0, If[LessEqual[y$46$im, 1.4e+95], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -5.5 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 1.4 \cdot 10^{+95}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.im < -5.4999999999999997e78 or 1.3999999999999999e95 < y.im Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
Taylor expanded in x.re around inf
lower-*.f6442.5%
Applied rewrites42.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6442.5%
Applied rewrites42.5%
if -5.4999999999999997e78 < y.im < 1.3999999999999999e95Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6452.5%
Applied rewrites52.5%
lift-+.f64N/A
add-flipN/A
lower--.f64N/A
lift-*.f64N/A
mul-1-negN/A
lift-/.f64N/A
distribute-neg-fracN/A
distribute-frac-neg2N/A
frac-2negN/A
lift-/.f6452.5%
Applied rewrites52.5%
lift-/.f64N/A
lift-*.f64N/A
associate-*l/N/A
lift-/.f64N/A
lower-*.f6454.0%
Applied rewrites54.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -185.0) (/ x.im y.re) (if (<= y.re 2.6e+45) (/ (- x.re) y.im) (/ 1.0 (/ y.re x.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 <= -185.0) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 2.6e+45) {
tmp = -x_46_re / y_46_im;
} else {
tmp = 1.0 / (y_46_re / x_46_im);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-185.0d0)) then
tmp = x_46im / y_46re
else if (y_46re <= 2.6d+45) then
tmp = -x_46re / y_46im
else
tmp = 1.0d0 / (y_46re / x_46im)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -185.0) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 2.6e+45) {
tmp = -x_46_re / y_46_im;
} else {
tmp = 1.0 / (y_46_re / x_46_im);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -185.0: tmp = x_46_im / y_46_re elif y_46_re <= 2.6e+45: tmp = -x_46_re / y_46_im else: tmp = 1.0 / (y_46_re / x_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 <= -185.0) tmp = Float64(x_46_im / y_46_re); elseif (y_46_re <= 2.6e+45) tmp = Float64(Float64(-x_46_re) / y_46_im); else tmp = Float64(1.0 / Float64(y_46_re / x_46_im)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -185.0) tmp = x_46_im / y_46_re; elseif (y_46_re <= 2.6e+45) tmp = -x_46_re / y_46_im; else tmp = 1.0 / (y_46_re / x_46_im); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -185.0], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.6e+45], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(1.0 / N[(y$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -185:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.re \leq 2.6 \cdot 10^{+45}:\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y.re}{x.im}}\\
\end{array}
if y.re < -185Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.1%
Applied rewrites43.1%
if -185 < y.re < 2.60000000000000007e45Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
Taylor expanded in x.re around inf
lower-*.f6442.5%
Applied rewrites42.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6442.5%
Applied rewrites42.5%
if 2.60000000000000007e45 < y.re Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.1%
Applied rewrites43.1%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6442.8%
Applied rewrites42.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -185.0) (/ x.im y.re) (if (<= y.re 2.6e+45) (/ (- 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 <= -185.0) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 2.6e+45) {
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 <= (-185.0d0)) then
tmp = x_46im / y_46re
else if (y_46re <= 2.6d+45) 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 <= -185.0) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 2.6e+45) {
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 <= -185.0: tmp = x_46_im / y_46_re elif y_46_re <= 2.6e+45: 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 <= -185.0) tmp = Float64(x_46_im / y_46_re); elseif (y_46_re <= 2.6e+45) 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 <= -185.0) tmp = x_46_im / y_46_re; elseif (y_46_re <= 2.6e+45) 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, -185.0], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2.6e+45], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -185:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.re \leq 2.6 \cdot 10^{+45}:\\
\;\;\;\;\frac{-x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
if y.re < -185 or 2.60000000000000007e45 < y.re Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.1%
Applied rewrites43.1%
if -185 < y.re < 2.60000000000000007e45Initial program 62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
Taylor expanded in x.re around inf
lower-*.f6442.5%
Applied rewrites42.5%
lift-*.f64N/A
mul-1-negN/A
lower-neg.f6442.5%
Applied rewrites42.5%
(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]
\frac{x.im}{y.re}
Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.1%
Applied rewrites43.1%
herbie shell --seed 2025183
(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))))