
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ 1.0 (- (/ y.re (- x.im (/ (* y.im x.re) y.re))) (/ y.im (- x.re (/ (* x.im y.re) y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0 / ((y_46_re / (x_46_im - ((y_46_im * x_46_re) / y_46_re))) - (y_46_im / (x_46_re - ((x_46_im * y_46_re) / 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 = 1.0d0 / ((y_46re / (x_46im - ((y_46im * x_46re) / y_46re))) - (y_46im / (x_46re - ((x_46im * y_46re) / 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 1.0 / ((y_46_re / (x_46_im - ((y_46_im * x_46_re) / y_46_re))) - (y_46_im / (x_46_re - ((x_46_im * y_46_re) / y_46_im))));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0 / ((y_46_re / (x_46_im - ((y_46_im * x_46_re) / y_46_re))) - (y_46_im / (x_46_re - ((x_46_im * y_46_re) / y_46_im))))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(1.0 / Float64(Float64(y_46_re / Float64(x_46_im - Float64(Float64(y_46_im * x_46_re) / y_46_re))) - Float64(y_46_im / Float64(x_46_re - Float64(Float64(x_46_im * y_46_re) / y_46_im))))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0 / ((y_46_re / (x_46_im - ((y_46_im * x_46_re) / y_46_re))) - (y_46_im / (x_46_re - ((x_46_im * y_46_re) / y_46_im)))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(1.0 / N[(N[(y$46$re / N[(x$46$im - N[(N[(y$46$im * x$46$re), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y$46$im / N[(x$46$re - N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{y.re}{x.im - \frac{y.im \cdot x.re}{y.re}} - \frac{y.im}{x.re - \frac{x.im \cdot y.re}{y.im}}}
\end{array}
Initial program 62.2%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6462.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
div-addN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
div-flipN/A
Applied rewrites84.4%
lift-fma.f64N/A
add-flipN/A
lower--.f64N/A
lift-/.f64N/A
div-flipN/A
mult-flip-revN/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower--.f64N/A
lift-*.f64N/A
sub-to-fraction-revN/A
lower--.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
Applied rewrites94.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/
1.0
(fma y.re (/ 1.0 x.im) (/ y.im (- (/ (* x.im y.re) y.im) x.re))))))
(if (<= x.im -1.3e-34)
t_0
(if (<= x.im 2.4e-76)
(/
1.0
(fma
y.re
(/ y.re (- (* x.im y.re) (* x.re y.im)))
(* -1.0 (/ y.im x.re))))
t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 1.0 / fma(y_46_re, (1.0 / x_46_im), (y_46_im / (((x_46_im * y_46_re) / y_46_im) - x_46_re)));
double tmp;
if (x_46_im <= -1.3e-34) {
tmp = t_0;
} else if (x_46_im <= 2.4e-76) {
tmp = 1.0 / fma(y_46_re, (y_46_re / ((x_46_im * y_46_re) - (x_46_re * y_46_im))), (-1.0 * (y_46_im / x_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(1.0 / fma(y_46_re, Float64(1.0 / x_46_im), Float64(y_46_im / Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re)))) tmp = 0.0 if (x_46_im <= -1.3e-34) tmp = t_0; elseif (x_46_im <= 2.4e-76) tmp = Float64(1.0 / fma(y_46_re, Float64(y_46_re / Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im))), Float64(-1.0 * Float64(y_46_im / x_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[(1.0 / N[(y$46$re * N[(1.0 / x$46$im), $MachinePrecision] + N[(y$46$im / N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -1.3e-34], t$95$0, If[LessEqual[x$46$im, 2.4e-76], N[(1.0 / N[(y$46$re * N[(y$46$re / N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(y$46$im / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\mathsf{fma}\left(y.re, \frac{1}{x.im}, \frac{y.im}{\frac{x.im \cdot y.re}{y.im} - x.re}\right)}\\
\mathbf{if}\;x.im \leq -1.3 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 2.4 \cdot 10^{-76}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(y.re, \frac{y.re}{x.im \cdot y.re - x.re \cdot y.im}, -1 \cdot \frac{y.im}{x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x.im < -1.3e-34 or 2.40000000000000013e-76 < x.im Initial program 62.2%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6462.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
div-addN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
div-flipN/A
Applied rewrites84.4%
Taylor expanded in x.re around 0
lower-/.f6474.2
Applied rewrites74.2%
if -1.3e-34 < x.im < 2.40000000000000013e-76Initial program 62.2%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6462.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
div-addN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
div-flipN/A
Applied rewrites84.4%
Taylor expanded in x.re around inf
lower-*.f64N/A
lower-/.f6468.6
Applied rewrites68.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (- (/ (* x.im y.re) y.im) x.re))
(t_1 (/ t_0 (* (fma (/ y.re (* y.im y.im)) y.re 1.0) y.im))))
(if (<= y.im -1e-15)
t_1
(if (<= y.im 4.8e-135)
(/ (+ x.im (* -1.0 (/ (* x.re y.im) y.re))) y.re)
(if (<= y.im 2.6e+99)
(/ 1.0 (fma y.re (/ 1.0 x.im) (/ y.im t_0)))
t_1)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((x_46_im * y_46_re) / y_46_im) - x_46_re;
double t_1 = t_0 / (fma((y_46_re / (y_46_im * y_46_im)), y_46_re, 1.0) * y_46_im);
double tmp;
if (y_46_im <= -1e-15) {
tmp = t_1;
} else if (y_46_im <= 4.8e-135) {
tmp = (x_46_im + (-1.0 * ((x_46_re * y_46_im) / y_46_re))) / y_46_re;
} else if (y_46_im <= 2.6e+99) {
tmp = 1.0 / fma(y_46_re, (1.0 / x_46_im), (y_46_im / t_0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) t_1 = Float64(t_0 / Float64(fma(Float64(y_46_re / Float64(y_46_im * y_46_im)), y_46_re, 1.0) * y_46_im)) tmp = 0.0 if (y_46_im <= -1e-15) tmp = t_1; elseif (y_46_im <= 4.8e-135) tmp = Float64(Float64(x_46_im + Float64(-1.0 * Float64(Float64(x_46_re * y_46_im) / y_46_re))) / y_46_re); elseif (y_46_im <= 2.6e+99) tmp = Float64(1.0 / fma(y_46_re, Float64(1.0 / x_46_im), Float64(y_46_im / t_0))); else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(N[(N[(y$46$re / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] * y$46$re + 1.0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -1e-15], t$95$1, If[LessEqual[y$46$im, 4.8e-135], N[(N[(x$46$im + N[(-1.0 * N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.6e+99], N[(1.0 / N[(y$46$re * N[(1.0 / x$46$im), $MachinePrecision] + N[(y$46$im / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im \cdot y.re}{y.im} - x.re\\
t_1 := \frac{t\_0}{\mathsf{fma}\left(\frac{y.re}{y.im \cdot y.im}, y.re, 1\right) \cdot y.im}\\
\mathbf{if}\;y.im \leq -1 \cdot 10^{-15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 4.8 \cdot 10^{-135}:\\
\;\;\;\;\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 2.6 \cdot 10^{+99}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(y.re, \frac{1}{x.im}, \frac{y.im}{t\_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -1.0000000000000001e-15 or 2.6e99 < y.im Initial program 62.2%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6462.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
lift-/.f64N/A
lift-/.f64N/A
div-flip-revN/A
lift-*.f64N/A
lift-fma.f64N/A
sum-to-multN/A
associate-*r/N/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
Applied rewrites60.2%
if -1.0000000000000001e-15 < y.im < 4.7999999999999997e-135Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6453.3
Applied rewrites53.3%
if 4.7999999999999997e-135 < y.im < 2.6e99Initial program 62.2%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6462.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
div-addN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
div-flipN/A
Applied rewrites84.4%
Taylor expanded in x.re around 0
lower-/.f6474.2
Applied rewrites74.2%
(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 -1.65e+44)
t_0
(if (<= y.im 4.8e-135)
(/ (+ x.im (* -1.0 (/ (* x.re y.im) y.re))) y.re)
(if (<= y.im 6.2e+97)
(/
1.0
(fma y.re (/ 1.0 x.im) (/ y.im (- (/ (* x.im y.re) y.im) x.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 <= -1.65e+44) {
tmp = t_0;
} else if (y_46_im <= 4.8e-135) {
tmp = (x_46_im + (-1.0 * ((x_46_re * y_46_im) / y_46_re))) / y_46_re;
} else if (y_46_im <= 6.2e+97) {
tmp = 1.0 / fma(y_46_re, (1.0 / x_46_im), (y_46_im / (((x_46_im * y_46_re) / y_46_im) - x_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 <= -1.65e+44) tmp = t_0; elseif (y_46_im <= 4.8e-135) tmp = Float64(Float64(x_46_im + Float64(-1.0 * Float64(Float64(x_46_re * y_46_im) / y_46_re))) / y_46_re); elseif (y_46_im <= 6.2e+97) tmp = Float64(1.0 / fma(y_46_re, Float64(1.0 / x_46_im), Float64(y_46_im / Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_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, -1.65e+44], t$95$0, If[LessEqual[y$46$im, 4.8e-135], N[(N[(x$46$im + N[(-1.0 * N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 6.2e+97], N[(1.0 / N[(y$46$re * N[(1.0 / x$46$im), $MachinePrecision] + N[(y$46$im / N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\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 -1.65 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 4.8 \cdot 10^{-135}:\\
\;\;\;\;\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{elif}\;y.im \leq 6.2 \cdot 10^{+97}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(y.re, \frac{1}{x.im}, \frac{y.im}{\frac{x.im \cdot y.re}{y.im} - x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.65000000000000007e44 or 6.19999999999999962e97 < y.im Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6451.8
Applied rewrites51.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.0
Applied rewrites53.0%
if -1.65000000000000007e44 < y.im < 4.7999999999999997e-135Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6453.3
Applied rewrites53.3%
if 4.7999999999999997e-135 < y.im < 6.19999999999999962e97Initial program 62.2%
lift-/.f64N/A
div-flipN/A
lower-/.f64N/A
lower-/.f6462.0
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
lift-/.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
div-addN/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
div-flipN/A
Applied rewrites84.4%
Taylor expanded in x.re around 0
lower-/.f6474.2
Applied rewrites74.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (+ x.im (* -1.0 (/ (* x.re y.im) y.re))) y.re)))
(if (<= y.re -2.6e+41)
t_0
(if (<= y.re -4.2e-136)
(/ (- (* y.re x.im) (* y.im x.re)) (fma y.im y.im (* y.re y.re)))
(if (<= y.re 9e-141)
(/ (- (/ (* x.im y.re) y.im) x.re) y.im)
(if (<= y.re 1.15e+118)
(/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_im + (-1.0 * ((x_46_re * y_46_im) / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -2.6e+41) {
tmp = t_0;
} else if (y_46_re <= -4.2e-136) {
tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
} else if (y_46_re <= 9e-141) {
tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_re <= 1.15e+118) {
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 {
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(-1.0 * Float64(Float64(x_46_re * y_46_im) / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_re <= -2.6e+41) tmp = t_0; elseif (y_46_re <= -4.2e-136) tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))); elseif (y_46_re <= 9e-141) tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im); elseif (y_46_re <= 1.15e+118) 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))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im + N[(-1.0 * N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], t$95$0, If[LessEqual[y$46$re, -4.2e-136], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 9e-141], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.15e+118], 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], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq -4.2 \cdot 10^{-136}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{elif}\;y.re \leq 9 \cdot 10^{-141}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 1.15 \cdot 10^{+118}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -2.6000000000000001e41 or 1.15000000000000008e118 < 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-*.f6453.3
Applied rewrites53.3%
if -2.6000000000000001e41 < y.re < -4.1999999999999997e-136Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
if -4.1999999999999997e-136 < y.re < 9.0000000000000001e-141Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
lift-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6451.8
Applied rewrites51.8%
if 9.0000000000000001e-141 < y.re < 1.15000000000000008e118Initial program 62.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (/ (- (* y.re x.im) (* y.im x.re)) (fma y.im y.im (* y.re y.re))))
(t_1 (/ (+ x.im (* -1.0 (/ (* x.re y.im) y.re))) y.re)))
(if (<= y.re -2.6e+41)
t_1
(if (<= y.re -4.2e-136)
t_0
(if (<= y.re 9e-141)
(/ (- (/ (* x.im y.re) y.im) x.re) y.im)
(if (<= y.re 1.15e+118) t_0 t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
double t_1 = (x_46_im + (-1.0 * ((x_46_re * y_46_im) / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -2.6e+41) {
tmp = t_1;
} else if (y_46_re <= -4.2e-136) {
tmp = t_0;
} else if (y_46_re <= 9e-141) {
tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
} else if (y_46_re <= 1.15e+118) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))) t_1 = Float64(Float64(x_46_im + Float64(-1.0 * Float64(Float64(x_46_re * y_46_im) / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_re <= -2.6e+41) tmp = t_1; elseif (y_46_re <= -4.2e-136) tmp = t_0; elseif (y_46_re <= 9e-141) tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im); elseif (y_46_re <= 1.15e+118) tmp = t_0; else tmp = t_1; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im + N[(-1.0 * N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], t$95$1, If[LessEqual[y$46$re, -4.2e-136], t$95$0, If[LessEqual[y$46$re, 9e-141], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.15e+118], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
t_1 := \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq -4.2 \cdot 10^{-136}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 9 \cdot 10^{-141}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\mathbf{elif}\;y.re \leq 1.15 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.re < -2.6000000000000001e41 or 1.15000000000000008e118 < 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-*.f6453.3
Applied rewrites53.3%
if -2.6000000000000001e41 < y.re < -4.1999999999999997e-136 or 9.0000000000000001e-141 < y.re < 1.15000000000000008e118Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
if -4.1999999999999997e-136 < y.re < 9.0000000000000001e-141Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
lift-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6451.8
Applied rewrites51.8%
(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 -1.65e+44)
t_0
(if (<= y.im 9e+81)
(/ (+ x.im (* -1.0 (/ (* x.re y.im) y.re))) y.re)
t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
double tmp;
if (y_46_im <= -1.65e+44) {
tmp = t_0;
} else if (y_46_im <= 9e+81) {
tmp = (x_46_im + (-1.0 * ((x_46_re * y_46_im) / y_46_re))) / y_46_re;
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(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 <= -1.65e+44) tmp = t_0; elseif (y_46_im <= 9e+81) tmp = Float64(Float64(x_46_im + Float64(-1.0 * Float64(Float64(x_46_re * y_46_im) / y_46_re))) / y_46_re); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.65e+44], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(N[(x$46$im + N[(-1.0 * N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\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 -1.65 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.65000000000000007e44 or 9.00000000000000034e81 < y.im Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6451.8
Applied rewrites51.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.0
Applied rewrites53.0%
if -1.65000000000000007e44 < y.im < 9.00000000000000034e81Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6453.3
Applied rewrites53.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -8.8e+36) (/ x.im y.re) (if (<= y.re 17.0) (/ (- (/ (* x.im y.re) y.im) 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 <= -8.8e+36) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 17.0) {
tmp = (((x_46_im * y_46_re) / y_46_im) - 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 <= (-8.8d+36)) then
tmp = x_46im / y_46re
else if (y_46re <= 17.0d0) then
tmp = (((x_46im * y_46re) / y_46im) - 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 <= -8.8e+36) {
tmp = x_46_im / y_46_re;
} else if (y_46_re <= 17.0) {
tmp = (((x_46_im * y_46_re) / y_46_im) - 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 <= -8.8e+36: tmp = x_46_im / y_46_re elif y_46_re <= 17.0: tmp = (((x_46_im * y_46_re) / y_46_im) - 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 <= -8.8e+36) tmp = Float64(x_46_im / y_46_re); elseif (y_46_re <= 17.0) tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - 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 <= -8.8e+36) tmp = x_46_im / y_46_re; elseif (y_46_re <= 17.0) tmp = (((x_46_im * y_46_re) / y_46_im) - 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, -8.8e+36], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 17.0], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -8.8 \cdot 10^{+36}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{elif}\;y.re \leq 17:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\end{array}
\end{array}
if y.re < -8.80000000000000002e36 or 17 < y.re Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.4
Applied rewrites43.4%
if -8.80000000000000002e36 < y.re < 17Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
lift-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-flip-reverseN/A
lower--.f6451.8
Applied rewrites51.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (/ (- x.re) y.im))) (if (<= y.im -1.25e+45) t_0 (if (<= y.im 9e+81) (/ x.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 <= -1.25e+45) {
tmp = t_0;
} else if (y_46_im <= 9e+81) {
tmp = x_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 <= (-1.25d+45)) then
tmp = t_0
else if (y_46im <= 9d+81) then
tmp = x_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 <= -1.25e+45) {
tmp = t_0;
} else if (y_46_im <= 9e+81) {
tmp = x_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 <= -1.25e+45: tmp = t_0 elif y_46_im <= 9e+81: tmp = x_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 <= -1.25e+45) tmp = t_0; elseif (y_46_im <= 9e+81) tmp = Float64(x_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 <= -1.25e+45) tmp = t_0; elseif (y_46_im <= 9e+81) tmp = x_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, -1.25e+45], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(x$46$im / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.25 \cdot 10^{+45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im}{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.im < -1.25e45 or 9.00000000000000034e81 < y.im Initial program 62.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6462.2
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lower-fma.f6462.2
Applied rewrites62.2%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-fma.f64N/A
lower-/.f64N/A
lower-*.f6451.8
Applied rewrites51.8%
Taylor expanded in x.re around inf
lower-*.f6442.5
Applied rewrites42.5%
lift-*.f64N/A
mul-1-negN/A
lift-neg.f6442.5
Applied rewrites42.5%
if -1.25e45 < y.im < 9.00000000000000034e81Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.4
Applied rewrites43.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = x_46im / y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_re) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}
\\
\frac{x.im}{y.re}
\end{array}
Initial program 62.2%
Taylor expanded in y.re around inf
lower-/.f6443.4
Applied rewrites43.4%
herbie shell --seed 2025156
(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))))