
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (* z0 z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return (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 * 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 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return (z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(Float64(z0 * z0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z0 * z0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z0 \cdot z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (/ (* z0 z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))
double code(double z0, double z3, double z4, double z1, double z2) {
return (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 * 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 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)));
}
def code(z0, z3, z4, z1, z2): return (z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))
function code(z0, z3, z4, z1, z2) return Float64(Float64(z0 * z0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2))); end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z0 * z0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\frac{z0 \cdot z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}}
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (if (<= (fabs z4) 1.36e-33) (* (/ z0 (+ (* (fabs z4) (/ z1 (* z2 z2))) (/ z3 (fabs z4)))) (/ z0 (/ 1.0 (fabs z4)))) (* (* (/ z0 (+ (* (/ z3 (* (fabs z4) (fabs z4))) z2) (/ z1 z2))) z2) z0)))
double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z4) <= 1.36e-33) {
tmp = (z0 / ((fabs(z4) * (z1 / (z2 * z2))) + (z3 / fabs(z4)))) * (z0 / (1.0 / fabs(z4)));
} else {
tmp = ((z0 / (((z3 / (fabs(z4) * fabs(z4))) * z2) + (z1 / z2))) * z2) * z0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (abs(z4) <= 1.36d-33) then
tmp = (z0 / ((abs(z4) * (z1 / (z2 * z2))) + (z3 / abs(z4)))) * (z0 / (1.0d0 / abs(z4)))
else
tmp = ((z0 / (((z3 / (abs(z4) * abs(z4))) * z2) + (z1 / z2))) * z2) * z0
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (Math.abs(z4) <= 1.36e-33) {
tmp = (z0 / ((Math.abs(z4) * (z1 / (z2 * z2))) + (z3 / Math.abs(z4)))) * (z0 / (1.0 / Math.abs(z4)));
} else {
tmp = ((z0 / (((z3 / (Math.abs(z4) * Math.abs(z4))) * z2) + (z1 / z2))) * z2) * z0;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z4) <= 1.36e-33: tmp = (z0 / ((math.fabs(z4) * (z1 / (z2 * z2))) + (z3 / math.fabs(z4)))) * (z0 / (1.0 / math.fabs(z4))) else: tmp = ((z0 / (((z3 / (math.fabs(z4) * math.fabs(z4))) * z2) + (z1 / z2))) * z2) * z0 return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z4) <= 1.36e-33) tmp = Float64(Float64(z0 / Float64(Float64(abs(z4) * Float64(z1 / Float64(z2 * z2))) + Float64(z3 / abs(z4)))) * Float64(z0 / Float64(1.0 / abs(z4)))); else tmp = Float64(Float64(Float64(z0 / Float64(Float64(Float64(z3 / Float64(abs(z4) * abs(z4))) * z2) + Float64(z1 / z2))) * z2) * z0); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z4) <= 1.36e-33) tmp = (z0 / ((abs(z4) * (z1 / (z2 * z2))) + (z3 / abs(z4)))) * (z0 / (1.0 / abs(z4))); else tmp = ((z0 / (((z3 / (abs(z4) * abs(z4))) * z2) + (z1 / z2))) * z2) * z0; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 1.36e-33], N[(N[(z0 / N[(N[(N[Abs[z4], $MachinePrecision] * N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z3 / N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z0 / N[(1.0 / N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z0 / N[(N[(N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 1.36 \cdot 10^{-33}:\\
\;\;\;\;\frac{z0}{\left|z4\right| \cdot \frac{z1}{z2 \cdot z2} + \frac{z3}{\left|z4\right|}} \cdot \frac{z0}{\frac{1}{\left|z4\right|}}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z0}{\frac{z3}{\left|z4\right| \cdot \left|z4\right|} \cdot z2 + \frac{z1}{z2}} \cdot z2\right) \cdot z0\\
\end{array}
if z4 < 1.36e-33Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6476.1%
Applied rewrites76.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-+.f64N/A
add-flipN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l/N/A
lift-/.f64N/A
lift-/.f64N/A
add-flipN/A
lift-/.f64N/A
add-to-fractionN/A
mult-flipN/A
Applied rewrites77.7%
if 1.36e-33 < z4 Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.1%
Applied rewrites76.1%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites77.8%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(if (<= (fabs z4) 2.45e-16)
(*
(*
(fabs z4)
(*
(/ (fabs z4) (+ (* (* (fabs z4) (/ z1 (* z2 z2))) (fabs z4)) z3))
z0))
z0)
(*
(* (/ z0 (+ (* (/ z3 (* (fabs z4) (fabs z4))) z2) (/ z1 z2))) z2)
z0)))double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (fabs(z4) <= 2.45e-16) {
tmp = (fabs(z4) * ((fabs(z4) / (((fabs(z4) * (z1 / (z2 * z2))) * fabs(z4)) + z3)) * z0)) * z0;
} else {
tmp = ((z0 / (((z3 / (fabs(z4) * fabs(z4))) * z2) + (z1 / z2))) * z2) * z0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if (abs(z4) <= 2.45d-16) then
tmp = (abs(z4) * ((abs(z4) / (((abs(z4) * (z1 / (z2 * z2))) * abs(z4)) + z3)) * z0)) * z0
else
tmp = ((z0 / (((z3 / (abs(z4) * abs(z4))) * z2) + (z1 / z2))) * z2) * z0
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (Math.abs(z4) <= 2.45e-16) {
tmp = (Math.abs(z4) * ((Math.abs(z4) / (((Math.abs(z4) * (z1 / (z2 * z2))) * Math.abs(z4)) + z3)) * z0)) * z0;
} else {
tmp = ((z0 / (((z3 / (Math.abs(z4) * Math.abs(z4))) * z2) + (z1 / z2))) * z2) * z0;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if math.fabs(z4) <= 2.45e-16: tmp = (math.fabs(z4) * ((math.fabs(z4) / (((math.fabs(z4) * (z1 / (z2 * z2))) * math.fabs(z4)) + z3)) * z0)) * z0 else: tmp = ((z0 / (((z3 / (math.fabs(z4) * math.fabs(z4))) * z2) + (z1 / z2))) * z2) * z0 return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (abs(z4) <= 2.45e-16) tmp = Float64(Float64(abs(z4) * Float64(Float64(abs(z4) / Float64(Float64(Float64(abs(z4) * Float64(z1 / Float64(z2 * z2))) * abs(z4)) + z3)) * z0)) * z0); else tmp = Float64(Float64(Float64(z0 / Float64(Float64(Float64(z3 / Float64(abs(z4) * abs(z4))) * z2) + Float64(z1 / z2))) * z2) * z0); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (abs(z4) <= 2.45e-16) tmp = (abs(z4) * ((abs(z4) / (((abs(z4) * (z1 / (z2 * z2))) * abs(z4)) + z3)) * z0)) * z0; else tmp = ((z0 / (((z3 / (abs(z4) * abs(z4))) * z2) + (z1 / z2))) * z2) * z0; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[Abs[z4], $MachinePrecision], 2.45e-16], N[(N[(N[Abs[z4], $MachinePrecision] * N[(N[(N[Abs[z4], $MachinePrecision] / N[(N[(N[(N[Abs[z4], $MachinePrecision] * N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision], N[(N[(N[(z0 / N[(N[(N[(z3 / N[(N[Abs[z4], $MachinePrecision] * N[Abs[z4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] + N[(z1 / z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|z4\right| \leq 2.45 \cdot 10^{-16}:\\
\;\;\;\;\left(\left|z4\right| \cdot \left(\frac{\left|z4\right|}{\left(\left|z4\right| \cdot \frac{z1}{z2 \cdot z2}\right) \cdot \left|z4\right| + z3} \cdot z0\right)\right) \cdot z0\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z0}{\frac{z3}{\left|z4\right| \cdot \left|z4\right|} \cdot z2 + \frac{z1}{z2}} \cdot z2\right) \cdot z0\\
\end{array}
if z4 < 2.4499999999999999e-16Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.1%
Applied rewrites76.1%
Applied rewrites76.2%
if 2.4499999999999999e-16 < z4 Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.1%
Applied rewrites76.1%
lift-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
mult-flip-revN/A
lift-/.f64N/A
lift-+.f64N/A
lift-+.f64N/A
lift-/.f64N/A
add-to-fractionN/A
associate-/r/N/A
lower-*.f64N/A
Applied rewrites77.8%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ z3 (* z4 z4)))
(t_1
(*
(* z4 (* (/ z4 (+ (* (* z4 (/ z1 (* z2 z2))) z4) z3)) z0))
z0)))
(if (<= t_0 -1e-307)
t_1
(if (<= t_0 1e-217) (* (* (/ z0 z1) z2) (* z2 z0)) t_1))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = (z4 * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z0)) * z0;
double tmp;
if (t_0 <= -1e-307) {
tmp = t_1;
} else if (t_0 <= 1e-217) {
tmp = ((z0 / z1) * z2) * (z2 * z0);
} else {
tmp = t_1;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z3 / (z4 * z4)
t_1 = (z4 * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z0)) * z0
if (t_0 <= (-1d-307)) then
tmp = t_1
else if (t_0 <= 1d-217) then
tmp = ((z0 / z1) * z2) * (z2 * z0)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = z3 / (z4 * z4);
double t_1 = (z4 * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z0)) * z0;
double tmp;
if (t_0 <= -1e-307) {
tmp = t_1;
} else if (t_0 <= 1e-217) {
tmp = ((z0 / z1) * z2) * (z2 * z0);
} else {
tmp = t_1;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = z3 / (z4 * z4) t_1 = (z4 * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z0)) * z0 tmp = 0 if t_0 <= -1e-307: tmp = t_1 elif t_0 <= 1e-217: tmp = ((z0 / z1) * z2) * (z2 * z0) else: tmp = t_1 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(z3 / Float64(z4 * z4)) t_1 = Float64(Float64(z4 * Float64(Float64(z4 / Float64(Float64(Float64(z4 * Float64(z1 / Float64(z2 * z2))) * z4) + z3)) * z0)) * z0) tmp = 0.0 if (t_0 <= -1e-307) tmp = t_1; elseif (t_0 <= 1e-217) tmp = Float64(Float64(Float64(z0 / z1) * z2) * Float64(z2 * z0)); else tmp = t_1; end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = z3 / (z4 * z4); t_1 = (z4 * ((z4 / (((z4 * (z1 / (z2 * z2))) * z4) + z3)) * z0)) * z0; tmp = 0.0; if (t_0 <= -1e-307) tmp = t_1; elseif (t_0 <= 1e-217) tmp = ((z0 / z1) * z2) * (z2 * z0); else tmp = t_1; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z4 * N[(N[(z4 / N[(N[(N[(z4 * N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision] + z3), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-307], t$95$1, If[LessEqual[t$95$0, 1e-217], N[(N[(N[(z0 / z1), $MachinePrecision] * z2), $MachinePrecision] * N[(z2 * z0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{z3}{z4 \cdot z4}\\
t_1 := \left(z4 \cdot \left(\frac{z4}{\left(z4 \cdot \frac{z1}{z2 \cdot z2}\right) \cdot z4 + z3} \cdot z0\right)\right) \cdot z0\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-307}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{-217}:\\
\;\;\;\;\left(\frac{z0}{z1} \cdot z2\right) \cdot \left(z2 \cdot z0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if (/.f64 z3 (*.f64 z4 z4)) < -9.9999999999999991e-308 or 1.0000000000000001e-217 < (/.f64 z3 (*.f64 z4 z4)) Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.6%
Applied rewrites71.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
mult-flipN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6476.1%
Applied rewrites76.1%
Applied rewrites76.2%
if -9.9999999999999991e-308 < (/.f64 z3 (*.f64 z4 z4)) < 1.0000000000000001e-217Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.9%
Applied rewrites59.9%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (if (<= (* z2 z2) 1.5e-140) (* (* (/ z0 z1) z2) (* z2 z0)) (* (/ z0 (+ (/ z1 (* z2 z2)) (/ z3 (* z4 z4)))) z0)))
double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if ((z2 * z2) <= 1.5e-140) {
tmp = ((z0 / z1) * z2) * (z2 * z0);
} else {
tmp = (z0 / ((z1 / (z2 * z2)) + (z3 / (z4 * z4)))) * z0;
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: tmp
if ((z2 * z2) <= 1.5d-140) then
tmp = ((z0 / z1) * z2) * (z2 * z0)
else
tmp = (z0 / ((z1 / (z2 * z2)) + (z3 / (z4 * z4)))) * z0
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if ((z2 * z2) <= 1.5e-140) {
tmp = ((z0 / z1) * z2) * (z2 * z0);
} else {
tmp = (z0 / ((z1 / (z2 * z2)) + (z3 / (z4 * z4)))) * z0;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if (z2 * z2) <= 1.5e-140: tmp = ((z0 / z1) * z2) * (z2 * z0) else: tmp = (z0 / ((z1 / (z2 * z2)) + (z3 / (z4 * z4)))) * z0 return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (Float64(z2 * z2) <= 1.5e-140) tmp = Float64(Float64(Float64(z0 / z1) * z2) * Float64(z2 * z0)); else tmp = Float64(Float64(z0 / Float64(Float64(z1 / Float64(z2 * z2)) + Float64(z3 / Float64(z4 * z4)))) * z0); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if ((z2 * z2) <= 1.5e-140) tmp = ((z0 / z1) * z2) * (z2 * z0); else tmp = (z0 / ((z1 / (z2 * z2)) + (z3 / (z4 * z4)))) * z0; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[(z2 * z2), $MachinePrecision], 1.5e-140], N[(N[(N[(z0 / z1), $MachinePrecision] * z2), $MachinePrecision] * N[(z2 * z0), $MachinePrecision]), $MachinePrecision], N[(N[(z0 / N[(N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision] + N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;z2 \cdot z2 \leq 1.5 \cdot 10^{-140}:\\
\;\;\;\;\left(\frac{z0}{z1} \cdot z2\right) \cdot \left(z2 \cdot z0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z0}{\frac{z1}{z2 \cdot z2} + \frac{z3}{z4 \cdot z4}} \cdot z0\\
\end{array}
if (*.f64 z2 z2) < 1.5000000000000001e-140Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.9%
Applied rewrites59.9%
if 1.5000000000000001e-140 < (*.f64 z2 z2) Initial program 66.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6471.6%
lift-+.f64N/A
+-commutativeN/A
lower-+.f6471.6%
Applied rewrites71.6%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (if (<= (/ (* z0 z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))) 5e-187) (/ 1.0 (/ z1 (* (* (* z0 z0) z2) z2))) (* (* z0 (* (/ z0 z1) z2)) z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187) {
tmp = 1.0 / (z1 / (((z0 * z0) * z2) * z2));
} else {
tmp = (z0 * ((z0 / 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) :: tmp
if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5d-187) then
tmp = 1.0d0 / (z1 / (((z0 * z0) * z2) * z2))
else
tmp = (z0 * ((z0 / z1) * z2)) * z2
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187) {
tmp = 1.0 / (z1 / (((z0 * z0) * z2) * z2));
} else {
tmp = (z0 * ((z0 / z1) * z2)) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if ((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187: tmp = 1.0 / (z1 / (((z0 * z0) * z2) * z2)) else: tmp = (z0 * ((z0 / z1) * z2)) * z2 return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (Float64(Float64(z0 * z0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) <= 5e-187) tmp = Float64(1.0 / Float64(z1 / Float64(Float64(Float64(z0 * z0) * z2) * z2))); else tmp = Float64(Float64(z0 * Float64(Float64(z0 / z1) * z2)) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187) tmp = 1.0 / (z1 / (((z0 * z0) * z2) * z2)); else tmp = (z0 * ((z0 / z1) * z2)) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[(N[(z0 * z0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-187], N[(1.0 / N[(z1 / N[(N[(N[(z0 * z0), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z0 * N[(N[(z0 / z1), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{z0 \cdot z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \leq 5 \cdot 10^{-187}:\\
\;\;\;\;\frac{1}{\frac{z1}{\left(\left(z0 \cdot z0\right) \cdot z2\right) \cdot z2}}\\
\mathbf{else}:\\
\;\;\;\;\left(z0 \cdot \left(\frac{z0}{z1} \cdot z2\right)\right) \cdot z2\\
\end{array}
if (/.f64 (*.f64 z0 z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 4.9999999999999996e-187Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
div-flipN/A
lower-unsound-/.f64N/A
lower-unsound-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6455.8%
Applied rewrites55.8%
if 4.9999999999999996e-187 < (/.f64 (*.f64 z0 z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6459.4%
Applied rewrites59.4%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (if (<= (/ (* z0 z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))) 5e-187) (/ (* (* (* z0 z0) z2) z2) z1) (* (* z0 (* (/ z0 z1) z2)) z2)))
double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187) {
tmp = (((z0 * z0) * z2) * z2) / z1;
} else {
tmp = (z0 * ((z0 / 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) :: tmp
if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5d-187) then
tmp = (((z0 * z0) * z2) * z2) / z1
else
tmp = (z0 * ((z0 / z1) * z2)) * z2
end if
code = tmp
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
double tmp;
if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187) {
tmp = (((z0 * z0) * z2) * z2) / z1;
} else {
tmp = (z0 * ((z0 / z1) * z2)) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): tmp = 0 if ((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187: tmp = (((z0 * z0) * z2) * z2) / z1 else: tmp = (z0 * ((z0 / z1) * z2)) * z2 return tmp
function code(z0, z3, z4, z1, z2) tmp = 0.0 if (Float64(Float64(z0 * z0) / Float64(Float64(z3 / Float64(z4 * z4)) + Float64(z1 / Float64(z2 * z2)))) <= 5e-187) tmp = Float64(Float64(Float64(Float64(z0 * z0) * z2) * z2) / z1); else tmp = Float64(Float64(z0 * Float64(Float64(z0 / z1) * z2)) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) tmp = 0.0; if (((z0 * z0) / ((z3 / (z4 * z4)) + (z1 / (z2 * z2)))) <= 5e-187) tmp = (((z0 * z0) * z2) * z2) / z1; else tmp = (z0 * ((z0 / z1) * z2)) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := If[LessEqual[N[(N[(z0 * z0), $MachinePrecision] / N[(N[(z3 / N[(z4 * z4), $MachinePrecision]), $MachinePrecision] + N[(z1 / N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e-187], N[(N[(N[(N[(z0 * z0), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision] / z1), $MachinePrecision], N[(N[(z0 * N[(N[(z0 / z1), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\frac{z0 \cdot z0}{\frac{z3}{z4 \cdot z4} + \frac{z1}{z2 \cdot z2}} \leq 5 \cdot 10^{-187}:\\
\;\;\;\;\frac{\left(\left(z0 \cdot z0\right) \cdot z2\right) \cdot z2}{z1}\\
\mathbf{else}:\\
\;\;\;\;\left(z0 \cdot \left(\frac{z0}{z1} \cdot z2\right)\right) \cdot z2\\
\end{array}
if (/.f64 (*.f64 z0 z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) < 4.9999999999999996e-187Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6455.9%
Applied rewrites55.9%
if 4.9999999999999996e-187 < (/.f64 (*.f64 z0 z0) (+.f64 (/.f64 z3 (*.f64 z4 z4)) (/.f64 z1 (*.f64 z2 z2)))) Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6459.4%
Applied rewrites59.4%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ (fabs z0) z1)))
(if (<= (fabs z0) 1.05e-119)
(* (* (* t_0 (fabs z0)) z2) z2)
(* (* t_0 z2) (* z2 (fabs z0))))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = fabs(z0) / z1;
double tmp;
if (fabs(z0) <= 1.05e-119) {
tmp = ((t_0 * fabs(z0)) * z2) * z2;
} else {
tmp = (t_0 * z2) * (z2 * fabs(z0));
}
return tmp;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(z0, z3, z4, z1, z2)
use fmin_fmax_functions
real(8), intent (in) :: z0
real(8), intent (in) :: z3
real(8), intent (in) :: z4
real(8), intent (in) :: z1
real(8), intent (in) :: z2
real(8) :: t_0
real(8) :: tmp
t_0 = abs(z0) / z1
if (abs(z0) <= 1.05d-119) then
tmp = ((t_0 * abs(z0)) * z2) * z2
else
tmp = (t_0 * z2) * (z2 * abs(z0))
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(z0) / z1;
double tmp;
if (Math.abs(z0) <= 1.05e-119) {
tmp = ((t_0 * Math.abs(z0)) * z2) * z2;
} else {
tmp = (t_0 * z2) * (z2 * Math.abs(z0));
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = math.fabs(z0) / z1 tmp = 0 if math.fabs(z0) <= 1.05e-119: tmp = ((t_0 * math.fabs(z0)) * z2) * z2 else: tmp = (t_0 * z2) * (z2 * math.fabs(z0)) return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(abs(z0) / z1) tmp = 0.0 if (abs(z0) <= 1.05e-119) tmp = Float64(Float64(Float64(t_0 * abs(z0)) * z2) * z2); else tmp = Float64(Float64(t_0 * z2) * Float64(z2 * abs(z0))); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = abs(z0) / z1; tmp = 0.0; if (abs(z0) <= 1.05e-119) tmp = ((t_0 * abs(z0)) * z2) * z2; else tmp = (t_0 * z2) * (z2 * abs(z0)); end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[Abs[z0], $MachinePrecision] / z1), $MachinePrecision]}, If[LessEqual[N[Abs[z0], $MachinePrecision], 1.05e-119], N[(N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision], N[(N[(t$95$0 * z2), $MachinePrecision] * N[(z2 * N[Abs[z0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\left|z0\right|}{z1}\\
\mathbf{if}\;\left|z0\right| \leq 1.05 \cdot 10^{-119}:\\
\;\;\;\;\left(\left(t\_0 \cdot \left|z0\right|\right) \cdot z2\right) \cdot z2\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 \cdot z2\right) \cdot \left(z2 \cdot \left|z0\right|\right)\\
\end{array}
if z0 < 1.05e-119Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites57.3%
if 1.05e-119 < z0 Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6459.9%
Applied rewrites59.9%
(FPCore (z0 z3 z4 z1 z2)
:precision binary64
(let* ((t_0 (/ (fabs z0) z1)))
(if (<= (fabs z0) 1.05e-119)
(* (* (* t_0 (fabs z0)) z2) z2)
(* (* (fabs z0) (* t_0 z2)) z2))))double code(double z0, double z3, double z4, double z1, double z2) {
double t_0 = fabs(z0) / z1;
double tmp;
if (fabs(z0) <= 1.05e-119) {
tmp = ((t_0 * fabs(z0)) * z2) * z2;
} else {
tmp = (fabs(z0) * (t_0 * 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 = abs(z0) / z1
if (abs(z0) <= 1.05d-119) then
tmp = ((t_0 * abs(z0)) * z2) * z2
else
tmp = (abs(z0) * (t_0 * 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 = Math.abs(z0) / z1;
double tmp;
if (Math.abs(z0) <= 1.05e-119) {
tmp = ((t_0 * Math.abs(z0)) * z2) * z2;
} else {
tmp = (Math.abs(z0) * (t_0 * z2)) * z2;
}
return tmp;
}
def code(z0, z3, z4, z1, z2): t_0 = math.fabs(z0) / z1 tmp = 0 if math.fabs(z0) <= 1.05e-119: tmp = ((t_0 * math.fabs(z0)) * z2) * z2 else: tmp = (math.fabs(z0) * (t_0 * z2)) * z2 return tmp
function code(z0, z3, z4, z1, z2) t_0 = Float64(abs(z0) / z1) tmp = 0.0 if (abs(z0) <= 1.05e-119) tmp = Float64(Float64(Float64(t_0 * abs(z0)) * z2) * z2); else tmp = Float64(Float64(abs(z0) * Float64(t_0 * z2)) * z2); end return tmp end
function tmp_2 = code(z0, z3, z4, z1, z2) t_0 = abs(z0) / z1; tmp = 0.0; if (abs(z0) <= 1.05e-119) tmp = ((t_0 * abs(z0)) * z2) * z2; else tmp = (abs(z0) * (t_0 * z2)) * z2; end tmp_2 = tmp; end
code[z0_, z3_, z4_, z1_, z2_] := Block[{t$95$0 = N[(N[Abs[z0], $MachinePrecision] / z1), $MachinePrecision]}, If[LessEqual[N[Abs[z0], $MachinePrecision], 1.05e-119], N[(N[(N[(t$95$0 * N[Abs[z0], $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision], N[(N[(N[Abs[z0], $MachinePrecision] * N[(t$95$0 * z2), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]]]
\begin{array}{l}
t_0 := \frac{\left|z0\right|}{z1}\\
\mathbf{if}\;\left|z0\right| \leq 1.05 \cdot 10^{-119}:\\
\;\;\;\;\left(\left(t\_0 \cdot \left|z0\right|\right) \cdot z2\right) \cdot z2\\
\mathbf{else}:\\
\;\;\;\;\left(\left|z0\right| \cdot \left(t\_0 \cdot z2\right)\right) \cdot z2\\
\end{array}
if z0 < 1.05e-119Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites57.3%
if 1.05e-119 < z0 Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6459.4%
Applied rewrites59.4%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (* (* z0 (* (/ z0 z1) z2)) z2))
double code(double z0, double z3, double z4, double z1, double z2) {
return (z0 * ((z0 / 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 * ((z0 / z1) * z2)) * z2
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return (z0 * ((z0 / z1) * z2)) * z2;
}
def code(z0, z3, z4, z1, z2): return (z0 * ((z0 / z1) * z2)) * z2
function code(z0, z3, z4, z1, z2) return Float64(Float64(z0 * Float64(Float64(z0 / z1) * z2)) * z2) end
function tmp = code(z0, z3, z4, z1, z2) tmp = (z0 * ((z0 / z1) * z2)) * z2; end
code[z0_, z3_, z4_, z1_, z2_] := N[(N[(z0 * N[(N[(z0 / z1), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]
\left(z0 \cdot \left(\frac{z0}{z1} \cdot z2\right)\right) \cdot z2
Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6459.4%
Applied rewrites59.4%
(FPCore (z0 z3 z4 z1 z2) :precision binary64 (* z0 (* (/ z0 z1) (* z2 z2))))
double code(double z0, double z3, double z4, double z1, double z2) {
return z0 * ((z0 / 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 * ((z0 / z1) * (z2 * z2))
end function
public static double code(double z0, double z3, double z4, double z1, double z2) {
return z0 * ((z0 / z1) * (z2 * z2));
}
def code(z0, z3, z4, z1, z2): return z0 * ((z0 / z1) * (z2 * z2))
function code(z0, z3, z4, z1, z2) return Float64(z0 * Float64(Float64(z0 / z1) * Float64(z2 * z2))) end
function tmp = code(z0, z3, z4, z1, z2) tmp = z0 * ((z0 / z1) * (z2 * z2)); end
code[z0_, z3_, z4_, z1_, z2_] := N[(z0 * N[(N[(z0 / z1), $MachinePrecision] * N[(z2 * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
z0 \cdot \left(\frac{z0}{z1} \cdot \left(z2 \cdot z2\right)\right)
Initial program 66.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
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6456.4%
Applied rewrites56.4%
Taylor expanded in z3 around 0
Applied rewrites49.3%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f6451.5%
Applied rewrites51.5%
herbie shell --seed 2025250
(FPCore (z0 z3 z4 z1 z2)
:name "(/ (* z0 z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2))))"
:precision binary64
(/ (* z0 z0) (+ (/ z3 (* z4 z4)) (/ z1 (* z2 z2)))))