
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x.re \cdot y.re + x.im \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.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{x.re \cdot y.re + x.im \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 (+ (* x.re y.re) (* x.im y.im))))
(if (<=
(/ t_0 (+ (* y.re y.re) (* y.im y.im)))
999999999999999973438224854160227305877518561122823750593712591987145964024444656694044404476868689015149167622996309190165824584023146941018349739309135463248122613459314107074039291811569329219648848907543004197890512187794469896370420793533163493423472892065087488)
(/ 1 (134-z0z1z2z3z4 1 y.re (/ y.re t_0) (- y.im) (/ y.im t_0)))
(/
(+ (* (/ y.im y.re) x.im) x.re)
(+ y.re (* y.im (/ y.im y.re)))))))\begin{array}{l}
t_0 := x.re \cdot y.re + x.im \cdot y.im\\
\mathbf{if}\;\frac{t\_0}{y.re \cdot y.re + y.im \cdot y.im} \leq 999999999999999973438224854160227305877518561122823750593712591987145964024444656694044404476868689015149167622996309190165824584023146941018349739309135463248122613459314107074039291811569329219648848907543004197890512187794469896370420793533163493423472892065087488:\\
\;\;\;\;\frac{1}{\mathsf{134\_z0z1z2z3z4}\left(1, y.re, \left(\frac{y.re}{t\_0}\right), \left(-y.im\right), \left(\frac{y.im}{t\_0}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y.im}{y.re} \cdot x.im + x.re}{y.re + y.im \cdot \frac{y.im}{y.re}}\\
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 9.9999999999999997e266Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
Applied rewrites74.8%
if 9.9999999999999997e266 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
remove-double-negN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lower-134-z0z1z2z3z4N/A
Applied rewrites74.6%
Applied rewrites73.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6474.0%
Applied rewrites74.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (+ (* x.re y.re) (* x.im y.im))))
(if (<=
(/ t_0 (+ (* y.re y.re) (* y.im y.im)))
999999999999999973438224854160227305877518561122823750593712591987145964024444656694044404476868689015149167622996309190165824584023146941018349739309135463248122613459314107074039291811569329219648848907543004197890512187794469896370420793533163493423472892065087488)
(/ 1 (134-z0z1z2z3z4 (/ 1 t_0) y.re y.re (- y.im) y.im))
(/
(+ (* (/ y.im y.re) x.im) x.re)
(+ y.re (* y.im (/ y.im y.re)))))))\begin{array}{l}
t_0 := x.re \cdot y.re + x.im \cdot y.im\\
\mathbf{if}\;\frac{t\_0}{y.re \cdot y.re + y.im \cdot y.im} \leq 999999999999999973438224854160227305877518561122823750593712591987145964024444656694044404476868689015149167622996309190165824584023146941018349739309135463248122613459314107074039291811569329219648848907543004197890512187794469896370420793533163493423472892065087488:\\
\;\;\;\;\frac{1}{\mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{t\_0}\right), y.re, y.re, \left(-y.im\right), y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y.im}{y.re} \cdot x.im + x.re}{y.re + y.im \cdot \frac{y.im}{y.re}}\\
\end{array}
if (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) < 9.9999999999999997e266Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
remove-double-negN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lower-134-z0z1z2z3z4N/A
Applied rewrites74.6%
if 9.9999999999999997e266 < (/.f64 (+.f64 (*.f64 x.re y.re) (*.f64 x.im y.im)) (+.f64 (*.f64 y.re y.re) (*.f64 y.im y.im))) Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
remove-double-negN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lower-134-z0z1z2z3z4N/A
Applied rewrites74.6%
Applied rewrites73.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6474.0%
Applied rewrites74.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(134-z0z1z2z3z4
(/ 1 (+ (* y.im y.im) (* y.re y.re)))
y.re
x.re
(- y.im)
x.im))
(t_1 (/ (+ x.re (* y.im (/ x.im y.re))) y.re)))
(if (<=
y.re
-37000000000000002379981636636512144685831624043141066347348880896803460347869454087840010420741356758931941763343665834541697022885967163606691741696)
t_1
(if (<=
y.re
-3542894613202767/28118211215894977392565865673037386617935606989386978956879722328823984879196799189494004288149317857187005691459505594520051662846839373056303219880407274094592)
t_0
(if (<=
y.re
2641773697375079/1886981212410770676120777290494134445458460610208220214188103150122812081196074426043063362588829383770734187515381922449885292314962396316280717125716348021824697663488)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
(if (<=
y.re
9500000000000000464508977071954836326929345476844199934965225938434110292099304203350012673833093478310948973559203807180191755665408)
t_0
t_1))))))\begin{array}{l}
t_0 := \mathsf{134\_z0z1z2z3z4}\left(\left(\frac{1}{y.im \cdot y.im + y.re \cdot y.re}\right), y.re, x.re, \left(-y.im\right), x.im\right)\\
t_1 := \frac{x.re + y.im \cdot \frac{x.im}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -37000000000000002379981636636512144685831624043141066347348880896803460347869454087840010420741356758931941763343665834541697022885967163606691741696:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq \frac{-3542894613202767}{28118211215894977392565865673037386617935606989386978956879722328823984879196799189494004288149317857187005691459505594520051662846839373056303219880407274094592}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq \frac{2641773697375079}{1886981212410770676120777290494134445458460610208220214188103150122812081196074426043063362588829383770734187515381922449885292314962396316280717125716348021824697663488}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{elif}\;y.re \leq 9500000000000000464508977071954836326929345476844199934965225938434110292099304203350012673833093478310948973559203807180191755665408:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if y.re < -3.7000000000000002e148 or 9.5000000000000005e132 < y.re Initial program 61.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.0%
Applied rewrites52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.2%
Applied rewrites53.2%
if -3.7000000000000002e148 < y.re < -1.2599999999999999e-145 or 1.4e-153 < y.re < 9.5000000000000005e132Initial program 61.4%
Applied rewrites63.5%
if -1.2599999999999999e-145 < y.re < 1.4e-153Initial program 61.4%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
y.re
-1562993992725273/744282853678701455922507579277316643178128753343813693728245963960974631028119473486019635930893891134220822124816566203939432067701407744)
(/ (+ (* (/ y.im y.re) x.im) x.re) (+ y.re (* y.im (/ y.im y.re))))
(if (<= y.re 3659834024223975/1180591620717411303424)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
(*
(/ 1 (+ (* (/ y.im y.re) y.im) y.re))
(+ (* (/ x.im y.re) y.im) x.re)))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -2.1e-123) {
tmp = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re)));
} else if (y_46_re <= 3.1e-6) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = (1.0 / (((y_46_im / y_46_re) * y_46_im) + y_46_re)) * (((x_46_im / y_46_re) * y_46_im) + x_46_re);
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-2.1d-123)) then
tmp = (((y_46im / y_46re) * x_46im) + x_46re) / (y_46re + (y_46im * (y_46im / y_46re)))
else if (y_46re <= 3.1d-6) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = (1.0d0 / (((y_46im / y_46re) * y_46im) + y_46re)) * (((x_46im / y_46re) * y_46im) + x_46re)
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -2.1e-123) {
tmp = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re)));
} else if (y_46_re <= 3.1e-6) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = (1.0 / (((y_46_im / y_46_re) * y_46_im) + y_46_re)) * (((x_46_im / y_46_re) * y_46_im) + x_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -2.1e-123: tmp = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re))) elif y_46_re <= 3.1e-6: tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im else: tmp = (1.0 / (((y_46_im / y_46_re) * y_46_im) + y_46_re)) * (((x_46_im / y_46_re) * y_46_im) + x_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -2.1e-123) tmp = Float64(Float64(Float64(Float64(y_46_im / y_46_re) * x_46_im) + x_46_re) / Float64(y_46_re + Float64(y_46_im * Float64(y_46_im / y_46_re)))); elseif (y_46_re <= 3.1e-6) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = Float64(Float64(1.0 / Float64(Float64(Float64(y_46_im / y_46_re) * y_46_im) + y_46_re)) * Float64(Float64(Float64(x_46_im / y_46_re) * y_46_im) + x_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -2.1e-123) tmp = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re))); elseif (y_46_re <= 3.1e-6) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = (1.0 / (((y_46_im / y_46_re) * y_46_im) + y_46_re)) * (((x_46_im / y_46_re) * y_46_im) + x_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, -1562993992725273/744282853678701455922507579277316643178128753343813693728245963960974631028119473486019635930893891134220822124816566203939432067701407744], N[(N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision] + x$46$re), $MachinePrecision] / N[(y$46$re + N[(y$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3659834024223975/1180591620717411303424], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(1 / N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision] + y$46$re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(x$46$im / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision] + x$46$re), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq \frac{-1562993992725273}{744282853678701455922507579277316643178128753343813693728245963960974631028119473486019635930893891134220822124816566203939432067701407744}:\\
\;\;\;\;\frac{\frac{y.im}{y.re} \cdot x.im + x.re}{y.re + y.im \cdot \frac{y.im}{y.re}}\\
\mathbf{elif}\;y.re \leq \frac{3659834024223975}{1180591620717411303424}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y.im}{y.re} \cdot y.im + y.re} \cdot \left(\frac{x.im}{y.re} \cdot y.im + x.re\right)\\
\end{array}
if y.re < -2.0999999999999999e-123Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
remove-double-negN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lower-134-z0z1z2z3z4N/A
Applied rewrites74.6%
Applied rewrites73.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6474.0%
Applied rewrites74.0%
if -2.0999999999999999e-123 < y.re < 3.1e-6Initial program 61.4%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
if 3.1e-6 < y.re Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
remove-double-negN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lower-134-z0z1z2z3z4N/A
Applied rewrites74.6%
Applied rewrites73.1%
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6474.7%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.7%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6474.7%
Applied rewrites74.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(/
(+ (* (/ y.im y.re) x.im) x.re)
(+ y.re (* y.im (/ y.im y.re))))))
(if (<=
y.re
-1562993992725273/744282853678701455922507579277316643178128753343813693728245963960974631028119473486019635930893891134220822124816566203939432067701407744)
t_0
(if (<= y.re 3659834024223975/1180591620717411303424)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
t_0))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re)));
double tmp;
if (y_46_re <= -2.1e-123) {
tmp = t_0;
} else if (y_46_re <= 3.1e-6) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (((y_46im / y_46re) * x_46im) + x_46re) / (y_46re + (y_46im * (y_46im / y_46re)))
if (y_46re <= (-2.1d-123)) then
tmp = t_0
else if (y_46re <= 3.1d-6) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re)));
double tmp;
if (y_46_re <= -2.1e-123) {
tmp = t_0;
} else if (y_46_re <= 3.1e-6) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re))) tmp = 0 if y_46_re <= -2.1e-123: tmp = t_0 elif y_46_re <= 3.1e-6: tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(Float64(Float64(y_46_im / y_46_re) * x_46_im) + x_46_re) / Float64(y_46_re + Float64(y_46_im * Float64(y_46_im / y_46_re)))) tmp = 0.0 if (y_46_re <= -2.1e-123) tmp = t_0; elseif (y_46_re <= 3.1e-6) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (((y_46_im / y_46_re) * x_46_im) + x_46_re) / (y_46_re + (y_46_im * (y_46_im / y_46_re))); tmp = 0.0; if (y_46_re <= -2.1e-123) tmp = t_0; elseif (y_46_re <= 3.1e-6) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$im), $MachinePrecision] + x$46$re), $MachinePrecision] / N[(y$46$re + N[(y$46$im * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1562993992725273/744282853678701455922507579277316643178128753343813693728245963960974631028119473486019635930893891134220822124816566203939432067701407744], t$95$0, If[LessEqual[y$46$re, 3659834024223975/1180591620717411303424], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{\frac{y.im}{y.re} \cdot x.im + x.re}{y.re + y.im \cdot \frac{y.im}{y.re}}\\
\mathbf{if}\;y.re \leq \frac{-1562993992725273}{744282853678701455922507579277316643178128753343813693728245963960974631028119473486019635930893891134220822124816566203939432067701407744}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq \frac{3659834024223975}{1180591620717411303424}:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -2.0999999999999999e-123 or 3.1e-6 < y.re Initial program 61.4%
lift-/.f64N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6461.2%
Applied rewrites61.2%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
add-flipN/A
sub-flipN/A
remove-double-negN/A
lift-*.f64N/A
sqr-abs-revN/A
sqr-neg-revN/A
fp-cancel-sign-sub-invN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
sqr-abs-revN/A
lift-*.f64N/A
lift-*.f64N/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
lower-134-z0z1z2z3z4N/A
Applied rewrites74.6%
Applied rewrites73.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f6474.0%
Applied rewrites74.0%
if -2.0999999999999999e-123 < y.re < 3.1e-6Initial program 61.4%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/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 (/ x.im y.re))) y.re)))
(if (<= y.re -330000000000000004409053041463916596751399087243264)
t_0
(if (<=
y.re
-3542894613202767/28118211215894977392565865673037386617935606989386978956879722328823984879196799189494004288149317857187005691459505594520051662846839373056303219880407274094592)
(/
(+ (* x.re y.re) (* x.im y.im))
(+ (* y.re y.re) (* y.im y.im)))
(if (<= y.re 2100)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
t_0)))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -3.3e+50) {
tmp = t_0;
} else if (y_46_re <= -1.26e-145) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_re <= 2100.0) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46re + (y_46im * (x_46im / y_46re))) / y_46re
if (y_46re <= (-3.3d+50)) then
tmp = t_0
else if (y_46re <= (-1.26d-145)) then
tmp = ((x_46re * y_46re) + (x_46im * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
else if (y_46re <= 2100.0d0) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -3.3e+50) {
tmp = t_0;
} else if (y_46_re <= -1.26e-145) {
tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else if (y_46_re <= 2100.0) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re tmp = 0 if y_46_re <= -3.3e+50: tmp = t_0 elif y_46_re <= -1.26e-145: tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) elif y_46_re <= 2100.0: tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_re + Float64(y_46_im * Float64(x_46_im / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_re <= -3.3e+50) tmp = t_0; elseif (y_46_re <= -1.26e-145) tmp = Float64(Float64(Float64(x_46_re * y_46_re) + Float64(x_46_im * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); elseif (y_46_re <= 2100.0) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re; tmp = 0.0; if (y_46_re <= -3.3e+50) tmp = t_0; elseif (y_46_re <= -1.26e-145) tmp = ((x_46_re * y_46_re) + (x_46_im * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); elseif (y_46_re <= 2100.0) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re + N[(y$46$im * N[(x$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -330000000000000004409053041463916596751399087243264], t$95$0, If[LessEqual[y$46$re, -3542894613202767/28118211215894977392565865673037386617935606989386978956879722328823984879196799189494004288149317857187005691459505594520051662846839373056303219880407274094592], N[(N[(N[(x$46$re * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2100], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
t_0 := \frac{x.re + y.im \cdot \frac{x.im}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -330000000000000004409053041463916596751399087243264:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq \frac{-3542894613202767}{28118211215894977392565865673037386617935606989386978956879722328823984879196799189494004288149317857187005691459505594520051662846839373056303219880407274094592}:\\
\;\;\;\;\frac{x.re \cdot y.re + x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{elif}\;y.re \leq 2100:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -3.3e50 or 2100 < y.re Initial program 61.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.0%
Applied rewrites52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.2%
Applied rewrites53.2%
if -3.3e50 < y.re < -1.2599999999999999e-145Initial program 61.4%
if -1.2599999999999999e-145 < y.re < 2100Initial program 61.4%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/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 (/ x.im y.re))) y.re)))
(if (<= y.re -1400000000000000)
t_0
(if (<= y.re 2100) (/ (+ x.im (/ (* x.re y.re) y.im)) y.im) t_0))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -1.4e+15) {
tmp = t_0;
} else if (y_46_re <= 2100.0) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = (x_46re + (y_46im * (x_46im / y_46re))) / y_46re
if (y_46re <= (-1.4d+15)) then
tmp = t_0
else if (y_46re <= 2100.0d0) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re;
double tmp;
if (y_46_re <= -1.4e+15) {
tmp = t_0;
} else if (y_46_re <= 2100.0) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re tmp = 0 if y_46_re <= -1.4e+15: tmp = t_0 elif y_46_re <= 2100.0: tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(Float64(x_46_re + Float64(y_46_im * Float64(x_46_im / y_46_re))) / y_46_re) tmp = 0.0 if (y_46_re <= -1.4e+15) tmp = t_0; elseif (y_46_re <= 2100.0) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = t_0; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = (x_46_re + (y_46_im * (x_46_im / y_46_re))) / y_46_re; tmp = 0.0; if (y_46_re <= -1.4e+15) tmp = t_0; elseif (y_46_re <= 2100.0) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$re + N[(y$46$im * N[(x$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1400000000000000], t$95$0, If[LessEqual[y$46$re, 2100], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{x.re + y.im \cdot \frac{x.im}{y.re}}{y.re}\\
\mathbf{if}\;y.re \leq -1400000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 2100:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if y.re < -1.4e15 or 2100 < y.re Initial program 61.4%
Taylor expanded in y.re around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.0%
Applied rewrites52.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6453.2%
Applied rewrites53.2%
if -1.4e15 < y.re < 2100Initial program 61.4%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1850000000000000)
(/ x.re y.re)
(if (<= y.re 2100)
(/ (+ x.im (/ (* x.re y.re) y.im)) y.im)
(/ x.re y.re))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.85e+15) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 2100.0) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-1.85d+15)) then
tmp = x_46re / y_46re
else if (y_46re <= 2100.0d0) then
tmp = (x_46im + ((x_46re * y_46re) / y_46im)) / y_46im
else
tmp = x_46re / y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.85e+15) {
tmp = x_46_re / y_46_re;
} else if (y_46_re <= 2100.0) {
tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im;
} else {
tmp = x_46_re / y_46_re;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -1.85e+15: tmp = x_46_re / y_46_re elif y_46_re <= 2100.0: tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im else: tmp = x_46_re / y_46_re return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -1.85e+15) tmp = Float64(x_46_re / y_46_re); elseif (y_46_re <= 2100.0) tmp = Float64(Float64(x_46_im + Float64(Float64(x_46_re * y_46_re) / y_46_im)) / y_46_im); else tmp = Float64(x_46_re / y_46_re); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -1.85e+15) tmp = x_46_re / y_46_re; elseif (y_46_re <= 2100.0) tmp = (x_46_im + ((x_46_re * y_46_re) / y_46_im)) / y_46_im; else tmp = x_46_re / y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -1850000000000000], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, 2100], N[(N[(x$46$im + N[(N[(x$46$re * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$im), $MachinePrecision], N[(x$46$re / y$46$re), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.re \leq -1850000000000000:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.re \leq 2100:\\
\;\;\;\;\frac{x.im + \frac{x.re \cdot y.re}{y.im}}{y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\end{array}
if y.re < -1.85e15 or 2100 < y.re Initial program 61.4%
Taylor expanded in y.re around inf
lower-/.f6442.9%
Applied rewrites42.9%
if -1.85e15 < y.re < 2100Initial program 61.4%
Taylor expanded in y.im around inf
lower-/.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-*.f6452.8%
Applied rewrites52.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
y.im
-7532522082464017/1569275433846670190958947355801916604025588861116008628224)
(/ x.im y.im)
(if (<=
y.im
6669624340069413/14821387422376473014217086081112052205218558037201992197050570753012880593911808)
(/ x.re y.re)
(if (<=
y.im
299999999999999991244276315770311082355742815852255117122775019660409004448878539794728754348032)
(/ (* x.im y.im) (+ (* y.re y.re) (* y.im y.im)))
(/ x.im y.im)))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -4.8e-42) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 4.5e-64) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 3e+95) {
tmp = (x_46_im * y_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46im <= (-4.8d-42)) then
tmp = x_46im / y_46im
else if (y_46im <= 4.5d-64) then
tmp = x_46re / y_46re
else if (y_46im <= 3d+95) then
tmp = (x_46im * y_46im) / ((y_46re * y_46re) + (y_46im * y_46im))
else
tmp = x_46im / y_46im
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -4.8e-42) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 4.5e-64) {
tmp = x_46_re / y_46_re;
} else if (y_46_im <= 3e+95) {
tmp = (x_46_im * y_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -4.8e-42: tmp = x_46_im / y_46_im elif y_46_im <= 4.5e-64: tmp = x_46_re / y_46_re elif y_46_im <= 3e+95: tmp = (x_46_im * y_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)) else: tmp = x_46_im / y_46_im return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -4.8e-42) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 4.5e-64) tmp = Float64(x_46_re / y_46_re); elseif (y_46_im <= 3e+95) tmp = Float64(Float64(x_46_im * y_46_im) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im))); else tmp = Float64(x_46_im / y_46_im); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_im <= -4.8e-42) tmp = x_46_im / y_46_im; elseif (y_46_im <= 4.5e-64) tmp = x_46_re / y_46_re; elseif (y_46_im <= 3e+95) tmp = (x_46_im * y_46_im) / ((y_46_re * y_46_re) + (y_46_im * y_46_im)); else tmp = x_46_im / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -7532522082464017/1569275433846670190958947355801916604025588861116008628224], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 6669624340069413/14821387422376473014217086081112052205218558037201992197050570753012880593911808], N[(x$46$re / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 299999999999999991244276315770311082355742815852255117122775019660409004448878539794728754348032], N[(N[(x$46$im * y$46$im), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]]
\begin{array}{l}
\mathbf{if}\;y.im \leq \frac{-7532522082464017}{1569275433846670190958947355801916604025588861116008628224}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq \frac{6669624340069413}{14821387422376473014217086081112052205218558037201992197050570753012880593911808}:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{elif}\;y.im \leq 299999999999999991244276315770311082355742815852255117122775019660409004448878539794728754348032:\\
\;\;\;\;\frac{x.im \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
if y.im < -4.8000000000000001e-42 or 2.9999999999999999e95 < y.im Initial program 61.4%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
if -4.8000000000000001e-42 < y.im < 4.5000000000000001e-64Initial program 61.4%
Taylor expanded in y.re around inf
lower-/.f6442.9%
Applied rewrites42.9%
if 4.5000000000000001e-64 < y.im < 2.9999999999999999e95Initial program 61.4%
Taylor expanded in x.re around 0
lower-*.f6439.6%
Applied rewrites39.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<=
y.im
-7532522082464017/1569275433846670190958947355801916604025588861116008628224)
(/ x.im y.im)
(if (<= y.im 67999999999999999539024509856590702399396174052196352)
(/ x.re y.re)
(/ x.im y.im))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -4.8e-42) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 6.8e+52) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46im <= (-4.8d-42)) then
tmp = x_46im / y_46im
else if (y_46im <= 6.8d+52) then
tmp = x_46re / y_46re
else
tmp = x_46im / y_46im
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -4.8e-42) {
tmp = x_46_im / y_46_im;
} else if (y_46_im <= 6.8e+52) {
tmp = x_46_re / y_46_re;
} else {
tmp = x_46_im / y_46_im;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -4.8e-42: tmp = x_46_im / y_46_im elif y_46_im <= 6.8e+52: tmp = x_46_re / y_46_re else: tmp = x_46_im / y_46_im return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -4.8e-42) tmp = Float64(x_46_im / y_46_im); elseif (y_46_im <= 6.8e+52) tmp = Float64(x_46_re / y_46_re); else tmp = Float64(x_46_im / y_46_im); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_im <= -4.8e-42) tmp = x_46_im / y_46_im; elseif (y_46_im <= 6.8e+52) tmp = x_46_re / y_46_re; else tmp = x_46_im / y_46_im; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -7532522082464017/1569275433846670190958947355801916604025588861116008628224], N[(x$46$im / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 67999999999999999539024509856590702399396174052196352], N[(x$46$re / y$46$re), $MachinePrecision], N[(x$46$im / y$46$im), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y.im \leq \frac{-7532522082464017}{1569275433846670190958947355801916604025588861116008628224}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\mathbf{elif}\;y.im \leq 67999999999999999539024509856590702399396174052196352:\\
\;\;\;\;\frac{x.re}{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{x.im}{y.im}\\
\end{array}
if y.im < -4.8000000000000001e-42 or 6.8e52 < y.im Initial program 61.4%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
if -4.8000000000000001e-42 < y.im < 6.8e52Initial program 61.4%
Taylor expanded in y.re around inf
lower-/.f6442.9%
Applied rewrites42.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.im))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
code = x_46im / y_46im
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return x_46_im / y_46_im;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return x_46_im / y_46_im
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(x_46_im / y_46_im) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im / y_46_im; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$im), $MachinePrecision]
\frac{x.im}{y.im}
Initial program 61.4%
Taylor expanded in y.re around 0
lower-/.f6443.2%
Applied rewrites43.2%
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x.re x.im y.re y.im)
:name "_divideComplex, real part"
:precision binary64
(/ (+ (* x.re y.re) (* x.im y.im)) (+ (* y.re y.re) (* y.im y.im))))