
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (- z0 (* (* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0) z0)) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * 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 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * 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 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (- z0 (* (* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0) z0)) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * 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 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * 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 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (+ (/ z1 z2) (/ (* z2 z3) (pow (fabs z4) 2.0))))
(t_1 (/ z2 t_0))
(t_2
(-
z0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0))))
(if (<= (fabs z4) 3.7e-75)
(*
(/ t_2 (+ (* (/ z1 (* z2 z2)) (fabs z4)) (/ z3 (fabs z4))))
(fabs z4))
(if (<= (fabs z4) 1e+108)
(*
z0
(+
(*
z0
(+
(* 0.5 t_1)
(*
z0
(+
(* 0.25 (/ (* z0 z2) t_0))
(* 0.3333333333333333 t_1)))))
t_1))
(*
(/ t_2 (+ (* z2 (/ z3 (* (fabs z4) (fabs z4)))) (/ z1 z2)))
z2)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (z1 / z2) + ((z2 * z3) / pow(fabs(z4), 2.0));
double t_1 = z2 / t_0;
double t_2 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0);
double tmp;
if (fabs(z4) <= 3.7e-75) {
tmp = (t_2 / (((z1 / (z2 * z2)) * fabs(z4)) + (z3 / fabs(z4)))) * fabs(z4);
} else if (fabs(z4) <= 1e+108) {
tmp = z0 * ((z0 * ((0.5 * t_1) + (z0 * ((0.25 * ((z0 * z2) / t_0)) + (0.3333333333333333 * t_1))))) + t_1);
} else {
tmp = (t_2 / ((z2 * (z3 / (fabs(z4) * fabs(z4)))) + (z1 / z2))) * 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) :: t_2
real(8) :: tmp
t_0 = (z1 / z2) + ((z2 * z3) / (abs(z4) ** 2.0d0))
t_1 = z2 / t_0
t_2 = z0 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0)
if (abs(z4) <= 3.7d-75) then
tmp = (t_2 / (((z1 / (z2 * z2)) * abs(z4)) + (z3 / abs(z4)))) * abs(z4)
else if (abs(z4) <= 1d+108) then
tmp = z0 * ((z0 * ((0.5d0 * t_1) + (z0 * ((0.25d0 * ((z0 * z2) / t_0)) + (0.3333333333333333d0 * t_1))))) + t_1)
else
tmp = (t_2 / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (z1 / z2) + ((z2 * z3) / Math.pow(Math.abs(z4), 2.0));
double t_1 = z2 / t_0;
double t_2 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0);
double tmp;
if (Math.abs(z4) <= 3.7e-75) {
tmp = (t_2 / (((z1 / (z2 * z2)) * Math.abs(z4)) + (z3 / Math.abs(z4)))) * Math.abs(z4);
} else if (Math.abs(z4) <= 1e+108) {
tmp = z0 * ((z0 * ((0.5 * t_1) + (z0 * ((0.25 * ((z0 * z2) / t_0)) + (0.3333333333333333 * t_1))))) + t_1);
} else {
tmp = (t_2 / ((z2 * (z3 / (Math.abs(z4) * Math.abs(z4)))) + (z1 / z2))) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = (z1 / z2) + ((z2 * z3) / math.pow(math.fabs(z4), 2.0)) t_1 = z2 / t_0 t_2 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) tmp = 0 if math.fabs(z4) <= 3.7e-75: tmp = (t_2 / (((z1 / (z2 * z2)) * math.fabs(z4)) + (z3 / math.fabs(z4)))) * math.fabs(z4) elif math.fabs(z4) <= 1e+108: tmp = z0 * ((z0 * ((0.5 * t_1) + (z0 * ((0.25 * ((z0 * z2) / t_0)) + (0.3333333333333333 * t_1))))) + t_1) else: tmp = (t_2 / ((z2 * (z3 / (math.fabs(z4) * math.fabs(z4)))) + (z1 / z2))) * z2 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(z1 / z2) + Float64(Float64(z2 * z3) / (abs(z4) ^ 2.0))) t_1 = Float64(z2 / t_0) t_2 = Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) tmp = 0.0 if (abs(z4) <= 3.7e-75) tmp = Float64(Float64(t_2 / Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) + Float64(z3 / abs(z4)))) * abs(z4)); elseif (abs(z4) <= 1e+108) tmp = Float64(z0 * Float64(Float64(z0 * Float64(Float64(0.5 * t_1) + Float64(z0 * Float64(Float64(0.25 * Float64(Float64(z0 * z2) / t_0)) + Float64(0.3333333333333333 * t_1))))) + t_1)); else tmp = Float64(Float64(t_2 / Float64(Float64(z2 * Float64(z3 / Float64(abs(z4) * abs(z4)))) + Float64(z1 / z2))) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = (z1 / z2) + ((z2 * z3) / (abs(z4) ^ 2.0)); t_1 = z2 / t_0; t_2 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0); tmp = 0.0; if (abs(z4) <= 3.7e-75) tmp = (t_2 / (((z1 / (z2 * z2)) * abs(z4)) + (z3 / abs(z4)))) * abs(z4); elseif (abs(z4) <= 1e+108) tmp = z0 * ((z0 * ((0.5 * t_1) + (z0 * ((0.25 * ((z0 * z2) / t_0)) + (0.3333333333333333 * t_1))))) + t_1); else tmp = (t_2 / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(z1 / z2), $MachinePrecision] + N[(N[(z2 * z3), $MachinePrecision] / N[Power[N[Abs[z4], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z2 / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 3.7e-75], N[(N[(t$95$2 / N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + N[(z3 / N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[z4], $MachinePrecision], 1e+108], N[(z0 * N[(N[(z0 * N[(N[(0.5 * t$95$1), $MachinePrecision] + N[(z0 * N[(N[(0.25 * N[(N[(z0 * z2), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.3333333333333333 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 / N[(N[(z2 * N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]]]]]
\begin{array}{l}
t_0 := \frac{z1}{z2} + \frac{z2 \cdot z3}{{\left(\left|z4\right|\right)}^{2}}\\
t_1 := \frac{z2}{t\_0}\\
t_2 := z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\mathbf{if}\;\left|z4\right| \leq 3.7 \cdot 10^{-75}:\\
\;\;\;\;\frac{t\_2}{\frac{z1}{z2 \cdot z2} \cdot \left|z4\right| + \frac{z3}{\left|z4\right|}} \cdot \left|z4\right|\\
\mathbf{elif}\;\left|z4\right| \leq 10^{+108}:\\
\;\;\;\;z0 \cdot \left(z0 \cdot \left(0.5 \cdot t\_1 + z0 \cdot \left(0.25 \cdot \frac{z0 \cdot z2}{t\_0} + 0.3333333333333333 \cdot t\_1\right)\right) + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_2}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\
\end{array}
if z4 < 3.7000000000000002e-75Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.3%
Applied rewrites70.3%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
+-commutativeN/A
*-commutativeN/A
associate-/r/N/A
common-denominatorN/A
lift-/.f64N/A
add-to-fractionN/A
Applied rewrites70.4%
if 3.7000000000000002e-75 < z4 < 1e108Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-*.f64N/A
lower-+.f64N/A
Applied rewrites67.9%
if 1e108 < z4 Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.6%
Applied rewrites70.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.9%
Applied rewrites69.9%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(-
z0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0))))
(if (<= (fabs z4) 3.6e-16)
(*
(/ t_0 (+ (* (/ z1 (* z2 z2)) (fabs z4)) (/ z3 (fabs z4))))
(fabs z4))
(*
(/ t_0 (+ (* z2 (/ z3 (* (fabs z4) (fabs z4)))) (/ z1 z2)))
z2))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0);
double tmp;
if (fabs(z4) <= 3.6e-16) {
tmp = (t_0 / (((z1 / (z2 * z2)) * fabs(z4)) + (z3 / fabs(z4)))) * fabs(z4);
} else {
tmp = (t_0 / ((z2 * (z3 / (fabs(z4) * fabs(z4)))) + (z1 / z2))) * 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 = z0 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0)
if (abs(z4) <= 3.6d-16) then
tmp = (t_0 / (((z1 / (z2 * z2)) * abs(z4)) + (z3 / abs(z4)))) * abs(z4)
else
tmp = (t_0 / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0);
double tmp;
if (Math.abs(z4) <= 3.6e-16) {
tmp = (t_0 / (((z1 / (z2 * z2)) * Math.abs(z4)) + (z3 / Math.abs(z4)))) * Math.abs(z4);
} else {
tmp = (t_0 / ((z2 * (z3 / (Math.abs(z4) * Math.abs(z4)))) + (z1 / z2))) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) tmp = 0 if math.fabs(z4) <= 3.6e-16: tmp = (t_0 / (((z1 / (z2 * z2)) * math.fabs(z4)) + (z3 / math.fabs(z4)))) * math.fabs(z4) else: tmp = (t_0 / ((z2 * (z3 / (math.fabs(z4) * math.fabs(z4)))) + (z1 / z2))) * z2 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) tmp = 0.0 if (abs(z4) <= 3.6e-16) tmp = Float64(Float64(t_0 / Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) + Float64(z3 / abs(z4)))) * abs(z4)); else tmp = Float64(Float64(t_0 / Float64(Float64(z2 * Float64(z3 / Float64(abs(z4) * abs(z4)))) + Float64(z1 / z2))) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0); tmp = 0.0; if (abs(z4) <= 3.6e-16) tmp = (t_0 / (((z1 / (z2 * z2)) * abs(z4)) + (z3 / abs(z4)))) * abs(z4); else tmp = (t_0 / ((z2 * (z3 / (abs(z4) * abs(z4)))) + (z1 / z2))) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 3.6e-16], N[(N[(t$95$0 / N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + N[(z3 / N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(N[(z2 * N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]]
\begin{array}{l}
t_0 := z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\mathbf{if}\;\left|z4\right| \leq 3.6 \cdot 10^{-16}:\\
\;\;\;\;\frac{t\_0}{\frac{z1}{z2 \cdot z2} \cdot \left|z4\right| + \frac{z3}{\left|z4\right|}} \cdot \left|z4\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{z2 \cdot \frac{z3}{\left|z4\right| \cdot \left|z4\right|} + \frac{z1}{z2}} \cdot z2\\
\end{array}
if z4 < 3.5999999999999998e-16Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.3%
Applied rewrites70.3%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
common-denominatorN/A
associate-/r/N/A
+-commutativeN/A
*-commutativeN/A
associate-/r/N/A
common-denominatorN/A
lift-/.f64N/A
add-to-fractionN/A
Applied rewrites70.4%
if 3.5999999999999998e-16 < z4 Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.6%
Applied rewrites70.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.9%
Applied rewrites69.9%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(*
(-
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0)
z0)
(* (* -1.0 (/ z2 z1)) z2))))
(if (<= z0 -4.5e+29)
t_0
(if (<= z0 1.1e-9)
(/ (* z0 z2) (+ (/ z1 z2) (/ (* (/ z3 z4) z2) z4)))
(if (<= z0 6.2e+180)
t_0
(*
(/
(- z0 (* (* (- -0.5 (* 0.3333333333333333 z0)) z0) z0))
(+ (* (/ z1 (* z2 z2)) z4) (/ z3 z4)))
z4))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0) * ((-1.0 * (z2 / z1)) * z2);
double tmp;
if (z0 <= -4.5e+29) {
tmp = t_0;
} else if (z0 <= 1.1e-9) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else if (z0 <= 6.2e+180) {
tmp = t_0;
} else {
tmp = ((z0 - (((-0.5 - (0.3333333333333333 * z0)) * z0) * z0)) / (((z1 / (z2 * z2)) * z4) + (z3 / z4))) * z4;
}
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 = (((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0) - z0) * (((-1.0d0) * (z2 / z1)) * z2)
if (z0 <= (-4.5d+29)) then
tmp = t_0
else if (z0 <= 1.1d-9) then
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4))
else if (z0 <= 6.2d+180) then
tmp = t_0
else
tmp = ((z0 - ((((-0.5d0) - (0.3333333333333333d0 * z0)) * z0) * z0)) / (((z1 / (z2 * z2)) * z4) + (z3 / z4))) * z4
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0) * ((-1.0 * (z2 / z1)) * z2);
double tmp;
if (z0 <= -4.5e+29) {
tmp = t_0;
} else if (z0 <= 1.1e-9) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else if (z0 <= 6.2e+180) {
tmp = t_0;
} else {
tmp = ((z0 - (((-0.5 - (0.3333333333333333 * z0)) * z0) * z0)) / (((z1 / (z2 * z2)) * z4) + (z3 / z4))) * z4;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = ((((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0) * ((-1.0 * (z2 / z1)) * z2) tmp = 0 if z0 <= -4.5e+29: tmp = t_0 elif z0 <= 1.1e-9: tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)) elif z0 <= 6.2e+180: tmp = t_0 else: tmp = ((z0 - (((-0.5 - (0.3333333333333333 * z0)) * z0) * z0)) / (((z1 / (z2 * z2)) * z4) + (z3 / z4))) * z4 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0) * Float64(Float64(-1.0 * Float64(z2 / z1)) * z2)) tmp = 0.0 if (z0 <= -4.5e+29) tmp = t_0; elseif (z0 <= 1.1e-9) tmp = Float64(Float64(z0 * z2) / Float64(Float64(z1 / z2) + Float64(Float64(Float64(z3 / z4) * z2) / z4))); elseif (z0 <= 6.2e+180) tmp = t_0; else tmp = Float64(Float64(Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(0.3333333333333333 * z0)) * z0) * z0)) / Float64(Float64(Float64(z1 / Float64(z2 * z2)) * z4) + Float64(z3 / z4))) * z4); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = ((((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0) * ((-1.0 * (z2 / z1)) * z2); tmp = 0.0; if (z0 <= -4.5e+29) tmp = t_0; elseif (z0 <= 1.1e-9) tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)); elseif (z0 <= 6.2e+180) tmp = t_0; else tmp = ((z0 - (((-0.5 - (0.3333333333333333 * z0)) * z0) * z0)) / (((z1 / (z2 * z2)) * z4) + (z3 / z4))) * z4; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision] * N[(N[(-1.0 * N[(z2 / z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z0, -4.5e+29], t$95$0, If[LessEqual[z0, 1.1e-9], N[(N[(z0 * z2), $MachinePrecision] / N[(N[(z1 / z2), $MachinePrecision] + N[(N[(N[(z3 / z4), $MachinePrecision] * z2), $MachinePrecision] / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z0, 6.2e+180], t$95$0, N[(N[(N[(z0 - N[(N[(N[(-0.5 - N[(0.3333333333333333 * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision] + N[(z3 / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(\left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0 - z0\right) \cdot \left(\left(-1 \cdot \frac{z2}{z1}\right) \cdot z2\right)\\
\mathbf{if}\;z0 \leq -4.5 \cdot 10^{+29}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z0 \leq 1.1 \cdot 10^{-9}:\\
\;\;\;\;\frac{z0 \cdot z2}{\frac{z1}{z2} + \frac{\frac{z3}{z4} \cdot z2}{z4}}\\
\mathbf{elif}\;z0 \leq 6.2 \cdot 10^{+180}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{z0 - \left(\left(-0.5 - 0.3333333333333333 \cdot z0\right) \cdot z0\right) \cdot z0}{\frac{z1}{z2 \cdot z2} \cdot z4 + \frac{z3}{z4}} \cdot z4\\
\end{array}
if z0 < -4.5000000000000002e29 or 1.0999999999999999e-9 < z0 < 6.2e180Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z3 around 0
lower-*.f64N/A
lower-/.f6451.0%
Applied rewrites51.0%
if -4.5000000000000002e29 < z0 < 1.0999999999999999e-9Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6454.8%
Applied rewrites54.8%
if 6.2e180 < z0 Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.6%
Applied rewrites70.6%
Taylor expanded in z0 around 0
Applied rewrites57.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f32N/A
lower-unsound-*.f32N/A
lower-*.f64N/A
lower-unsound-*.f6457.0%
Applied rewrites57.0%
lift-/.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites56.3%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(-
z0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0)))
(t_1 (* (fabs z4) (fabs z4))))
(if (<= (fabs z4) 3.6e-16)
(*
(/ t_0 (+ (* (* (/ z1 (* z2 z2)) (fabs z4)) (fabs z4)) z3))
t_1)
(* (/ t_0 (+ (* z2 (/ z3 t_1)) (/ z1 z2))) z2))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0);
double t_1 = fabs(z4) * fabs(z4);
double tmp;
if (fabs(z4) <= 3.6e-16) {
tmp = (t_0 / ((((z1 / (z2 * z2)) * fabs(z4)) * fabs(z4)) + z3)) * t_1;
} else {
tmp = (t_0 / ((z2 * (z3 / t_1)) + (z1 / z2))) * 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 = z0 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0)
t_1 = abs(z4) * abs(z4)
if (abs(z4) <= 3.6d-16) then
tmp = (t_0 / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * t_1
else
tmp = (t_0 / ((z2 * (z3 / t_1)) + (z1 / z2))) * z2
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0);
double t_1 = Math.abs(z4) * Math.abs(z4);
double tmp;
if (Math.abs(z4) <= 3.6e-16) {
tmp = (t_0 / ((((z1 / (z2 * z2)) * Math.abs(z4)) * Math.abs(z4)) + z3)) * t_1;
} else {
tmp = (t_0 / ((z2 * (z3 / t_1)) + (z1 / z2))) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) t_1 = math.fabs(z4) * math.fabs(z4) tmp = 0 if math.fabs(z4) <= 3.6e-16: tmp = (t_0 / ((((z1 / (z2 * z2)) * math.fabs(z4)) * math.fabs(z4)) + z3)) * t_1 else: tmp = (t_0 / ((z2 * (z3 / t_1)) + (z1 / z2))) * z2 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) t_1 = Float64(abs(z4) * abs(z4)) tmp = 0.0 if (abs(z4) <= 3.6e-16) tmp = Float64(Float64(t_0 / Float64(Float64(Float64(Float64(z1 / Float64(z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * t_1); else tmp = Float64(Float64(t_0 / Float64(Float64(z2 * Float64(z3 / t_1)) + Float64(z1 / z2))) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0); t_1 = abs(z4) * abs(z4); tmp = 0.0; if (abs(z4) <= 3.6e-16) tmp = (t_0 / ((((z1 / (z2 * z2)) * abs(z4)) * abs(z4)) + z3)) * t_1; else tmp = (t_0 / ((z2 * (z3 / t_1)) + (z1 / z2))) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 3.6e-16], N[(N[(t$95$0 / N[(N[(N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(t$95$0 / N[(N[(z2 * N[(z3 / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]]]
\begin{array}{l}
t_0 := z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
t_1 := \left|z4\right| \cdot \left|z4\right|\\
\mathbf{if}\;\left|z4\right| \leq 3.6 \cdot 10^{-16}:\\
\;\;\;\;\frac{t\_0}{\left(\frac{z1}{z2 \cdot z2} \cdot \left|z4\right|\right) \cdot \left|z4\right| + z3} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{z2 \cdot \frac{z3}{t\_1} + \frac{z1}{z2}} \cdot z2\\
\end{array}
if z4 < 3.5999999999999998e-16Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.6%
Applied rewrites70.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites55.1%
if 3.5999999999999998e-16 < z4 Initial program 66.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.6%
Applied rewrites70.6%
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.9%
Applied rewrites69.9%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(-
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0)
z0)))
(if (<= z0 -4.5e+29)
(* t_0 (* (* -1.0 (/ z2 z1)) z2))
(if (<= z0 5.6e-49)
(/ (* z0 z2) (+ (/ z1 z2) (/ (* (/ z3 z4) z2) z4)))
(/ t_0 (- (/ z1 (* (- z2) z2)) (/ z3 (* z4 z4))))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0;
double tmp;
if (z0 <= -4.5e+29) {
tmp = t_0 * ((-1.0 * (z2 / z1)) * z2);
} else if (z0 <= 5.6e-49) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else {
tmp = t_0 / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)));
}
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 = ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0) - z0
if (z0 <= (-4.5d+29)) then
tmp = t_0 * (((-1.0d0) * (z2 / z1)) * z2)
else if (z0 <= 5.6d-49) then
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4))
else
tmp = t_0 / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0;
double tmp;
if (z0 <= -4.5e+29) {
tmp = t_0 * ((-1.0 * (z2 / z1)) * z2);
} else if (z0 <= 5.6e-49) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else {
tmp = t_0 / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0 tmp = 0 if z0 <= -4.5e+29: tmp = t_0 * ((-1.0 * (z2 / z1)) * z2) elif z0 <= 5.6e-49: tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)) else: tmp = t_0 / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0) tmp = 0.0 if (z0 <= -4.5e+29) tmp = Float64(t_0 * Float64(Float64(-1.0 * Float64(z2 / z1)) * z2)); elseif (z0 <= 5.6e-49) tmp = Float64(Float64(z0 * z2) / Float64(Float64(z1 / z2) + Float64(Float64(Float64(z3 / z4) * z2) / z4))); else tmp = Float64(t_0 / Float64(Float64(z1 / Float64(Float64(-z2) * z2)) - Float64(z3 / Float64(z4 * z4)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) - z0; tmp = 0.0; if (z0 <= -4.5e+29) tmp = t_0 * ((-1.0 * (z2 / z1)) * z2); elseif (z0 <= 5.6e-49) tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)); else tmp = t_0 / ((z1 / (-z2 * z2)) - (z3 / (z4 * z4))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision] - z0), $MachinePrecision]}, If[LessEqual[z0, -4.5e+29], N[(t$95$0 * N[(N[(-1.0 * N[(z2 / z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision], If[LessEqual[z0, 5.6e-49], N[(N[(z0 * z2), $MachinePrecision] / N[(N[(z1 / z2), $MachinePrecision] + N[(N[(N[(z3 / z4), $MachinePrecision] * z2), $MachinePrecision] / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 / N[(N[(z1 / N[((-z2) * z2), $MachinePrecision]), $MachinePrecision] - N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0 - z0\\
\mathbf{if}\;z0 \leq -4.5 \cdot 10^{+29}:\\
\;\;\;\;t\_0 \cdot \left(\left(-1 \cdot \frac{z2}{z1}\right) \cdot z2\right)\\
\mathbf{elif}\;z0 \leq 5.6 \cdot 10^{-49}:\\
\;\;\;\;\frac{z0 \cdot z2}{\frac{z1}{z2} + \frac{\frac{z3}{z4} \cdot z2}{z4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{\frac{z1}{\left(-z2\right) \cdot z2} - \frac{z3}{z4 \cdot z4}}\\
\end{array}
if z0 < -4.5000000000000002e29Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z3 around 0
lower-*.f64N/A
lower-/.f6451.0%
Applied rewrites51.0%
if -4.5000000000000002e29 < z0 < 5.5999999999999999e-49Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6454.8%
Applied rewrites54.8%
if 5.5999999999999999e-49 < z0 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
lower-/.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
lower--.f64N/A
Applied rewrites66.0%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0)))
(if (<= z0 -4.5e+29)
(* (- t_0 z0) (* (* -1.0 (/ z2 z1)) z2))
(if (<= z0 3.35e-49)
(/ (* z0 z2) (+ (/ z1 z2) (/ (* (/ z3 z4) z2) z4)))
(/ (- z0 t_0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0;
double tmp;
if (z0 <= -4.5e+29) {
tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2);
} else if (z0 <= 3.35e-49) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else {
tmp = (z0 - t_0) / ((z3 / (z4 * z4)) + (z1 / (z2 * 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 = (((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0
if (z0 <= (-4.5d+29)) then
tmp = (t_0 - z0) * (((-1.0d0) * (z2 / z1)) * z2)
else if (z0 <= 3.35d-49) then
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4))
else
tmp = (z0 - t_0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0;
double tmp;
if (z0 <= -4.5e+29) {
tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2);
} else if (z0 <= 3.35e-49) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else {
tmp = (z0 - t_0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0 tmp = 0 if z0 <= -4.5e+29: tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2) elif z0 <= 3.35e-49: tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)) else: tmp = (z0 - t_0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) tmp = 0.0 if (z0 <= -4.5e+29) tmp = Float64(Float64(t_0 - z0) * Float64(Float64(-1.0 * Float64(z2 / z1)) * z2)); elseif (z0 <= 3.35e-49) tmp = Float64(Float64(z0 * z2) / Float64(Float64(z1 / z2) + Float64(Float64(Float64(z3 / z4) * z2) / z4))); else tmp = Float64(Float64(z0 - t_0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0; tmp = 0.0; if (z0 <= -4.5e+29) tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2); elseif (z0 <= 3.35e-49) tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)); else tmp = (z0 - t_0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[z0, -4.5e+29], N[(N[(t$95$0 - z0), $MachinePrecision] * N[(N[(-1.0 * N[(z2 / z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision], If[LessEqual[z0, 3.35e-49], N[(N[(z0 * z2), $MachinePrecision] / N[(N[(z1 / z2), $MachinePrecision] + N[(N[(N[(z3 / z4), $MachinePrecision] * z2), $MachinePrecision] / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z0 - t$95$0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\mathbf{if}\;z0 \leq -4.5 \cdot 10^{+29}:\\
\;\;\;\;\left(t\_0 - z0\right) \cdot \left(\left(-1 \cdot \frac{z2}{z1}\right) \cdot z2\right)\\
\mathbf{elif}\;z0 \leq 3.35 \cdot 10^{-49}:\\
\;\;\;\;\frac{z0 \cdot z2}{\frac{z1}{z2} + \frac{\frac{z3}{z4} \cdot z2}{z4}}\\
\mathbf{else}:\\
\;\;\;\;\frac{z0 - t\_0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}\\
\end{array}
if z0 < -4.5000000000000002e29Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z3 around 0
lower-*.f64N/A
lower-/.f6451.0%
Applied rewrites51.0%
if -4.5000000000000002e29 < z0 < 3.3499999999999999e-49Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6454.8%
Applied rewrites54.8%
if 3.3499999999999999e-49 < z0 Initial program 66.3%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0)))
(if (<= (- z0 t_0) 1e-15)
(/ (* z0 z2) (+ (/ z1 z2) (/ (* (/ z3 z4) z2) z4)))
(* (- t_0 z0) (* (* -1.0 (/ z2 z1)) z2)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0;
double tmp;
if ((z0 - t_0) <= 1e-15) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else {
tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * 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 = (((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0
if ((z0 - t_0) <= 1d-15) then
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4))
else
tmp = (t_0 - z0) * (((-1.0d0) * (z2 / z1)) * z2)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0;
double tmp;
if ((z0 - t_0) <= 1e-15) {
tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4));
} else {
tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0 tmp = 0 if (z0 - t_0) <= 1e-15: tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)) else: tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) tmp = 0.0 if (Float64(z0 - t_0) <= 1e-15) tmp = Float64(Float64(z0 * z2) / Float64(Float64(z1 / z2) + Float64(Float64(Float64(z3 / z4) * z2) / z4))); else tmp = Float64(Float64(t_0 - z0) * Float64(Float64(-1.0 * Float64(z2 / z1)) * z2)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0; tmp = 0.0; if ((z0 - t_0) <= 1e-15) tmp = (z0 * z2) / ((z1 / z2) + (((z3 / z4) * z2) / z4)); else tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[N[(z0 - t$95$0), $MachinePrecision], 1e-15], N[(N[(z0 * z2), $MachinePrecision] / N[(N[(z1 / z2), $MachinePrecision] + N[(N[(N[(z3 / z4), $MachinePrecision] * z2), $MachinePrecision] / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 - z0), $MachinePrecision] * N[(N[(-1.0 * N[(z2 / z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\mathbf{if}\;z0 - t\_0 \leq 10^{-15}:\\
\;\;\;\;\frac{z0 \cdot z2}{\frac{z1}{z2} + \frac{\frac{z3}{z4} \cdot z2}{z4}}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - z0\right) \cdot \left(\left(-1 \cdot \frac{z2}{z1}\right) \cdot z2\right)\\
\end{array}
if (-.f64 z0 (*.f64 (*.f64 (-.f64 #s(literal -1/2 binary64) (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0)) z0) z0)) < 1.0000000000000001e-15Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*l/N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6454.8%
Applied rewrites54.8%
if 1.0000000000000001e-15 < (-.f64 z0 (*.f64 (*.f64 (-.f64 #s(literal -1/2 binary64) (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0)) z0) z0)) Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z3 around 0
lower-*.f64N/A
lower-/.f6451.0%
Applied rewrites51.0%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0)))
(if (<= (- z0 t_0) 1e-15)
(* (* (/ z2 (+ (* (* (/ z3 (* z4 z4)) z2) z2) z1)) z2) z0)
(* (- t_0 z0) (* (* -1.0 (/ z2 z1)) z2)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0;
double tmp;
if ((z0 - t_0) <= 1e-15) {
tmp = ((z2 / ((((z3 / (z4 * z4)) * z2) * z2) + z1)) * z2) * z0;
} else {
tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * 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 = (((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0
if ((z0 - t_0) <= 1d-15) then
tmp = ((z2 / ((((z3 / (z4 * z4)) * z2) * z2) + z1)) * z2) * z0
else
tmp = (t_0 - z0) * (((-1.0d0) * (z2 / z1)) * z2)
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0;
double tmp;
if ((z0 - t_0) <= 1e-15) {
tmp = ((z2 / ((((z3 / (z4 * z4)) * z2) * z2) + z1)) * z2) * z0;
} else {
tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0 tmp = 0 if (z0 - t_0) <= 1e-15: tmp = ((z2 / ((((z3 / (z4 * z4)) * z2) * z2) + z1)) * z2) * z0 else: tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0) tmp = 0.0 if (Float64(z0 - t_0) <= 1e-15) tmp = Float64(Float64(Float64(z2 / Float64(Float64(Float64(Float64(z3 / Float64(z4 * z4)) * z2) * z2) + z1)) * z2) * z0); else tmp = Float64(Float64(t_0 - z0) * Float64(Float64(-1.0 * Float64(z2 / z1)) * z2)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = ((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0; tmp = 0.0; if ((z0 - t_0) <= 1e-15) tmp = ((z2 / ((((z3 / (z4 * z4)) * z2) * z2) + z1)) * z2) * z0; else tmp = (t_0 - z0) * ((-1.0 * (z2 / z1)) * z2); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[N[(z0 - t$95$0), $MachinePrecision], 1e-15], N[(N[(N[(z2 / N[(N[(N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z0), $MachinePrecision], N[(N[(t$95$0 - z0), $MachinePrecision] * N[(N[(-1.0 * N[(z2 / z1), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0\\
\mathbf{if}\;z0 - t\_0 \leq 10^{-15}:\\
\;\;\;\;\left(\frac{z2}{\left(\frac{z3}{z4 \cdot z4} \cdot z2\right) \cdot z2 + z1} \cdot z2\right) \cdot z0\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - z0\right) \cdot \left(\left(-1 \cdot \frac{z2}{z1}\right) \cdot z2\right)\\
\end{array}
if (-.f64 z0 (*.f64 (*.f64 (-.f64 #s(literal -1/2 binary64) (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0)) z0) z0)) < 1.0000000000000001e-15Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.2%
if 1.0000000000000001e-15 < (-.f64 z0 (*.f64 (*.f64 (-.f64 #s(literal -1/2 binary64) (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0)) z0) z0)) Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z3 around 0
lower-*.f64N/A
lower-/.f6451.0%
Applied rewrites51.0%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (* (fabs z4) (fabs z4))))
(if (<= (fabs z4) 160000000000.0)
(*
(/
(- z0)
(-
(* (* (/ z1 (* (- (fabs z2)) (fabs z2))) (fabs z4)) (fabs z4))
z3))
t_0)
(/
(* z0 (fabs z2))
(+ (/ z1 (fabs z2)) (* z3 (/ (fabs z2) t_0)))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = fabs(z4) * fabs(z4);
double tmp;
if (fabs(z4) <= 160000000000.0) {
tmp = (-z0 / ((((z1 / (-fabs(z2) * fabs(z2))) * fabs(z4)) * fabs(z4)) - z3)) * t_0;
} else {
tmp = (z0 * fabs(z2)) / ((z1 / fabs(z2)) + (z3 * (fabs(z2) / 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 = abs(z4) * abs(z4)
if (abs(z4) <= 160000000000.0d0) then
tmp = (-z0 / ((((z1 / (-abs(z2) * abs(z2))) * abs(z4)) * abs(z4)) - z3)) * t_0
else
tmp = (z0 * abs(z2)) / ((z1 / abs(z2)) + (z3 * (abs(z2) / 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 = Math.abs(z4) * Math.abs(z4);
double tmp;
if (Math.abs(z4) <= 160000000000.0) {
tmp = (-z0 / ((((z1 / (-Math.abs(z2) * Math.abs(z2))) * Math.abs(z4)) * Math.abs(z4)) - z3)) * t_0;
} else {
tmp = (z0 * Math.abs(z2)) / ((z1 / Math.abs(z2)) + (z3 * (Math.abs(z2) / t_0)));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = math.fabs(z4) * math.fabs(z4) tmp = 0 if math.fabs(z4) <= 160000000000.0: tmp = (-z0 / ((((z1 / (-math.fabs(z2) * math.fabs(z2))) * math.fabs(z4)) * math.fabs(z4)) - z3)) * t_0 else: tmp = (z0 * math.fabs(z2)) / ((z1 / math.fabs(z2)) + (z3 * (math.fabs(z2) / t_0))) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(abs(z4) * abs(z4)) tmp = 0.0 if (abs(z4) <= 160000000000.0) tmp = Float64(Float64(Float64(-z0) / Float64(Float64(Float64(Float64(z1 / Float64(Float64(-abs(z2)) * abs(z2))) * abs(z4)) * abs(z4)) - z3)) * t_0); else tmp = Float64(Float64(z0 * abs(z2)) / Float64(Float64(z1 / abs(z2)) + Float64(z3 * Float64(abs(z2) / t_0)))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = abs(z4) * abs(z4); tmp = 0.0; if (abs(z4) <= 160000000000.0) tmp = (-z0 / ((((z1 / (-abs(z2) * abs(z2))) * abs(z4)) * abs(z4)) - z3)) * t_0; else tmp = (z0 * abs(z2)) / ((z1 / abs(z2)) + (z3 * (abs(z2) / t_0))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z4], $MachinePrecision], 160000000000.0], N[(N[((-z0) / N[(N[(N[(N[(z1 / N[((-N[Abs[z2], $MachinePrecision]) * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] - z3), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[(z0 * N[Abs[z2], $MachinePrecision]), $MachinePrecision] / N[(N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision] + N[(z3 * N[(N[Abs[z2], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|z4\right| \cdot \left|z4\right|\\
\mathbf{if}\;\left|z4\right| \leq 160000000000:\\
\;\;\;\;\frac{-z0}{\left(\frac{z1}{\left(-\left|z2\right|\right) \cdot \left|z2\right|} \cdot \left|z4\right|\right) \cdot \left|z4\right| - z3} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{z0 \cdot \left|z2\right|}{\frac{z1}{\left|z2\right|} + z3 \cdot \frac{\left|z2\right|}{t\_0}}\\
\end{array}
if z4 < 1.6e11Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
Taylor expanded in z0 around 0
lower-*.f6449.1%
Applied rewrites49.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-+.f64N/A
frac-2neg-revN/A
metadata-evalN/A
Applied rewrites49.3%
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
sub-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites42.2%
if 1.6e11 < z4 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.2%
Applied rewrites52.2%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(if (<= (fabs z4) 1.2e-9)
(*
(/
z0
(+ (* (/ z1 (* (fabs z2) (fabs z2))) (fabs z4)) (/ z3 (fabs z4))))
(fabs z4))
(/
(* z0 (fabs z2))
(+ (/ z1 (fabs z2)) (* z3 (/ (fabs z2) (* (fabs z4) (fabs z4))))))))double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z4) <= 1.2e-9) {
tmp = (z0 / (((z1 / (fabs(z2) * fabs(z2))) * fabs(z4)) + (z3 / fabs(z4)))) * fabs(z4);
} else {
tmp = (z0 * fabs(z2)) / ((z1 / fabs(z2)) + (z3 * (fabs(z2) / (fabs(z4) * fabs(z4)))));
}
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) <= 1.2d-9) then
tmp = (z0 / (((z1 / (abs(z2) * abs(z2))) * abs(z4)) + (z3 / abs(z4)))) * abs(z4)
else
tmp = (z0 * abs(z2)) / ((z1 / abs(z2)) + (z3 * (abs(z2) / (abs(z4) * abs(z4)))))
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) <= 1.2e-9) {
tmp = (z0 / (((z1 / (Math.abs(z2) * Math.abs(z2))) * Math.abs(z4)) + (z3 / Math.abs(z4)))) * Math.abs(z4);
} else {
tmp = (z0 * Math.abs(z2)) / ((z1 / Math.abs(z2)) + (z3 * (Math.abs(z2) / (Math.abs(z4) * Math.abs(z4)))));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z4) <= 1.2e-9: tmp = (z0 / (((z1 / (math.fabs(z2) * math.fabs(z2))) * math.fabs(z4)) + (z3 / math.fabs(z4)))) * math.fabs(z4) else: tmp = (z0 * math.fabs(z2)) / ((z1 / math.fabs(z2)) + (z3 * (math.fabs(z2) / (math.fabs(z4) * math.fabs(z4))))) return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z4) <= 1.2e-9) tmp = Float64(Float64(z0 / Float64(Float64(Float64(z1 / Float64(abs(z2) * abs(z2))) * abs(z4)) + Float64(z3 / abs(z4)))) * abs(z4)); else tmp = Float64(Float64(z0 * abs(z2)) / Float64(Float64(z1 / abs(z2)) + Float64(z3 * Float64(abs(z2) / Float64(abs(z4) * abs(z4)))))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z4) <= 1.2e-9) tmp = (z0 / (((z1 / (abs(z2) * abs(z2))) * abs(z4)) + (z3 / abs(z4)))) * abs(z4); else tmp = (z0 * abs(z2)) / ((z1 / abs(z2)) + (z3 * (abs(z2) / (abs(z4) * abs(z4))))); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 1.2e-9], N[(N[(z0 / N[(N[(N[(z1 / N[(N[Abs[z2], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + N[(z3 / N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision], N[(N[(z0 * N[Abs[z2], $MachinePrecision]), $MachinePrecision] / N[(N[(z1 / N[Abs[z2], $MachinePrecision]), $MachinePrecision] + N[(z3 * N[(N[Abs[z2], $MachinePrecision] / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 1.2 \cdot 10^{-9}:\\
\;\;\;\;\frac{z0}{\frac{z1}{\left|z2\right| \cdot \left|z2\right|} \cdot \left|z4\right| + \frac{z3}{\left|z4\right|}} \cdot \left|z4\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{z0 \cdot \left|z2\right|}{\frac{z1}{\left|z2\right|} + z3 \cdot \frac{\left|z2\right|}{\left|z4\right| \cdot \left|z4\right|}}\\
\end{array}
if z4 < 1.2e-9Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.6%
if 1.2e-9 < z4 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6452.2%
Applied rewrites52.2%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(if (<= (fabs z2) 5.2e+212)
(*
(/
(* (fabs z2) z0)
(+ (* (* (/ z3 (* z4 z4)) (fabs z2)) (fabs z2)) z1))
(fabs z2))
(* (/ z0 (+ (* (/ z1 (* (fabs z2) (fabs z2))) z4) (/ z3 z4))) z4)))double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z2) <= 5.2e+212) {
tmp = ((fabs(z2) * z0) / ((((z3 / (z4 * z4)) * fabs(z2)) * fabs(z2)) + z1)) * fabs(z2);
} else {
tmp = (z0 / (((z1 / (fabs(z2) * fabs(z2))) * z4) + (z3 / z4))) * z4;
}
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(z2) <= 5.2d+212) then
tmp = ((abs(z2) * z0) / ((((z3 / (z4 * z4)) * abs(z2)) * abs(z2)) + z1)) * abs(z2)
else
tmp = (z0 / (((z1 / (abs(z2) * abs(z2))) * z4) + (z3 / z4))) * z4
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(z2) <= 5.2e+212) {
tmp = ((Math.abs(z2) * z0) / ((((z3 / (z4 * z4)) * Math.abs(z2)) * Math.abs(z2)) + z1)) * Math.abs(z2);
} else {
tmp = (z0 / (((z1 / (Math.abs(z2) * Math.abs(z2))) * z4) + (z3 / z4))) * z4;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z2) <= 5.2e+212: tmp = ((math.fabs(z2) * z0) / ((((z3 / (z4 * z4)) * math.fabs(z2)) * math.fabs(z2)) + z1)) * math.fabs(z2) else: tmp = (z0 / (((z1 / (math.fabs(z2) * math.fabs(z2))) * z4) + (z3 / z4))) * z4 return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z2) <= 5.2e+212) tmp = Float64(Float64(Float64(abs(z2) * z0) / Float64(Float64(Float64(Float64(z3 / Float64(z4 * z4)) * abs(z2)) * abs(z2)) + z1)) * abs(z2)); else tmp = Float64(Float64(z0 / Float64(Float64(Float64(z1 / Float64(abs(z2) * abs(z2))) * z4) + Float64(z3 / z4))) * z4); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z2) <= 5.2e+212) tmp = ((abs(z2) * z0) / ((((z3 / (z4 * z4)) * abs(z2)) * abs(z2)) + z1)) * abs(z2); else tmp = (z0 / (((z1 / (abs(z2) * abs(z2))) * z4) + (z3 / z4))) * z4; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z2], $MachinePrecision], 5.2e+212], N[(N[(N[(N[Abs[z2], $MachinePrecision] * z0), $MachinePrecision] / N[(N[(N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], N[(N[(z0 / N[(N[(N[(z1 / N[(N[Abs[z2], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision] + N[(z3 / z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z2\right| \leq 5.2 \cdot 10^{+212}:\\
\;\;\;\;\frac{\left|z2\right| \cdot z0}{\left(\frac{z3}{z4 \cdot z4} \cdot \left|z2\right|\right) \cdot \left|z2\right| + z1} \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{\frac{z1}{\left|z2\right| \cdot \left|z2\right|} \cdot z4 + \frac{z3}{z4}} \cdot z4\\
\end{array}
if z2 < 5.1999999999999997e212Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.7%
if 5.1999999999999997e212 < z2 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.6%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 5.2e+200)
(*
(/ (* (fabs z2) z0) (+ (* (* t_0 (fabs z2)) (fabs z2)) z1))
(fabs z2))
(/ (- z0) (- (/ z1 (* (- (fabs z2)) (fabs z2))) t_0)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double tmp;
if (fabs(z2) <= 5.2e+200) {
tmp = ((fabs(z2) * z0) / (((t_0 * fabs(z2)) * fabs(z2)) + z1)) * fabs(z2);
} else {
tmp = -z0 / ((z1 / (-fabs(z2) * fabs(z2))) - 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 = z3 / (z4 * z4)
if (abs(z2) <= 5.2d+200) then
tmp = ((abs(z2) * z0) / (((t_0 * abs(z2)) * abs(z2)) + z1)) * abs(z2)
else
tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - 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 = z3 / (z4 * z4);
double tmp;
if (Math.abs(z2) <= 5.2e+200) {
tmp = ((Math.abs(z2) * z0) / (((t_0 * Math.abs(z2)) * Math.abs(z2)) + z1)) * Math.abs(z2);
} else {
tmp = -z0 / ((z1 / (-Math.abs(z2) * Math.abs(z2))) - t_0);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) tmp = 0 if math.fabs(z2) <= 5.2e+200: tmp = ((math.fabs(z2) * z0) / (((t_0 * math.fabs(z2)) * math.fabs(z2)) + z1)) * math.fabs(z2) else: tmp = -z0 / ((z1 / (-math.fabs(z2) * math.fabs(z2))) - t_0) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) tmp = 0.0 if (abs(z2) <= 5.2e+200) tmp = Float64(Float64(Float64(abs(z2) * z0) / Float64(Float64(Float64(t_0 * abs(z2)) * abs(z2)) + z1)) * abs(z2)); else tmp = Float64(Float64(-z0) / Float64(Float64(z1 / Float64(Float64(-abs(z2)) * abs(z2))) - t_0)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); tmp = 0.0; if (abs(z2) <= 5.2e+200) tmp = ((abs(z2) * z0) / (((t_0 * abs(z2)) * abs(z2)) + z1)) * abs(z2); else tmp = -z0 / ((z1 / (-abs(z2) * abs(z2))) - t_0); 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], 5.2e+200], N[(N[(N[(N[Abs[z2], $MachinePrecision] * z0), $MachinePrecision] / N[(N[(N[(t$95$0 * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision], N[((-z0) / N[(N[(z1 / N[((-N[Abs[z2], $MachinePrecision]) * N[Abs[z2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
\mathbf{if}\;\left|z2\right| \leq 5.2 \cdot 10^{+200}:\\
\;\;\;\;\frac{\left|z2\right| \cdot z0}{\left(t\_0 \cdot \left|z2\right|\right) \cdot \left|z2\right| + z1} \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{-z0}{\frac{z1}{\left(-\left|z2\right|\right) \cdot \left|z2\right|} - t\_0}\\
\end{array}
if z2 < 5.2000000000000003e200Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.7%
if 5.2000000000000003e200 < z2 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
Taylor expanded in z0 around 0
lower-*.f6449.1%
Applied rewrites49.1%
lift-*.f64N/A
lift-/.f64N/A
lift-+.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-+.f64N/A
frac-2neg-revN/A
metadata-evalN/A
Applied rewrites49.3%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 3e+212)
(*
(/ (* (fabs z2) z0) (+ (* (* t_0 (fabs z2)) (fabs z2)) 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 tmp;
if (fabs(z2) <= 3e+212) {
tmp = ((fabs(z2) * z0) / (((t_0 * fabs(z2)) * fabs(z2)) + 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) :: tmp
t_0 = z3 / (z4 * z4)
if (abs(z2) <= 3d+212) then
tmp = ((abs(z2) * z0) / (((t_0 * abs(z2)) * abs(z2)) + 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 tmp;
if (Math.abs(z2) <= 3e+212) {
tmp = ((Math.abs(z2) * z0) / (((t_0 * Math.abs(z2)) * Math.abs(z2)) + 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) tmp = 0 if math.fabs(z2) <= 3e+212: tmp = ((math.fabs(z2) * z0) / (((t_0 * math.fabs(z2)) * math.fabs(z2)) + 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)) tmp = 0.0 if (abs(z2) <= 3e+212) tmp = Float64(Float64(Float64(abs(z2) * z0) / Float64(Float64(Float64(t_0 * abs(z2)) * abs(z2)) + 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); tmp = 0.0; if (abs(z2) <= 3e+212) tmp = ((abs(z2) * z0) / (((t_0 * abs(z2)) * abs(z2)) + 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]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 3e+212], N[(N[(N[(N[Abs[z2], $MachinePrecision] * z0), $MachinePrecision] / N[(N[(N[(t$95$0 * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $MachinePrecision]), $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 3 \cdot 10^{+212}:\\
\;\;\;\;\frac{\left|z2\right| \cdot z0}{\left(t\_0 \cdot \left|z2\right|\right) \cdot \left|z2\right| + z1} \cdot \left|z2\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{z1}{\left|z2\right| \cdot \left|z2\right|}}\\
\end{array}
if z2 < 3.0000000000000001e212Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.7%
if 3.0000000000000001e212 < z2 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
div-flip-revN/A
Applied rewrites49.2%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4))))
(if (<= (fabs z2) 3.1e+212)
(*
(fabs z2)
(* z0 (/ (fabs z2) (+ (* (* t_0 (fabs z2)) (fabs z2)) z1))))
(/ 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) <= 3.1e+212) {
tmp = fabs(z2) * (z0 * (fabs(z2) / (((t_0 * fabs(z2)) * fabs(z2)) + z1)));
} 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) <= 3.1d+212) then
tmp = abs(z2) * (z0 * (abs(z2) / (((t_0 * abs(z2)) * abs(z2)) + z1)))
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) <= 3.1e+212) {
tmp = Math.abs(z2) * (z0 * (Math.abs(z2) / (((t_0 * Math.abs(z2)) * Math.abs(z2)) + z1)));
} 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) <= 3.1e+212: tmp = math.fabs(z2) * (z0 * (math.fabs(z2) / (((t_0 * math.fabs(z2)) * math.fabs(z2)) + z1))) 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) <= 3.1e+212) tmp = Float64(abs(z2) * Float64(z0 * Float64(abs(z2) / Float64(Float64(Float64(t_0 * abs(z2)) * abs(z2)) + z1)))); 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) <= 3.1e+212) tmp = abs(z2) * (z0 * (abs(z2) / (((t_0 * abs(z2)) * abs(z2)) + z1))); 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], 3.1e+212], N[(N[Abs[z2], $MachinePrecision] * N[(z0 * N[(N[Abs[z2], $MachinePrecision] / N[(N[(N[(t$95$0 * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] + z1), $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}\\
\mathbf{if}\;\left|z2\right| \leq 3.1 \cdot 10^{+212}:\\
\;\;\;\;\left|z2\right| \cdot \left(z0 \cdot \frac{\left|z2\right|}{\left(t\_0 \cdot \left|z2\right|\right) \cdot \left|z2\right| + z1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{t\_0 + \frac{z1}{\left|z2\right| \cdot \left|z2\right|}}\\
\end{array}
if z2 < 3.1e212Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Applied rewrites50.6%
if 3.1e212 < z2 Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
div-flip-revN/A
Applied rewrites49.2%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
(if (<=
(/
(-
z0
(*
(* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0)
z0))
t_0)
4e+202)
(/ z0 t_0)
(/ (* z0 z2) (/ z1 z2)))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2));
double tmp;
if (((z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / t_0) <= 4e+202) {
tmp = z0 / t_0;
} else {
tmp = (z0 * z2) / (z1 / 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)) + (z1 / (z2 * z2))
if (((z0 - ((((-0.5d0) - (((0.25d0 * z0) - (-0.3333333333333333d0)) * z0)) * z0) * z0)) / t_0) <= 4d+202) then
tmp = z0 / t_0
else
tmp = (z0 * z2) / (z1 / 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)) + (z1 / (z2 * z2));
double tmp;
if (((z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / t_0) <= 4e+202) {
tmp = z0 / t_0;
} else {
tmp = (z0 * z2) / (z1 / z2);
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2)) tmp = 0 if ((z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / t_0) <= 4e+202: tmp = z0 / t_0 else: tmp = (z0 * z2) / (z1 / z2) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2))) tmp = 0.0 if (Float64(Float64(z0 - Float64(Float64(Float64(-0.5 - Float64(Float64(Float64(0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / t_0) <= 4e+202) tmp = Float64(z0 / t_0); else tmp = Float64(Float64(z0 * z2) / Float64(z1 / z2)); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = (z3 / (z4 * z4)) + (z1 / (z2 * z2)); tmp = 0.0; if (((z0 - (((-0.5 - (((0.25 * z0) - -0.3333333333333333) * z0)) * z0) * z0)) / t_0) <= 4e+202) tmp = z0 / t_0; else tmp = (z0 * z2) / (z1 / z2); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(z0 - N[(N[(N[(-0.5 - N[(N[(N[(0.25 * z0), $MachinePrecision] - -0.3333333333333333), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], 4e+202], N[(z0 / t$95$0), $MachinePrecision], N[(N[(z0 * z2), $MachinePrecision] / N[(z1 / z2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}\\
\mathbf{if}\;\frac{z0 - \left(\left(-0.5 - \left(0.25 \cdot z0 - -0.3333333333333333\right) \cdot z0\right) \cdot z0\right) \cdot z0}{t\_0} \leq 4 \cdot 10^{+202}:\\
\;\;\;\;\frac{z0}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{z0 \cdot z2}{\frac{z1}{z2}}\\
\end{array}
if (/.f64 (-.f64 z0 (*.f64 (*.f64 (-.f64 #s(literal -1/2 binary64) (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0)) z0) z0)) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 3.9999999999999996e202Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
associate-/l*N/A
div-flip-revN/A
Applied rewrites49.2%
if 3.9999999999999996e202 < (/.f64 (-.f64 z0 (*.f64 (*.f64 (-.f64 #s(literal -1/2 binary64) (*.f64 (-.f64 (*.f64 #s(literal 1/4 binary64) z0) #s(literal -3333333333333333/10000000000000000 binary64)) z0)) z0) z0)) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Taylor expanded in z3 around 0
lower-/.f6439.8%
Applied rewrites39.8%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (* z0 z2) (/ z1 z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
return (z0 * z2) / (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 = (z0 * z2) / (z1 / z2)
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return (z0 * z2) / (z1 / z2);
}
def code(z0, z3, z4, z1, z2): return (z0 * z2) / (z1 / z2)
function code(z0, z3, z4, z1, z2) return Float64(Float64(z0 * z2) / Float64(z1 / z2)) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z0 * z2) / (z1 / z2); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z0 * z2), $MachinePrecision] / N[(z1 / z2), $MachinePrecision]), $MachinePrecision]
\frac{z0 \cdot z2}{\frac{z1}{z2}}
Initial program 66.3%
lift-/.f64N/A
frac-2negN/A
mult-flipN/A
lower-*.f64N/A
lift--.f64N/A
sub-negate-revN/A
lower--.f64N/A
frac-2negN/A
metadata-evalN/A
lift-+.f64N/A
add-flipN/A
sub-negateN/A
sub-negate-revN/A
Applied rewrites66.2%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6469.1%
Applied rewrites69.1%
Taylor expanded in z0 around 0
lower-/.f64N/A
lower-*.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lower-pow.f6450.0%
Applied rewrites50.0%
Taylor expanded in z3 around 0
lower-/.f6439.8%
Applied rewrites39.8%
herbie shell --seed 2025250
(FPCore (z0 z3 z4 z1 z2)
:name "(/ (- z0 (* (* (- -1/2 (* (- (* 1/4 z0) -3333333333333333/10000000000000000) z0)) z0) z0)) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))"
:precision binary64
(/ (- z0 (* (* (- -0.5 (* (- (* 0.25 z0) -0.3333333333333333) z0)) z0) z0)) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))