
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ z0 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(z0 / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[(z0 / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ z0 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(z0 / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = z0 / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[(z0 / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(*
(/ z0 (+ (* (/ z3 (fabs z4)) (/ z2 (fabs z4))) (/ z1 z2)))
z2)))
(if (<= (fabs z4) 3.3e-208)
t_0
(if (<= (fabs z4) 4.1e-8)
(*
(* z2 (fabs z4))
(*
(fabs z4)
(/ z0 (+ (* z2 z3) (/ (* z1 (* (fabs z4) (fabs z4))) z2)))))
t_0))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (z0 / (((z3 / fabs(z4)) * (z2 / fabs(z4))) + (z1 / z2))) * z2;
double tmp;
if (fabs(z4) <= 3.3e-208) {
tmp = t_0;
} else if (fabs(z4) <= 4.1e-8) {
tmp = (z2 * fabs(z4)) * (fabs(z4) * (z0 / ((z2 * z3) + ((z1 * (fabs(z4) * fabs(z4))) / z2))));
} 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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = (z0 / (((z3 / abs(z4)) * (z2 / abs(z4))) + (z1 / z2))) * z2
if (abs(z4) <= 3.3d-208) then
tmp = t_0
else if (abs(z4) <= 4.1d-8) then
tmp = (z2 * abs(z4)) * (abs(z4) * (z0 / ((z2 * z3) + ((z1 * (abs(z4) * abs(z4))) / z2))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (z0 / (((z3 / Math.abs(z4)) * (z2 / Math.abs(z4))) + (z1 / z2))) * z2;
double tmp;
if (Math.abs(z4) <= 3.3e-208) {
tmp = t_0;
} else if (Math.abs(z4) <= 4.1e-8) {
tmp = (z2 * Math.abs(z4)) * (Math.abs(z4) * (z0 / ((z2 * z3) + ((z1 * (Math.abs(z4) * Math.abs(z4))) / z2))));
} else {
tmp = t_0;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = (z0 / (((z3 / math.fabs(z4)) * (z2 / math.fabs(z4))) + (z1 / z2))) * z2 tmp = 0 if math.fabs(z4) <= 3.3e-208: tmp = t_0 elif math.fabs(z4) <= 4.1e-8: tmp = (z2 * math.fabs(z4)) * (math.fabs(z4) * (z0 / ((z2 * z3) + ((z1 * (math.fabs(z4) * math.fabs(z4))) / z2)))) else: tmp = t_0 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(z0 / Float64(Float64(Float64(z3 / abs(z4)) * Float64(z2 / abs(z4))) + Float64(z1 / z2))) * z2) tmp = 0.0 if (abs(z4) <= 3.3e-208) tmp = t_0; elseif (abs(z4) <= 4.1e-8) tmp = Float64(Float64(z2 * abs(z4)) * Float64(abs(z4) * Float64(z0 / Float64(Float64(z2 * z3) + Float64(Float64(z1 * Float64(abs(z4) * abs(z4))) / z2))))); else tmp = t_0; end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = (z0 / (((z3 / abs(z4)) * (z2 / abs(z4))) + (z1 / z2))) * z2; tmp = 0.0; if (abs(z4) <= 3.3e-208) tmp = t_0; elseif (abs(z4) <= 4.1e-8) tmp = (z2 * abs(z4)) * (abs(z4) * (z0 / ((z2 * z3) + ((z1 * (abs(z4) * abs(z4))) / z2)))); else tmp = t_0; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(z0 / N[(N[(N[(z3 / N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[(z2 / N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 3.3e-208], t$95$0, If[LessEqual[N[Abs[z4], $MachinePrecision], 4.1e-8], N[(N[(z2 * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[z4], $MachinePrecision] * N[(z0 / N[(N[(z2 * z3), $MachinePrecision] + N[(N[(z1 * N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
t_0 := \frac{z0}{\frac{z3}{\left|z4\right|} \cdot \frac{z2}{\left|z4\right|} + \frac{z1}{z2}} \cdot z2\\
\mathbf{if}\;\left|z4\right| \leq 3.3 \cdot 10^{-208}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\left|z4\right| \leq 4.1 \cdot 10^{-8}:\\
\;\;\;\;\left(z2 \cdot \left|z4\right|\right) \cdot \left(\left|z4\right| \cdot \frac{z0}{z2 \cdot z3 + \frac{z1 \cdot \left(\left|z4\right| \cdot \left|z4\right|\right)}{z2}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
if z4 < 3.3000000000000001e-208 or 4.1000000000000003e-8 < z4 Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6486.3%
Applied rewrites86.3%
if 3.3000000000000001e-208 < z4 < 4.1000000000000003e-8Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.2%
Applied rewrites53.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6464.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6464.6%
Applied rewrites64.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 1.5e-103)
(*
(* (/ (fabs z2) (+ (* (* (fabs z2) t_0) (fabs z2)) z1)) z0)
(fabs z2))
(if (<= (fabs z2) 1e+140)
(/ z0 (+ (/ (/ z3 z4) z4) (/ z1 (* (fabs z2) (fabs z2)))))
(/ z0 (+ t_0 (/ (/ z1 (fabs z2)) (fabs z2))))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (fabs(z2) <= 1.5e-103) {
tmp = ((fabs(z2) / (((fabs(z2) * t_0) * fabs(z2)) + z1)) * z0) * fabs(z2);
} else if (fabs(z2) <= 1e+140) {
tmp = z0 / (((z3 / z4) / z4) + (z1 / (fabs(z2) * fabs(z2))));
} else {
tmp = z0 / (t_0 + ((z1 / fabs(z2)) / fabs(z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = z3 / (z4 * z4)
if (abs(z2) <= 1.5d-103) then
tmp = ((abs(z2) / (((abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2)
else if (abs(z2) <= 1d+140) then
tmp = z0 / (((z3 / z4) / z4) + (z1 / (abs(z2) * abs(z2))))
else
tmp = z0 / (t_0 + ((z1 / abs(z2)) / abs(z2)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (Math.abs(z2) <= 1.5e-103) {
tmp = ((Math.abs(z2) / (((Math.abs(z2) * t_0) * Math.abs(z2)) + z1)) * z0) * Math.abs(z2);
} else if (Math.abs(z2) <= 1e+140) {
tmp = z0 / (((z3 / z4) / z4) + (z1 / (Math.abs(z2) * Math.abs(z2))));
} else {
tmp = z0 / (t_0 + ((z1 / Math.abs(z2)) / Math.abs(z2)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if math.fabs(z2) <= 1.5e-103: tmp = ((math.fabs(z2) / (((math.fabs(z2) * t_0) * math.fabs(z2)) + z1)) * z0) * math.fabs(z2) elif math.fabs(z2) <= 1e+140: tmp = z0 / (((z3 / z4) / z4) + (z1 / (math.fabs(z2) * math.fabs(z2)))) else: tmp = z0 / (t_0 + ((z1 / math.fabs(z2)) / math.fabs(z2))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (abs(z2) <= 1.5e-103) tmp = Float64(Float64(Float64(abs(z2) / Float64(Float64(Float64(abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2)); elseif (abs(z2) <= 1e+140) tmp = Float64(z0 / Float64(Float64(Float64(z3 / z4) / z4) + Float64(z1 / Float64(abs(z2) * abs(z2))))); else tmp = Float64(z0 / Float64(t_0 + Float64(Float64(z1 / abs(z2)) / abs(z2)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if (abs(z2) <= 1.5e-103) tmp = ((abs(z2) / (((abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2); elseif (abs(z2) <= 1e+140) tmp = z0 / (((z3 / z4) / z4) + (z1 / (abs(z2) * abs(z2)))); else tmp = z0 / (t_0 + ((z1 / abs(z2)) / abs(z2))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 1.5e-103], N[(N[(N[(N[Abs[z2], $MachinePrecision] / N[(N[(N[(N[Abs[z2], $MachinePrecision] * t$95$0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z2], $MachinePrecision], 1e+140], N[(z0 / N[(N[(N[(z3 / z4), $MachinePrecision] / z4), $MachinePrecision] + N[(z1 / N[(N[Abs[z2], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z0 / N[(t$95$0 + N[(N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision] / N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;\left|z2\right| \leq 1.5 \cdot 10^{-103}:\\
\;\;\;\;\left(\frac{\left|z2\right|}{\left(\left|z2\right| \cdot t\_0\right) \cdot \left|z2\right| + z1} \cdot z0\right) \cdot \left|z2\right|\\
\mathbf{elif}\;\left|z2\right| \leq 10^{+140}:\\
\;\;\;\;\frac{z0}{\frac{\frac{z3}{z4}}{z4} + \frac{z1}{\left|z2\right| \cdot \left|z2\right|}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{\frac{z1}{\left|z2\right|}}{\left|z2\right|}}\\
\end{array}
if z2 < 1.5e-103Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.8%
if 1.5e-103 < z2 < 1.0000000000000001e140Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.2%
Applied rewrites81.2%
if 1.0000000000000001e140 < z2 Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 1.5e-103)
(*
(* (/ (fabs z2) (+ (* (* (fabs z2) t_0) (fabs z2)) z1)) z0)
(fabs z2))
(/ z0 (+ t_0 (/ (/ z1 (fabs z2)) (fabs z2)))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (fabs(z2) <= 1.5e-103) {
tmp = ((fabs(z2) / (((fabs(z2) * t_0) * fabs(z2)) + z1)) * z0) * fabs(z2);
} else {
tmp = z0 / (t_0 + ((z1 / fabs(z2)) / fabs(z2)));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = z3 / (z4 * z4)
if (abs(z2) <= 1.5d-103) then
tmp = ((abs(z2) / (((abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2)
else
tmp = z0 / (t_0 + ((z1 / abs(z2)) / abs(z2)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (Math.abs(z2) <= 1.5e-103) {
tmp = ((Math.abs(z2) / (((Math.abs(z2) * t_0) * Math.abs(z2)) + z1)) * z0) * Math.abs(z2);
} else {
tmp = z0 / (t_0 + ((z1 / Math.abs(z2)) / Math.abs(z2)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if math.fabs(z2) <= 1.5e-103: tmp = ((math.fabs(z2) / (((math.fabs(z2) * t_0) * math.fabs(z2)) + z1)) * z0) * math.fabs(z2) else: tmp = z0 / (t_0 + ((z1 / math.fabs(z2)) / math.fabs(z2))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (abs(z2) <= 1.5e-103) tmp = Float64(Float64(Float64(abs(z2) / Float64(Float64(Float64(abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2)); else tmp = Float64(z0 / Float64(t_0 + Float64(Float64(z1 / abs(z2)) / abs(z2)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if (abs(z2) <= 1.5e-103) tmp = ((abs(z2) / (((abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2); else tmp = z0 / (t_0 + ((z1 / abs(z2)) / abs(z2))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 1.5e-103], N[(N[(N[(N[Abs[z2], $MachinePrecision] / N[(N[(N[(N[Abs[z2], $MachinePrecision] * t$95$0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], N[(z0 / N[(t$95$0 + N[(N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision] / N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;\left|z2\right| \leq 1.5 \cdot 10^{-103}:\\
\;\;\;\;\left(\frac{\left|z2\right|}{\left(\left|z2\right| \cdot t\_0\right) \cdot \left|z2\right| + z1} \cdot z0\right) \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{\frac{z1}{\left|z2\right|}}{\left|z2\right|}}\\
\end{array}
if z2 < 1.5e-103Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.8%
if 1.5e-103 < z2 Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))) (t_1 (/ z0 (+ t_0 (/ z1 (* z2 z2))))))
(if (<= t_0 (- INFINITY))
(* (* z2 z4) (* z4 (/ z0 (* z2 z3))))
(if (<= t_0 -1e-307)
t_1
(if (<= t_0 5e-195) (* (* z2 z0) (/ z2 z1)) t_1)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = z0 / (t_0 + (z1 / (z2 * z2)));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (z2 * z4) * (z4 * (z0 / (z2 * z3)));
} else if (t_0 <= -1e-307) {
tmp = t_1;
} else if (t_0 <= 5e-195) {
tmp = (z2 * z0) * (z2 / z1);
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = z0 / (t_0 + (z1 / (z2 * z2)));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (z2 * z4) * (z4 * (z0 / (z2 * z3)));
} else if (t_0 <= -1e-307) {
tmp = t_1;
} else if (t_0 <= 5e-195) {
tmp = (z2 * z0) * (z2 / z1);
} else {
tmp = t_1;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) t_1 = z0 / (t_0 + (z1 / (z2 * z2))) tmp = 0 if t_0 <= -math.inf: tmp = (z2 * z4) * (z4 * (z0 / (z2 * z3))) elif t_0 <= -1e-307: tmp = t_1 elif t_0 <= 5e-195: tmp = (z2 * z0) * (z2 / z1) else: tmp = t_1 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) t_1 = Float64(z0 / Float64(t_0 + Float64(z1 / Float64(z2 * z2)))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(z2 * z4) * Float64(z4 * Float64(z0 / Float64(z2 * z3)))); elseif (t_0 <= -1e-307) tmp = t_1; elseif (t_0 <= 5e-195) tmp = Float64(Float64(z2 * z0) * Float64(z2 / z1)); else tmp = t_1; end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); t_1 = z0 / (t_0 + (z1 / (z2 * z2))); tmp = 0.0; if (t_0 <= -Inf) tmp = (z2 * z4) * (z4 * (z0 / (z2 * z3))); elseif (t_0 <= -1e-307) tmp = t_1; elseif (t_0 <= 5e-195) tmp = (z2 * z0) * (z2 / z1); else tmp = t_1; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z0 / N[(t$95$0 + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(z2 * z4), $MachinePrecision] * N[(z4 * N[(z0 / N[(z2 * z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e-307], t$95$1, If[LessEqual[t$95$0, 5e-195], N[(N[(z2 * z0), $MachinePrecision] * N[(z2 / z1), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \frac{z0}{t\_0 + \frac{z1}{z2 \cdot z2}}\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(z2 \cdot z4\right) \cdot \left(z4 \cdot \frac{z0}{z2 \cdot z3}\right)\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{-307}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-195}:\\
\;\;\;\;\left(z2 \cdot z0\right) \cdot \frac{z2}{z1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 z3 (*.f64 z4 z4)) < -inf.0Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.2%
Applied rewrites53.2%
Taylor expanded in z3 around inf
lower-/.f64N/A
lower-*.f6440.1%
Applied rewrites40.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6444.0%
Applied rewrites44.0%
if -inf.0 < (/.f64 z3 (*.f64 z4 z4)) < -9.9999999999999991e-308 or 5.0000000000000001e-195 < (/.f64 z3 (*.f64 z4 z4)) Initial program 76.6%
if -9.9999999999999991e-308 < (/.f64 z3 (*.f64 z4 z4)) < 5.0000000000000001e-195Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9%
Applied rewrites55.9%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))) (t_1 (* (fabs z2) t_0)))
(if (<= (fabs z2) 1.5e-103)
(* (* (/ (fabs z2) (+ (* t_1 (fabs z2)) z1)) z0) (fabs z2))
(if (<= (fabs z2) 1.28e+238)
(* z0 (/ (fabs z2) (+ t_1 (/ z1 (fabs z2)))))
(/ z0 (+ t_0 (/ z1 (* (fabs z2) (fabs z2)))))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = fabs(z2) * t_0;
double tmp;
if (fabs(z2) <= 1.5e-103) {
tmp = ((fabs(z2) / ((t_1 * fabs(z2)) + z1)) * z0) * fabs(z2);
} else if (fabs(z2) <= 1.28e+238) {
tmp = z0 * (fabs(z2) / (t_1 + (z1 / fabs(z2))));
} else {
tmp = z0 / (t_0 + (z1 / (fabs(z2) * fabs(z2))));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z3 / (z4 * z4)
t_1 = abs(z2) * t_0
if (abs(z2) <= 1.5d-103) then
tmp = ((abs(z2) / ((t_1 * abs(z2)) + z1)) * z0) * abs(z2)
else if (abs(z2) <= 1.28d+238) then
tmp = z0 * (abs(z2) / (t_1 + (z1 / abs(z2))))
else
tmp = z0 / (t_0 + (z1 / (abs(z2) * abs(z2))))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = Math.abs(z2) * t_0;
double tmp;
if (Math.abs(z2) <= 1.5e-103) {
tmp = ((Math.abs(z2) / ((t_1 * Math.abs(z2)) + z1)) * z0) * Math.abs(z2);
} else if (Math.abs(z2) <= 1.28e+238) {
tmp = z0 * (Math.abs(z2) / (t_1 + (z1 / Math.abs(z2))));
} else {
tmp = z0 / (t_0 + (z1 / (Math.abs(z2) * Math.abs(z2))));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) t_1 = math.fabs(z2) * t_0 tmp = 0 if math.fabs(z2) <= 1.5e-103: tmp = ((math.fabs(z2) / ((t_1 * math.fabs(z2)) + z1)) * z0) * math.fabs(z2) elif math.fabs(z2) <= 1.28e+238: tmp = z0 * (math.fabs(z2) / (t_1 + (z1 / math.fabs(z2)))) else: tmp = z0 / (t_0 + (z1 / (math.fabs(z2) * math.fabs(z2)))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) t_1 = Float64(abs(z2) * t_0) tmp = 0.0 if (abs(z2) <= 1.5e-103) tmp = Float64(Float64(Float64(abs(z2) / Float64(Float64(t_1 * abs(z2)) + z1)) * z0) * abs(z2)); elseif (abs(z2) <= 1.28e+238) tmp = Float64(z0 * Float64(abs(z2) / Float64(t_1 + Float64(z1 / abs(z2))))); else tmp = Float64(z0 / Float64(t_0 + Float64(z1 / Float64(abs(z2) * abs(z2))))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); t_1 = abs(z2) * t_0; tmp = 0.0; if (abs(z2) <= 1.5e-103) tmp = ((abs(z2) / ((t_1 * abs(z2)) + z1)) * z0) * abs(z2); elseif (abs(z2) <= 1.28e+238) tmp = z0 * (abs(z2) / (t_1 + (z1 / abs(z2)))); else tmp = z0 / (t_0 + (z1 / (abs(z2) * abs(z2)))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[z2], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 1.5e-103], N[(N[(N[(N[Abs[z2], $MachinePrecision] / N[(N[(t$95$1 * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z2], $MachinePrecision], 1.28e+238], N[(z0 * N[(N[Abs[z2], $MachinePrecision] / N[(t$95$1 + N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z0 / N[(t$95$0 + N[(z1 / N[(N[Abs[z2], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \left|z2\right| \cdot t\_0\\
\mathbf{if}\;\left|z2\right| \leq 1.5 \cdot 10^{-103}:\\
\;\;\;\;\left(\frac{\left|z2\right|}{t\_1 \cdot \left|z2\right| + z1} \cdot z0\right) \cdot \left|z2\right|\\
\mathbf{elif}\;\left|z2\right| \leq 1.28 \cdot 10^{+238}:\\
\;\;\;\;z0 \cdot \frac{\left|z2\right|}{t\_1 + \frac{z1}{\left|z2\right|}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{z1}{\left|z2\right| \cdot \left|z2\right|}}\\
\end{array}
if z2 < 1.5e-103Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.8%
if 1.5e-103 < z2 < 1.2800000000000001e238Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6480.1%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6480.1%
Applied rewrites80.1%
if 1.2800000000000001e238 < z2 Initial program 76.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 7.8e+211)
(*
(* (/ (fabs z2) (+ (* (* (fabs z2) t_0) (fabs z2)) z1)) z0)
(fabs z2))
(/ z0 (+ t_0 (/ z1 (* (fabs z2) (fabs z2))))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (fabs(z2) <= 7.8e+211) {
tmp = ((fabs(z2) / (((fabs(z2) * t_0) * fabs(z2)) + z1)) * z0) * fabs(z2);
} else {
tmp = z0 / (t_0 + (z1 / (fabs(z2) * fabs(z2))));
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = z3 / (z4 * z4)
if (abs(z2) <= 7.8d+211) then
tmp = ((abs(z2) / (((abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2)
else
tmp = z0 / (t_0 + (z1 / (abs(z2) * abs(z2))))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (Math.abs(z2) <= 7.8e+211) {
tmp = ((Math.abs(z2) / (((Math.abs(z2) * t_0) * Math.abs(z2)) + z1)) * z0) * Math.abs(z2);
} else {
tmp = z0 / (t_0 + (z1 / (Math.abs(z2) * Math.abs(z2))));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if math.fabs(z2) <= 7.8e+211: tmp = ((math.fabs(z2) / (((math.fabs(z2) * t_0) * math.fabs(z2)) + z1)) * z0) * math.fabs(z2) else: tmp = z0 / (t_0 + (z1 / (math.fabs(z2) * math.fabs(z2)))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (abs(z2) <= 7.8e+211) tmp = Float64(Float64(Float64(abs(z2) / Float64(Float64(Float64(abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2)); else tmp = Float64(z0 / Float64(t_0 + Float64(z1 / Float64(abs(z2) * abs(z2))))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if (abs(z2) <= 7.8e+211) tmp = ((abs(z2) / (((abs(z2) * t_0) * abs(z2)) + z1)) * z0) * abs(z2); else tmp = z0 / (t_0 + (z1 / (abs(z2) * abs(z2)))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 7.8e+211], N[(N[(N[(N[Abs[z2], $MachinePrecision] / N[(N[(N[(N[Abs[z2], $MachinePrecision] * t$95$0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], N[(z0 / N[(t$95$0 + N[(z1 / N[(N[Abs[z2], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;\left|z2\right| \leq 7.8 \cdot 10^{+211}:\\
\;\;\;\;\left(\frac{\left|z2\right|}{\left(\left|z2\right| \cdot t\_0\right) \cdot \left|z2\right| + z1} \cdot z0\right) \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{z1}{\left|z2\right| \cdot \left|z2\right|}}\\
\end{array}
if z2 < 7.8000000000000005e211Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lower-+.f6480.8%
Applied rewrites80.8%
lift-/.f64N/A
mult-flipN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites78.8%
if 7.8000000000000005e211 < z2 Initial program 76.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(if (<= (fabs z4) 5e-180)
(* (* z2 (fabs z4)) (* (fabs z4) (/ z0 (* z2 z3))))
(if (<= (fabs z4) 110000000.0)
(* (/ (/ z0 z3) z2) (* z2 (* (fabs z4) (fabs z4))))
(* (* (/ 1.0 z1) z2) (* z2 z0)))))double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z4) <= 5e-180) {
tmp = (z2 * fabs(z4)) * (fabs(z4) * (z0 / (z2 * z3)));
} else if (fabs(z4) <= 110000000.0) {
tmp = ((z0 / z3) / z2) * (z2 * (fabs(z4) * fabs(z4)));
} else {
tmp = ((1.0 / z1) * z2) * (z2 * z0);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (abs(z4) <= 5d-180) then
tmp = (z2 * abs(z4)) * (abs(z4) * (z0 / (z2 * z3)))
else if (abs(z4) <= 110000000.0d0) then
tmp = ((z0 / z3) / z2) * (z2 * (abs(z4) * abs(z4)))
else
tmp = ((1.0d0 / z1) * z2) * (z2 * z0)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (Math.abs(z4) <= 5e-180) {
tmp = (z2 * Math.abs(z4)) * (Math.abs(z4) * (z0 / (z2 * z3)));
} else if (Math.abs(z4) <= 110000000.0) {
tmp = ((z0 / z3) / z2) * (z2 * (Math.abs(z4) * Math.abs(z4)));
} else {
tmp = ((1.0 / z1) * z2) * (z2 * z0);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z4) <= 5e-180: tmp = (z2 * math.fabs(z4)) * (math.fabs(z4) * (z0 / (z2 * z3))) elif math.fabs(z4) <= 110000000.0: tmp = ((z0 / z3) / z2) * (z2 * (math.fabs(z4) * math.fabs(z4))) else: tmp = ((1.0 / z1) * z2) * (z2 * z0) return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z4) <= 5e-180) tmp = Float64(Float64(z2 * abs(z4)) * Float64(abs(z4) * Float64(z0 / Float64(z2 * z3)))); elseif (abs(z4) <= 110000000.0) tmp = Float64(Float64(Float64(z0 / z3) / z2) * Float64(z2 * Float64(abs(z4) * abs(z4)))); else tmp = Float64(Float64(Float64(1.0 / z1) * z2) * Float64(z2 * z0)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z4) <= 5e-180) tmp = (z2 * abs(z4)) * (abs(z4) * (z0 / (z2 * z3))); elseif (abs(z4) <= 110000000.0) tmp = ((z0 / z3) / z2) * (z2 * (abs(z4) * abs(z4))); else tmp = ((1.0 / z1) * z2) * (z2 * z0); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 5e-180], N[(N[(z2 * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[z4], $MachinePrecision] * N[(z0 / N[(z2 * z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z4], $MachinePrecision], 110000000.0], N[(N[(N[(z0 / z3), $MachinePrecision] / z2), $MachinePrecision] * N[(z2 * N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 / z1), $MachinePrecision] * z2), $MachinePrecision] * N[(z2 * z0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 5 \cdot 10^{-180}:\\
\;\;\;\;\left(z2 \cdot \left|z4\right|\right) \cdot \left(\left|z4\right| \cdot \frac{z0}{z2 \cdot z3}\right)\\
\mathbf{elif}\;\left|z4\right| \leq 110000000:\\
\;\;\;\;\frac{\frac{z0}{z3}}{z2} \cdot \left(z2 \cdot \left(\left|z4\right| \cdot \left|z4\right|\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{z1} \cdot z2\right) \cdot \left(z2 \cdot z0\right)\\
\end{array}
if z4 < 5.0000000000000001e-180Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.2%
Applied rewrites53.2%
Taylor expanded in z3 around inf
lower-/.f64N/A
lower-*.f6440.1%
Applied rewrites40.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6444.0%
Applied rewrites44.0%
if 5.0000000000000001e-180 < z4 < 1.1e8Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.2%
Applied rewrites53.2%
Taylor expanded in z3 around inf
lower-/.f64N/A
lower-*.f6440.1%
Applied rewrites40.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6443.5%
Applied rewrites43.5%
if 1.1e8 < z4 Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
mult-flip-revN/A
lift-/.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6455.8%
Applied rewrites55.8%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4)))
(t_1 (* (* z2 z4) (* z4 (/ z0 (* z2 z3))))))
(if (<= t_0 -5e+138)
t_1
(if (<= t_0 1e+23) (* (* z2 z0) (/ z2 z1)) t_1))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = (z2 * z4) * (z4 * (z0 / (z2 * z3)));
double tmp;
if (t_0 <= -5e+138) {
tmp = t_1;
} else if (t_0 <= 1e+23) {
tmp = (z2 * z0) * (z2 / z1);
} else {
tmp = t_1;
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z3 / (z4 * z4)
t_1 = (z2 * z4) * (z4 * (z0 / (z2 * z3)))
if (t_0 <= (-5d+138)) then
tmp = t_1
else if (t_0 <= 1d+23) then
tmp = (z2 * z0) * (z2 / z1)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = (z2 * z4) * (z4 * (z0 / (z2 * z3)));
double tmp;
if (t_0 <= -5e+138) {
tmp = t_1;
} else if (t_0 <= 1e+23) {
tmp = (z2 * z0) * (z2 / z1);
} else {
tmp = t_1;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) t_1 = (z2 * z4) * (z4 * (z0 / (z2 * z3))) tmp = 0 if t_0 <= -5e+138: tmp = t_1 elif t_0 <= 1e+23: tmp = (z2 * z0) * (z2 / z1) else: tmp = t_1 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) t_1 = Float64(Float64(z2 * z4) * Float64(z4 * Float64(z0 / Float64(z2 * z3)))) tmp = 0.0 if (t_0 <= -5e+138) tmp = t_1; elseif (t_0 <= 1e+23) tmp = Float64(Float64(z2 * z0) * Float64(z2 / z1)); else tmp = t_1; end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); t_1 = (z2 * z4) * (z4 * (z0 / (z2 * z3))); tmp = 0.0; if (t_0 <= -5e+138) tmp = t_1; elseif (t_0 <= 1e+23) tmp = (z2 * z0) * (z2 / z1); else tmp = t_1; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z2 * z4), $MachinePrecision] * N[(z4 * N[(z0 / N[(z2 * z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+138], t$95$1, If[LessEqual[t$95$0, 1e+23], N[(N[(z2 * z0), $MachinePrecision] * N[(z2 / z1), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \left(z2 \cdot z4\right) \cdot \left(z4 \cdot \frac{z0}{z2 \cdot z3}\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+138}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+23}:\\
\;\;\;\;\left(z2 \cdot z0\right) \cdot \frac{z2}{z1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 z3 (*.f64 z4 z4)) < -5.0000000000000002e138 or 9.9999999999999992e22 < (/.f64 z3 (*.f64 z4 z4)) Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.2%
Applied rewrites53.2%
Taylor expanded in z3 around inf
lower-/.f64N/A
lower-*.f6440.1%
Applied rewrites40.1%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6444.0%
Applied rewrites44.0%
if -5.0000000000000002e138 < (/.f64 z3 (*.f64 z4 z4)) < 9.9999999999999992e22Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9%
Applied rewrites55.9%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4)))
(t_1 (* (/ z0 (* z2 z3)) (* z2 (* z4 z4)))))
(if (<= t_0 -1e+153)
t_1
(if (<= t_0 1e+23) (* (* z2 z0) (/ z2 z1)) t_1))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = (z0 / (z2 * z3)) * (z2 * (z4 * z4));
double tmp;
if (t_0 <= -1e+153) {
tmp = t_1;
} else if (t_0 <= 1e+23) {
tmp = (z2 * z0) * (z2 / z1);
} else {
tmp = t_1;
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z3 / (z4 * z4)
t_1 = (z0 / (z2 * z3)) * (z2 * (z4 * z4))
if (t_0 <= (-1d+153)) then
tmp = t_1
else if (t_0 <= 1d+23) then
tmp = (z2 * z0) * (z2 / z1)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = (z0 / (z2 * z3)) * (z2 * (z4 * z4));
double tmp;
if (t_0 <= -1e+153) {
tmp = t_1;
} else if (t_0 <= 1e+23) {
tmp = (z2 * z0) * (z2 / z1);
} else {
tmp = t_1;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) t_1 = (z0 / (z2 * z3)) * (z2 * (z4 * z4)) tmp = 0 if t_0 <= -1e+153: tmp = t_1 elif t_0 <= 1e+23: tmp = (z2 * z0) * (z2 / z1) else: tmp = t_1 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) t_1 = Float64(Float64(z0 / Float64(z2 * z3)) * Float64(z2 * Float64(z4 * z4))) tmp = 0.0 if (t_0 <= -1e+153) tmp = t_1; elseif (t_0 <= 1e+23) tmp = Float64(Float64(z2 * z0) * Float64(z2 / z1)); else tmp = t_1; end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); t_1 = (z0 / (z2 * z3)) * (z2 * (z4 * z4)); tmp = 0.0; if (t_0 <= -1e+153) tmp = t_1; elseif (t_0 <= 1e+23) tmp = (z2 * z0) * (z2 / z1); else tmp = t_1; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z0 / N[(z2 * z3), $MachinePrecision]), $MachinePrecision] * N[(z2 * N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+153], t$95$1, If[LessEqual[t$95$0, 1e+23], N[(N[(z2 * z0), $MachinePrecision] * N[(z2 / z1), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \frac{z0}{z2 \cdot z3} \cdot \left(z2 \cdot \left(z4 \cdot z4\right)\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+23}:\\
\;\;\;\;\left(z2 \cdot z0\right) \cdot \frac{z2}{z1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 z3 (*.f64 z4 z4)) < -1e153 or 9.9999999999999992e22 < (/.f64 z3 (*.f64 z4 z4)) Initial program 76.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6481.6%
Applied rewrites81.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6453.2%
Applied rewrites53.2%
Taylor expanded in z3 around inf
lower-/.f64N/A
lower-*.f6440.1%
Applied rewrites40.1%
if -1e153 < (/.f64 z3 (*.f64 z4 z4)) < 9.9999999999999992e22Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9%
Applied rewrites55.9%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (* (* z2 z0) (/ z2 z1)))
double code(double z0, double z3, double z4, double z1, double z2) {
return (z2 * z0) * (z2 / z1);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = (z2 * z0) * (z2 / z1)
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return (z2 * z0) * (z2 / z1);
}
def code(z0, z3, z4, z1, z2): return (z2 * z0) * (z2 / z1)
function code(z0, z3, z4, z1, z2) return Float64(Float64(z2 * z0) * Float64(z2 / z1)) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z2 * z0) * (z2 / z1); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z2 * z0), $MachinePrecision] * N[(z2 / z1), $MachinePrecision]), $MachinePrecision]
\left(z2 \cdot z0\right) \cdot \frac{z2}{z1}
Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6455.9%
Applied rewrites55.9%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (* z2 (* (/ z2 z1) z0)))
double code(double z0, double z3, double z4, double z1, double z2) {
return z2 * ((z2 / z1) * z0);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = z2 * ((z2 / z1) * z0)
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return z2 * ((z2 / z1) * z0);
}
def code(z0, z3, z4, z1, z2): return z2 * ((z2 / z1) * z0)
function code(z0, z3, z4, z1, z2) return Float64(z2 * Float64(Float64(z2 / z1) * z0)) end
function tmp = code(z0, z3, z4, z1, z2) tmp = z2 * ((z2 / z1) * z0); end
code[z0_, z3_, z4_, z1_, z2_] := N[(z2 * N[(N[(z2 / z1), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]
z2 \cdot \left(\frac{z2}{z1} \cdot z0\right)
Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6455.7%
Applied rewrites55.7%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (* z2 (* (/ z0 z1) z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
return z2 * ((z0 / z1) * z2);
}
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(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
code = z2 * ((z0 / z1) * z2)
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return z2 * ((z0 / z1) * z2);
}
def code(z0, z3, z4, z1, z2): return z2 * ((z0 / z1) * z2)
function code(z0, z3, z4, z1, z2) return Float64(z2 * Float64(Float64(z0 / z1) * z2)) end
function tmp = code(z0, z3, z4, z1, z2) tmp = z2 * ((z0 / z1) * z2); end
code[z0_, z3_, z4_, z1_, z2_] := N[(z2 * N[(N[(z0 / z1), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]
z2 \cdot \left(\frac{z0}{z1} \cdot z2\right)
Initial program 76.6%
Taylor expanded in z3 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.2%
Applied rewrites50.2%
lift-/.f64N/A
lift-*.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6449.8%
Applied rewrites49.8%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6455.7%
Applied rewrites55.7%
lift-*.f64N/A
lift-/.f64N/A
mult-flipN/A
lift-/.f64N/A
associate-*l*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lower-/.f6454.0%
Applied rewrites54.0%
herbie shell --seed 2025250
(FPCore (z0 z3 z4 z1 z2)
:name "(/ z0 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))"
:precision binary64
(/ z0 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))