
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (* (* z1 z1) z0)) (t_1 (* (* z4 z4) z2))) (- (* t_0 (/ t_0 (* (* t_1 t_1) (* z3 z3)))) (* z5 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z1 * z1) * z0;
double t_1 = (z4 * z4) * z2;
return (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
real(8) :: t_1
t_0 = (z1 * z1) * z0
t_1 = (z4 * z4) * z2
code = (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z1 * z1) * z0;
double t_1 = (z4 * z4) * z2;
return (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z1 * z1) * z0 t_1 = (z4 * z4) * z2 return (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z1 * z1) * z0) t_1 = Float64(Float64(z4 * z4) * z2) return Float64(Float64(t_0 * Float64(t_0 / Float64(Float64(t_1 * t_1) * Float64(z3 * z3)))) - Float64(z5 * z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = (z1 * z1) * z0; t_1 = (z4 * z4) * z2; tmp = (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z1 * z1), $MachinePrecision] * z0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z4 * z4), $MachinePrecision] * z2), $MachinePrecision]}, N[(N[(t$95$0 * N[(t$95$0 / N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(z3 * z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(z1 \cdot z1\right) \cdot z0\\
t_1 := \left(z4 \cdot z4\right) \cdot z2\\
t\_0 \cdot \frac{t\_0}{\left(t\_1 \cdot t\_1\right) \cdot \left(z3 \cdot z3\right)} - z5 \cdot z5
\end{array}
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (* (* z1 z1) z0)) (t_1 (* (* z4 z4) z2))) (- (* t_0 (/ t_0 (* (* t_1 t_1) (* z3 z3)))) (* z5 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z1 * z1) * z0;
double t_1 = (z4 * z4) * z2;
return (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
real(8) :: t_1
t_0 = (z1 * z1) * z0
t_1 = (z4 * z4) * z2
code = (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z1 * z1) * z0;
double t_1 = (z4 * z4) * z2;
return (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z1 * z1) * z0 t_1 = (z4 * z4) * z2 return (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z1 * z1) * z0) t_1 = Float64(Float64(z4 * z4) * z2) return Float64(Float64(t_0 * Float64(t_0 / Float64(Float64(t_1 * t_1) * Float64(z3 * z3)))) - Float64(z5 * z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = (z1 * z1) * z0; t_1 = (z4 * z4) * z2; tmp = (t_0 * (t_0 / ((t_1 * t_1) * (z3 * z3)))) - (z5 * z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z1 * z1), $MachinePrecision] * z0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z4 * z4), $MachinePrecision] * z2), $MachinePrecision]}, N[(N[(t$95$0 * N[(t$95$0 / N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(z3 * z3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(z1 \cdot z1\right) \cdot z0\\
t_1 := \left(z4 \cdot z4\right) \cdot z2\\
t\_0 \cdot \frac{t\_0}{\left(t\_1 \cdot t\_1\right) \cdot \left(z3 \cdot z3\right)} - z5 \cdot z5
\end{array}
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (/ (/ (* (* (/ z1 z4) z0) (/ z1 z2)) z4) z3))) (* (+ t_0 z5) (- t_0 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = ((((z1 / z4) * z0) * (z1 / z2)) / z4) / z3;
return (t_0 + z5) * (t_0 - z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
t_0 = ((((z1 / z4) * z0) * (z1 / z2)) / z4) / z3
code = (t_0 + z5) * (t_0 - z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = ((((z1 / z4) * z0) * (z1 / z2)) / z4) / z3;
return (t_0 + z5) * (t_0 - z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = ((((z1 / z4) * z0) * (z1 / z2)) / z4) / z3 return (t_0 + z5) * (t_0 - z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(Float64(Float64(Float64(z1 / z4) * z0) * Float64(z1 / z2)) / z4) / z3) return Float64(Float64(t_0 + z5) * Float64(t_0 - z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = ((((z1 / z4) * z0) * (z1 / z2)) / z4) / z3; tmp = (t_0 + z5) * (t_0 - z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(N[(N[(N[(z1 / z4), $MachinePrecision] * z0), $MachinePrecision] * N[(z1 / z2), $MachinePrecision]), $MachinePrecision] / z4), $MachinePrecision] / z3), $MachinePrecision]}, N[(N[(t$95$0 + z5), $MachinePrecision] * N[(t$95$0 - z5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{\frac{\left(\frac{z1}{z4} \cdot z0\right) \cdot \frac{z1}{z2}}{z4}}{z3}\\
\left(t\_0 + z5\right) \cdot \left(t\_0 - z5\right)
\end{array}
Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6486.1%
Applied rewrites86.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6493.4%
Applied rewrites93.4%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.6%
Applied rewrites90.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6493.7%
Applied rewrites93.7%
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (/ (* z0 (* (/ z1 z4) (/ z1 (* z2 z4)))) z3))) (* (+ t_0 z5) (- t_0 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * ((z1 / z4) * (z1 / (z2 * z4)))) / z3;
return (t_0 + z5) * (t_0 - z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
t_0 = (z0 * ((z1 / z4) * (z1 / (z2 * z4)))) / z3
code = (t_0 + z5) * (t_0 - z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * ((z1 / z4) * (z1 / (z2 * z4)))) / z3;
return (t_0 + z5) * (t_0 - z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z0 * ((z1 / z4) * (z1 / (z2 * z4)))) / z3 return (t_0 + z5) * (t_0 - z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z0 * Float64(Float64(z1 / z4) * Float64(z1 / Float64(z2 * z4)))) / z3) return Float64(Float64(t_0 + z5) * Float64(t_0 - z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = (z0 * ((z1 / z4) * (z1 / (z2 * z4)))) / z3; tmp = (t_0 + z5) * (t_0 - z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z0 * N[(N[(z1 / z4), $MachinePrecision] * N[(z1 / N[(z2 * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z3), $MachinePrecision]}, N[(N[(t$95$0 + z5), $MachinePrecision] * N[(t$95$0 - z5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \frac{z0 \cdot \left(\frac{z1}{z4} \cdot \frac{z1}{z2 \cdot z4}\right)}{z3}\\
\left(t\_0 + z5\right) \cdot \left(t\_0 - z5\right)
\end{array}
Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6486.1%
Applied rewrites86.1%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6493.4%
Applied rewrites93.4%
(FPCore (z1 z0 z4 z2 z3 z5)
:precision binary64
(let* ((t_0 (* (* z4 z4) z2))
(t_1 (/ (* z0 (* z1 (/ z1 t_0))) z3))
(t_2 (* (/ (* z1 z1) (* (* (* z2 z4) z3) z4)) z0)))
(if (<= (* (* t_0 t_0) (* z3 z3)) INFINITY)
(* (+ t_1 z5) (- t_1 z5))
(* (+ t_2 z5) (- t_2 z5)))))double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z4 * z4) * z2;
double t_1 = (z0 * (z1 * (z1 / t_0))) / z3;
double t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0;
double tmp;
if (((t_0 * t_0) * (z3 * z3)) <= ((double) INFINITY)) {
tmp = (t_1 + z5) * (t_1 - z5);
} else {
tmp = (t_2 + z5) * (t_2 - z5);
}
return tmp;
}
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z4 * z4) * z2;
double t_1 = (z0 * (z1 * (z1 / t_0))) / z3;
double t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0;
double tmp;
if (((t_0 * t_0) * (z3 * z3)) <= Double.POSITIVE_INFINITY) {
tmp = (t_1 + z5) * (t_1 - z5);
} else {
tmp = (t_2 + z5) * (t_2 - z5);
}
return tmp;
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z4 * z4) * z2 t_1 = (z0 * (z1 * (z1 / t_0))) / z3 t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0 tmp = 0 if ((t_0 * t_0) * (z3 * z3)) <= math.inf: tmp = (t_1 + z5) * (t_1 - z5) else: tmp = (t_2 + z5) * (t_2 - z5) return tmp
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z4 * z4) * z2) t_1 = Float64(Float64(z0 * Float64(z1 * Float64(z1 / t_0))) / z3) t_2 = Float64(Float64(Float64(z1 * z1) / Float64(Float64(Float64(z2 * z4) * z3) * z4)) * z0) tmp = 0.0 if (Float64(Float64(t_0 * t_0) * Float64(z3 * z3)) <= Inf) tmp = Float64(Float64(t_1 + z5) * Float64(t_1 - z5)); else tmp = Float64(Float64(t_2 + z5) * Float64(t_2 - z5)); end return tmp end
function tmp_2 = code(z1, z0, z4, z2, z3, z5) t_0 = (z4 * z4) * z2; t_1 = (z0 * (z1 * (z1 / t_0))) / z3; t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0; tmp = 0.0; if (((t_0 * t_0) * (z3 * z3)) <= Inf) tmp = (t_1 + z5) * (t_1 - z5); else tmp = (t_2 + z5) * (t_2 - z5); end tmp_2 = tmp; end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z4 * z4), $MachinePrecision] * z2), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z0 * N[(z1 * N[(z1 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z3), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z1 * z1), $MachinePrecision] / N[(N[(N[(z2 * z4), $MachinePrecision] * z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 * t$95$0), $MachinePrecision] * N[(z3 * z3), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$1 + z5), $MachinePrecision] * N[(t$95$1 - z5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + z5), $MachinePrecision] * N[(t$95$2 - z5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(z4 \cdot z4\right) \cdot z2\\
t_1 := \frac{z0 \cdot \left(z1 \cdot \frac{z1}{t\_0}\right)}{z3}\\
t_2 := \frac{z1 \cdot z1}{\left(\left(z2 \cdot z4\right) \cdot z3\right) \cdot z4} \cdot z0\\
\mathbf{if}\;\left(t\_0 \cdot t\_0\right) \cdot \left(z3 \cdot z3\right) \leq \infty:\\
\;\;\;\;\left(t\_1 + z5\right) \cdot \left(t\_1 - z5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + z5\right) \cdot \left(t\_2 - z5\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) < +inf.0Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
if +inf.0 < (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.1%
Applied rewrites71.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.4%
Applied rewrites78.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.2%
Applied rewrites78.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.7%
Applied rewrites81.7%
(FPCore (z1 z0 z4 z2 z3 z5)
:precision binary64
(let* ((t_0 (* (/ (* z1 z1) (* (* (* z2 z4) (fabs z3)) z4)) z0))
(t_1 (* (/ z1 (* (* (fabs z3) z2) z4)) (* (/ z1 z4) z0))))
(if (<= (fabs z3) 2.2e+208)
(* (+ t_1 z5) (- t_1 z5))
(* (+ t_0 z5) (- t_0 z5)))))double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = ((z1 * z1) / (((z2 * z4) * fabs(z3)) * z4)) * z0;
double t_1 = (z1 / ((fabs(z3) * z2) * z4)) * ((z1 / z4) * z0);
double tmp;
if (fabs(z3) <= 2.2e+208) {
tmp = (t_1 + z5) * (t_1 - z5);
} else {
tmp = (t_0 + z5) * (t_0 - z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((z1 * z1) / (((z2 * z4) * abs(z3)) * z4)) * z0
t_1 = (z1 / ((abs(z3) * z2) * z4)) * ((z1 / z4) * z0)
if (abs(z3) <= 2.2d+208) then
tmp = (t_1 + z5) * (t_1 - z5)
else
tmp = (t_0 + z5) * (t_0 - z5)
end if
code = tmp
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = ((z1 * z1) / (((z2 * z4) * Math.abs(z3)) * z4)) * z0;
double t_1 = (z1 / ((Math.abs(z3) * z2) * z4)) * ((z1 / z4) * z0);
double tmp;
if (Math.abs(z3) <= 2.2e+208) {
tmp = (t_1 + z5) * (t_1 - z5);
} else {
tmp = (t_0 + z5) * (t_0 - z5);
}
return tmp;
}
def code(z1, z0, z4, z2, z3, z5): t_0 = ((z1 * z1) / (((z2 * z4) * math.fabs(z3)) * z4)) * z0 t_1 = (z1 / ((math.fabs(z3) * z2) * z4)) * ((z1 / z4) * z0) tmp = 0 if math.fabs(z3) <= 2.2e+208: tmp = (t_1 + z5) * (t_1 - z5) else: tmp = (t_0 + z5) * (t_0 - z5) return tmp
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(Float64(z1 * z1) / Float64(Float64(Float64(z2 * z4) * abs(z3)) * z4)) * z0) t_1 = Float64(Float64(z1 / Float64(Float64(abs(z3) * z2) * z4)) * Float64(Float64(z1 / z4) * z0)) tmp = 0.0 if (abs(z3) <= 2.2e+208) tmp = Float64(Float64(t_1 + z5) * Float64(t_1 - z5)); else tmp = Float64(Float64(t_0 + z5) * Float64(t_0 - z5)); end return tmp end
function tmp_2 = code(z1, z0, z4, z2, z3, z5) t_0 = ((z1 * z1) / (((z2 * z4) * abs(z3)) * z4)) * z0; t_1 = (z1 / ((abs(z3) * z2) * z4)) * ((z1 / z4) * z0); tmp = 0.0; if (abs(z3) <= 2.2e+208) tmp = (t_1 + z5) * (t_1 - z5); else tmp = (t_0 + z5) * (t_0 - z5); end tmp_2 = tmp; end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(N[(z1 * z1), $MachinePrecision] / N[(N[(N[(z2 * z4), $MachinePrecision] * N[Abs[z3], $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z1 / N[(N[(N[Abs[z3], $MachinePrecision] * z2), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * N[(N[(z1 / z4), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[z3], $MachinePrecision], 2.2e+208], N[(N[(t$95$1 + z5), $MachinePrecision] * N[(t$95$1 - z5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + z5), $MachinePrecision] * N[(t$95$0 - z5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z1 \cdot z1}{\left(\left(z2 \cdot z4\right) \cdot \left|z3\right|\right) \cdot z4} \cdot z0\\
t_1 := \frac{z1}{\left(\left|z3\right| \cdot z2\right) \cdot z4} \cdot \left(\frac{z1}{z4} \cdot z0\right)\\
\mathbf{if}\;\left|z3\right| \leq 2.2 \cdot 10^{+208}:\\
\;\;\;\;\left(t\_1 + z5\right) \cdot \left(t\_1 - z5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 + z5\right) \cdot \left(t\_0 - z5\right)\\
\end{array}
if z3 < 2.2000000000000001e208Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites81.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites91.0%
if 2.2000000000000001e208 < z3 Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.1%
Applied rewrites71.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.4%
Applied rewrites78.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.2%
Applied rewrites78.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.7%
Applied rewrites81.7%
(FPCore (z1 z0 z4 z2 z3 z5)
:precision binary64
(let* ((t_0 (* (/ z0 z4) (* z1 (/ z1 (* (* z3 z2) z4)))))
(t_1 (* (* z4 z4) z2))
(t_2 (* (/ (* z1 z1) (* (* (* z2 z4) z3) z4)) z0)))
(if (<= (* (* t_1 t_1) (* z3 z3)) INFINITY)
(* (+ t_0 z5) (- t_0 z5))
(* (+ t_2 z5) (- t_2 z5)))))double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 / z4) * (z1 * (z1 / ((z3 * z2) * z4)));
double t_1 = (z4 * z4) * z2;
double t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0;
double tmp;
if (((t_1 * t_1) * (z3 * z3)) <= ((double) INFINITY)) {
tmp = (t_0 + z5) * (t_0 - z5);
} else {
tmp = (t_2 + z5) * (t_2 - z5);
}
return tmp;
}
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 / z4) * (z1 * (z1 / ((z3 * z2) * z4)));
double t_1 = (z4 * z4) * z2;
double t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0;
double tmp;
if (((t_1 * t_1) * (z3 * z3)) <= Double.POSITIVE_INFINITY) {
tmp = (t_0 + z5) * (t_0 - z5);
} else {
tmp = (t_2 + z5) * (t_2 - z5);
}
return tmp;
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z0 / z4) * (z1 * (z1 / ((z3 * z2) * z4))) t_1 = (z4 * z4) * z2 t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0 tmp = 0 if ((t_1 * t_1) * (z3 * z3)) <= math.inf: tmp = (t_0 + z5) * (t_0 - z5) else: tmp = (t_2 + z5) * (t_2 - z5) return tmp
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z0 / z4) * Float64(z1 * Float64(z1 / Float64(Float64(z3 * z2) * z4)))) t_1 = Float64(Float64(z4 * z4) * z2) t_2 = Float64(Float64(Float64(z1 * z1) / Float64(Float64(Float64(z2 * z4) * z3) * z4)) * z0) tmp = 0.0 if (Float64(Float64(t_1 * t_1) * Float64(z3 * z3)) <= Inf) tmp = Float64(Float64(t_0 + z5) * Float64(t_0 - z5)); else tmp = Float64(Float64(t_2 + z5) * Float64(t_2 - z5)); end return tmp end
function tmp_2 = code(z1, z0, z4, z2, z3, z5) t_0 = (z0 / z4) * (z1 * (z1 / ((z3 * z2) * z4))); t_1 = (z4 * z4) * z2; t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0; tmp = 0.0; if (((t_1 * t_1) * (z3 * z3)) <= Inf) tmp = (t_0 + z5) * (t_0 - z5); else tmp = (t_2 + z5) * (t_2 - z5); end tmp_2 = tmp; end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z0 / z4), $MachinePrecision] * N[(z1 * N[(z1 / N[(N[(z3 * z2), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z4 * z4), $MachinePrecision] * z2), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z1 * z1), $MachinePrecision] / N[(N[(N[(z2 * z4), $MachinePrecision] * z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(z3 * z3), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$0 + z5), $MachinePrecision] * N[(t$95$0 - z5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + z5), $MachinePrecision] * N[(t$95$2 - z5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \frac{z0}{z4} \cdot \left(z1 \cdot \frac{z1}{\left(z3 \cdot z2\right) \cdot z4}\right)\\
t_1 := \left(z4 \cdot z4\right) \cdot z2\\
t_2 := \frac{z1 \cdot z1}{\left(\left(z2 \cdot z4\right) \cdot z3\right) \cdot z4} \cdot z0\\
\mathbf{if}\;\left(t\_1 \cdot t\_1\right) \cdot \left(z3 \cdot z3\right) \leq \infty:\\
\;\;\;\;\left(t\_0 + z5\right) \cdot \left(t\_0 - z5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + z5\right) \cdot \left(t\_2 - z5\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) < +inf.0Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites80.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/l*N/A
Applied rewrites87.6%
if +inf.0 < (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.1%
Applied rewrites71.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.4%
Applied rewrites78.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.2%
Applied rewrites78.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.7%
Applied rewrites81.7%
(FPCore (z1 z0 z4 z2 z3 z5)
:precision binary64
(let* ((t_0
(*
(/ (* z1 z1) (* (* (* (fabs z2) z4) (fabs z3)) z4))
(fabs z0)))
(t_1 (* (* z4 z4) (fabs z2))))
(if (<= (* (* t_1 t_1) (* (fabs z3) (fabs z3))) INFINITY)
(*
(-
(fabs z5)
(*
(- (* (/ z1 (* (* (* (fabs z3) (fabs z2)) z4) z4)) z1))
(fabs z0)))
(- (/ (* (fabs z0) (* z1 (/ z1 t_1))) (fabs z3)) (fabs z5)))
(* (+ t_0 (fabs z5)) (- t_0 (fabs z5))))))double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = ((z1 * z1) / (((fabs(z2) * z4) * fabs(z3)) * z4)) * fabs(z0);
double t_1 = (z4 * z4) * fabs(z2);
double tmp;
if (((t_1 * t_1) * (fabs(z3) * fabs(z3))) <= ((double) INFINITY)) {
tmp = (fabs(z5) - (-((z1 / (((fabs(z3) * fabs(z2)) * z4) * z4)) * z1) * fabs(z0))) * (((fabs(z0) * (z1 * (z1 / t_1))) / fabs(z3)) - fabs(z5));
} else {
tmp = (t_0 + fabs(z5)) * (t_0 - fabs(z5));
}
return tmp;
}
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = ((z1 * z1) / (((Math.abs(z2) * z4) * Math.abs(z3)) * z4)) * Math.abs(z0);
double t_1 = (z4 * z4) * Math.abs(z2);
double tmp;
if (((t_1 * t_1) * (Math.abs(z3) * Math.abs(z3))) <= Double.POSITIVE_INFINITY) {
tmp = (Math.abs(z5) - (-((z1 / (((Math.abs(z3) * Math.abs(z2)) * z4) * z4)) * z1) * Math.abs(z0))) * (((Math.abs(z0) * (z1 * (z1 / t_1))) / Math.abs(z3)) - Math.abs(z5));
} else {
tmp = (t_0 + Math.abs(z5)) * (t_0 - Math.abs(z5));
}
return tmp;
}
def code(z1, z0, z4, z2, z3, z5): t_0 = ((z1 * z1) / (((math.fabs(z2) * z4) * math.fabs(z3)) * z4)) * math.fabs(z0) t_1 = (z4 * z4) * math.fabs(z2) tmp = 0 if ((t_1 * t_1) * (math.fabs(z3) * math.fabs(z3))) <= math.inf: tmp = (math.fabs(z5) - (-((z1 / (((math.fabs(z3) * math.fabs(z2)) * z4) * z4)) * z1) * math.fabs(z0))) * (((math.fabs(z0) * (z1 * (z1 / t_1))) / math.fabs(z3)) - math.fabs(z5)) else: tmp = (t_0 + math.fabs(z5)) * (t_0 - math.fabs(z5)) return tmp
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(Float64(z1 * z1) / Float64(Float64(Float64(abs(z2) * z4) * abs(z3)) * z4)) * abs(z0)) t_1 = Float64(Float64(z4 * z4) * abs(z2)) tmp = 0.0 if (Float64(Float64(t_1 * t_1) * Float64(abs(z3) * abs(z3))) <= Inf) tmp = Float64(Float64(abs(z5) - Float64(Float64(-Float64(Float64(z1 / Float64(Float64(Float64(abs(z3) * abs(z2)) * z4) * z4)) * z1)) * abs(z0))) * Float64(Float64(Float64(abs(z0) * Float64(z1 * Float64(z1 / t_1))) / abs(z3)) - abs(z5))); else tmp = Float64(Float64(t_0 + abs(z5)) * Float64(t_0 - abs(z5))); end return tmp end
function tmp_2 = code(z1, z0, z4, z2, z3, z5) t_0 = ((z1 * z1) / (((abs(z2) * z4) * abs(z3)) * z4)) * abs(z0); t_1 = (z4 * z4) * abs(z2); tmp = 0.0; if (((t_1 * t_1) * (abs(z3) * abs(z3))) <= Inf) tmp = (abs(z5) - (-((z1 / (((abs(z3) * abs(z2)) * z4) * z4)) * z1) * abs(z0))) * (((abs(z0) * (z1 * (z1 / t_1))) / abs(z3)) - abs(z5)); else tmp = (t_0 + abs(z5)) * (t_0 - abs(z5)); end tmp_2 = tmp; end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(N[(z1 * z1), $MachinePrecision] / N[(N[(N[(N[Abs[z2], $MachinePrecision] * z4), $MachinePrecision] * N[Abs[z3], $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * N[Abs[z0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z4 * z4), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(N[Abs[z3], $MachinePrecision] * N[Abs[z3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[Abs[z5], $MachinePrecision] - N[((-N[(N[(z1 / N[(N[(N[(N[Abs[z3], $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision] * z4), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z1), $MachinePrecision]) * N[Abs[z0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[Abs[z0], $MachinePrecision] * N[(z1 * N[(z1 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Abs[z3], $MachinePrecision]), $MachinePrecision] - N[Abs[z5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + N[Abs[z5], $MachinePrecision]), $MachinePrecision] * N[(t$95$0 - N[Abs[z5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{z1 \cdot z1}{\left(\left(\left|z2\right| \cdot z4\right) \cdot \left|z3\right|\right) \cdot z4} \cdot \left|z0\right|\\
t_1 := \left(z4 \cdot z4\right) \cdot \left|z2\right|\\
\mathbf{if}\;\left(t\_1 \cdot t\_1\right) \cdot \left(\left|z3\right| \cdot \left|z3\right|\right) \leq \infty:\\
\;\;\;\;\left(\left|z5\right| - \left(-\frac{z1}{\left(\left(\left|z3\right| \cdot \left|z2\right|\right) \cdot z4\right) \cdot z4} \cdot z1\right) \cdot \left|z0\right|\right) \cdot \left(\frac{\left|z0\right| \cdot \left(z1 \cdot \frac{z1}{t\_1}\right)}{\left|z3\right|} - \left|z5\right|\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 + \left|z5\right|\right) \cdot \left(t\_0 - \left|z5\right|\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) < +inf.0Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-+.f64N/A
add-flipN/A
sub-flipN/A
Applied rewrites82.0%
if +inf.0 < (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.1%
Applied rewrites71.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.4%
Applied rewrites78.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.2%
Applied rewrites78.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.7%
Applied rewrites81.7%
(FPCore (z1 z0 z4 z2 z3 z5)
:precision binary64
(let* ((t_0 (* z1 (* (/ z1 (* (* (* z3 z2) z4) z4)) z0)))
(t_1 (* (* z4 z4) z2))
(t_2 (* (/ (* z1 z1) (* (* (* z2 z4) z3) z4)) z0)))
(if (<= (* (* t_1 t_1) (* z3 z3)) INFINITY)
(* (+ t_0 z5) (- t_0 z5))
(* (+ t_2 z5) (- t_2 z5)))))double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0);
double t_1 = (z4 * z4) * z2;
double t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0;
double tmp;
if (((t_1 * t_1) * (z3 * z3)) <= ((double) INFINITY)) {
tmp = (t_0 + z5) * (t_0 - z5);
} else {
tmp = (t_2 + z5) * (t_2 - z5);
}
return tmp;
}
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0);
double t_1 = (z4 * z4) * z2;
double t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0;
double tmp;
if (((t_1 * t_1) * (z3 * z3)) <= Double.POSITIVE_INFINITY) {
tmp = (t_0 + z5) * (t_0 - z5);
} else {
tmp = (t_2 + z5) * (t_2 - z5);
}
return tmp;
}
def code(z1, z0, z4, z2, z3, z5): t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0) t_1 = (z4 * z4) * z2 t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0 tmp = 0 if ((t_1 * t_1) * (z3 * z3)) <= math.inf: tmp = (t_0 + z5) * (t_0 - z5) else: tmp = (t_2 + z5) * (t_2 - z5) return tmp
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(z1 * Float64(Float64(z1 / Float64(Float64(Float64(z3 * z2) * z4) * z4)) * z0)) t_1 = Float64(Float64(z4 * z4) * z2) t_2 = Float64(Float64(Float64(z1 * z1) / Float64(Float64(Float64(z2 * z4) * z3) * z4)) * z0) tmp = 0.0 if (Float64(Float64(t_1 * t_1) * Float64(z3 * z3)) <= Inf) tmp = Float64(Float64(t_0 + z5) * Float64(t_0 - z5)); else tmp = Float64(Float64(t_2 + z5) * Float64(t_2 - z5)); end return tmp end
function tmp_2 = code(z1, z0, z4, z2, z3, z5) t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0); t_1 = (z4 * z4) * z2; t_2 = ((z1 * z1) / (((z2 * z4) * z3) * z4)) * z0; tmp = 0.0; if (((t_1 * t_1) * (z3 * z3)) <= Inf) tmp = (t_0 + z5) * (t_0 - z5); else tmp = (t_2 + z5) * (t_2 - z5); end tmp_2 = tmp; end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(z1 * N[(N[(z1 / N[(N[(N[(z3 * z2), $MachinePrecision] * z4), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z4 * z4), $MachinePrecision] * z2), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z1 * z1), $MachinePrecision] / N[(N[(N[(z2 * z4), $MachinePrecision] * z3), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$1 * t$95$1), $MachinePrecision] * N[(z3 * z3), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t$95$0 + z5), $MachinePrecision] * N[(t$95$0 - z5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 + z5), $MachinePrecision] * N[(t$95$2 - z5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := z1 \cdot \left(\frac{z1}{\left(\left(z3 \cdot z2\right) \cdot z4\right) \cdot z4} \cdot z0\right)\\
t_1 := \left(z4 \cdot z4\right) \cdot z2\\
t_2 := \frac{z1 \cdot z1}{\left(\left(z2 \cdot z4\right) \cdot z3\right) \cdot z4} \cdot z0\\
\mathbf{if}\;\left(t\_1 \cdot t\_1\right) \cdot \left(z3 \cdot z3\right) \leq \infty:\\
\;\;\;\;\left(t\_0 + z5\right) \cdot \left(t\_0 - z5\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 + z5\right) \cdot \left(t\_2 - z5\right)\\
\end{array}
if (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) < +inf.0Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites82.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites87.1%
if +inf.0 < (*.f64 (*.f64 (*.f64 (*.f64 z4 z4) z2) (*.f64 (*.f64 z4 z4) z2)) (*.f64 z3 z3)) Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6471.1%
Applied rewrites71.1%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6473.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.4%
Applied rewrites78.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6478.2%
Applied rewrites78.2%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6481.7%
Applied rewrites81.7%
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (* z1 (* (/ z1 (* (* (* z3 z2) z4) z4)) z0)))) (* (+ t_0 z5) (- t_0 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0);
return (t_0 + z5) * (t_0 - z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0)
code = (t_0 + z5) * (t_0 - z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0);
return (t_0 + z5) * (t_0 - z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0) return (t_0 + z5) * (t_0 - z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(z1 * Float64(Float64(z1 / Float64(Float64(Float64(z3 * z2) * z4) * z4)) * z0)) return Float64(Float64(t_0 + z5) * Float64(t_0 - z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = z1 * ((z1 / (((z3 * z2) * z4) * z4)) * z0); tmp = (t_0 + z5) * (t_0 - z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(z1 * N[(N[(z1 / N[(N[(N[(z3 * z2), $MachinePrecision] * z4), $MachinePrecision] * z4), $MachinePrecision]), $MachinePrecision] * z0), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$0 + z5), $MachinePrecision] * N[(t$95$0 - z5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := z1 \cdot \left(\frac{z1}{\left(\left(z3 \cdot z2\right) \cdot z4\right) \cdot z4} \cdot z0\right)\\
\left(t\_0 + z5\right) \cdot \left(t\_0 - z5\right)
\end{array}
Initial program 49.9%
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
unswap-sqrN/A
times-fracN/A
Applied rewrites73.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.5%
Applied rewrites73.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6484.5%
Applied rewrites84.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites82.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
associate-/l/N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
Applied rewrites87.1%
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (* (* z0 z1) z1)) (t_1 (* (* (* z4 z3) z2) z4))) (- (* t_0 (/ t_0 (* t_1 t_1))) (* z5 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * z1) * z1;
double t_1 = ((z4 * z3) * z2) * z4;
return (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
real(8) :: t_1
t_0 = (z0 * z1) * z1
t_1 = ((z4 * z3) * z2) * z4
code = (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * z1) * z1;
double t_1 = ((z4 * z3) * z2) * z4;
return (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z0 * z1) * z1 t_1 = ((z4 * z3) * z2) * z4 return (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z0 * z1) * z1) t_1 = Float64(Float64(Float64(z4 * z3) * z2) * z4) return Float64(Float64(t_0 * Float64(t_0 / Float64(t_1 * t_1))) - Float64(z5 * z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = (z0 * z1) * z1; t_1 = ((z4 * z3) * z2) * z4; tmp = (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z0 * z1), $MachinePrecision] * z1), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(z4 * z3), $MachinePrecision] * z2), $MachinePrecision] * z4), $MachinePrecision]}, N[(N[(t$95$0 * N[(t$95$0 / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(z0 \cdot z1\right) \cdot z1\\
t_1 := \left(\left(z4 \cdot z3\right) \cdot z2\right) \cdot z4\\
t\_0 \cdot \frac{t\_0}{t\_1 \cdot t\_1} - z5 \cdot z5
\end{array}
Initial program 49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9%
Applied rewrites49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.9%
Applied rewrites52.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites63.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites66.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6466.5%
Applied rewrites66.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6469.3%
Applied rewrites69.3%
(FPCore (z1 z0 z4 z2 z3 z5)
:precision binary64
(let* ((t_0 (* (* z3 (* z4 z4)) (fabs z2)))
(t_1 (* (* z0 z1) z1))
(t_2 (* (* (* (fabs z2) z3) z4) z4)))
(if (<= (fabs z2) 2e+153)
(- (* t_1 (/ t_1 (* t_0 t_0))) (* z5 z5))
(- (* t_1 (/ t_1 (* t_2 t_2))) (* z5 z5)))))double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z3 * (z4 * z4)) * fabs(z2);
double t_1 = (z0 * z1) * z1;
double t_2 = ((fabs(z2) * z3) * z4) * z4;
double tmp;
if (fabs(z2) <= 2e+153) {
tmp = (t_1 * (t_1 / (t_0 * t_0))) - (z5 * z5);
} else {
tmp = (t_1 * (t_1 / (t_2 * t_2))) - (z5 * z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (z3 * (z4 * z4)) * abs(z2)
t_1 = (z0 * z1) * z1
t_2 = ((abs(z2) * z3) * z4) * z4
if (abs(z2) <= 2d+153) then
tmp = (t_1 * (t_1 / (t_0 * t_0))) - (z5 * z5)
else
tmp = (t_1 * (t_1 / (t_2 * t_2))) - (z5 * z5)
end if
code = tmp
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z3 * (z4 * z4)) * Math.abs(z2);
double t_1 = (z0 * z1) * z1;
double t_2 = ((Math.abs(z2) * z3) * z4) * z4;
double tmp;
if (Math.abs(z2) <= 2e+153) {
tmp = (t_1 * (t_1 / (t_0 * t_0))) - (z5 * z5);
} else {
tmp = (t_1 * (t_1 / (t_2 * t_2))) - (z5 * z5);
}
return tmp;
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z3 * (z4 * z4)) * math.fabs(z2) t_1 = (z0 * z1) * z1 t_2 = ((math.fabs(z2) * z3) * z4) * z4 tmp = 0 if math.fabs(z2) <= 2e+153: tmp = (t_1 * (t_1 / (t_0 * t_0))) - (z5 * z5) else: tmp = (t_1 * (t_1 / (t_2 * t_2))) - (z5 * z5) return tmp
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z3 * Float64(z4 * z4)) * abs(z2)) t_1 = Float64(Float64(z0 * z1) * z1) t_2 = Float64(Float64(Float64(abs(z2) * z3) * z4) * z4) tmp = 0.0 if (abs(z2) <= 2e+153) tmp = Float64(Float64(t_1 * Float64(t_1 / Float64(t_0 * t_0))) - Float64(z5 * z5)); else tmp = Float64(Float64(t_1 * Float64(t_1 / Float64(t_2 * t_2))) - Float64(z5 * z5)); end return tmp end
function tmp_2 = code(z1, z0, z4, z2, z3, z5) t_0 = (z3 * (z4 * z4)) * abs(z2); t_1 = (z0 * z1) * z1; t_2 = ((abs(z2) * z3) * z4) * z4; tmp = 0.0; if (abs(z2) <= 2e+153) tmp = (t_1 * (t_1 / (t_0 * t_0))) - (z5 * z5); else tmp = (t_1 * (t_1 / (t_2 * t_2))) - (z5 * z5); end tmp_2 = tmp; end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z3 * N[(z4 * z4), $MachinePrecision]), $MachinePrecision] * N[Abs[z2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z0 * z1), $MachinePrecision] * z1), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[Abs[z2], $MachinePrecision] * z3), $MachinePrecision] * z4), $MachinePrecision] * z4), $MachinePrecision]}, If[LessEqual[N[Abs[z2], $MachinePrecision], 2e+153], N[(N[(t$95$1 * N[(t$95$1 / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(t$95$1 / N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_0 := \left(z3 \cdot \left(z4 \cdot z4\right)\right) \cdot \left|z2\right|\\
t_1 := \left(z0 \cdot z1\right) \cdot z1\\
t_2 := \left(\left(\left|z2\right| \cdot z3\right) \cdot z4\right) \cdot z4\\
\mathbf{if}\;\left|z2\right| \leq 2 \cdot 10^{+153}:\\
\;\;\;\;t\_1 \cdot \frac{t\_1}{t\_0 \cdot t\_0} - z5 \cdot z5\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{t\_1}{t\_2 \cdot t\_2} - z5 \cdot z5\\
\end{array}
if z2 < 2e153Initial program 49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9%
Applied rewrites49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.9%
Applied rewrites52.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites63.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites66.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6463.5%
Applied rewrites63.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6466.3%
Applied rewrites66.3%
if 2e153 < z2 Initial program 49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9%
Applied rewrites49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.9%
Applied rewrites52.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow-prod-downN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
lower-*.f6466.2%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6463.4%
lift-*.f64N/A
Applied rewrites66.5%
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (* (* z0 z1) z1)) (t_1 (* (* z3 (* z4 z4)) z2))) (- (* t_0 (/ t_0 (* t_1 t_1))) (* z5 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * z1) * z1;
double t_1 = (z3 * (z4 * z4)) * z2;
return (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
real(8) :: t_1
t_0 = (z0 * z1) * z1
t_1 = (z3 * (z4 * z4)) * z2
code = (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * z1) * z1;
double t_1 = (z3 * (z4 * z4)) * z2;
return (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z0 * z1) * z1 t_1 = (z3 * (z4 * z4)) * z2 return (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z0 * z1) * z1) t_1 = Float64(Float64(z3 * Float64(z4 * z4)) * z2) return Float64(Float64(t_0 * Float64(t_0 / Float64(t_1 * t_1))) - Float64(z5 * z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = (z0 * z1) * z1; t_1 = (z3 * (z4 * z4)) * z2; tmp = (t_0 * (t_0 / (t_1 * t_1))) - (z5 * z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z0 * z1), $MachinePrecision] * z1), $MachinePrecision]}, Block[{t$95$1 = N[(N[(z3 * N[(z4 * z4), $MachinePrecision]), $MachinePrecision] * z2), $MachinePrecision]}, N[(N[(t$95$0 * N[(t$95$0 / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left(z0 \cdot z1\right) \cdot z1\\
t_1 := \left(z3 \cdot \left(z4 \cdot z4\right)\right) \cdot z2\\
t\_0 \cdot \frac{t\_0}{t\_1 \cdot t\_1} - z5 \cdot z5
\end{array}
Initial program 49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9%
Applied rewrites49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.9%
Applied rewrites52.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites63.4%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites66.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6463.5%
Applied rewrites63.5%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6466.3%
Applied rewrites66.3%
(FPCore (z1 z0 z4 z2 z3 z5) :precision binary64 (let* ((t_0 (* (* z0 z1) z1))) (- (* t_0 (/ t_0 (* z3 (* (* z4 z4) (* z3 (* (* (* z4 z4) z2) z2)))))) (* z5 z5))))
double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * z1) * z1;
return (t_0 * (t_0 / (z3 * ((z4 * z4) * (z3 * (((z4 * z4) * z2) * z2)))))) - (z5 * z5);
}
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(z1, z0, z4, z2, z3, z5)
use fmin_fmax_functions
real(8), intent (in) :: z1
real(8), intent (in) :: z0
real(8), intent (in) :: z4
real(8), intent (in) :: z2
real(8), intent (in) :: z3
real(8), intent (in) :: z5
real(8) :: t_0
t_0 = (z0 * z1) * z1
code = (t_0 * (t_0 / (z3 * ((z4 * z4) * (z3 * (((z4 * z4) * z2) * z2)))))) - (z5 * z5)
end function
public static double code(double z1, double z0, double z4, double z2, double z3, double z5) {
double t_0 = (z0 * z1) * z1;
return (t_0 * (t_0 / (z3 * ((z4 * z4) * (z3 * (((z4 * z4) * z2) * z2)))))) - (z5 * z5);
}
def code(z1, z0, z4, z2, z3, z5): t_0 = (z0 * z1) * z1 return (t_0 * (t_0 / (z3 * ((z4 * z4) * (z3 * (((z4 * z4) * z2) * z2)))))) - (z5 * z5)
function code(z1, z0, z4, z2, z3, z5) t_0 = Float64(Float64(z0 * z1) * z1) return Float64(Float64(t_0 * Float64(t_0 / Float64(z3 * Float64(Float64(z4 * z4) * Float64(z3 * Float64(Float64(Float64(z4 * z4) * z2) * z2)))))) - Float64(z5 * z5)) end
function tmp = code(z1, z0, z4, z2, z3, z5) t_0 = (z0 * z1) * z1; tmp = (t_0 * (t_0 / (z3 * ((z4 * z4) * (z3 * (((z4 * z4) * z2) * z2)))))) - (z5 * z5); end
code[z1_, z0_, z4_, z2_, z3_, z5_] := Block[{t$95$0 = N[(N[(z0 * z1), $MachinePrecision] * z1), $MachinePrecision]}, N[(N[(t$95$0 * N[(t$95$0 / N[(z3 * N[(N[(z4 * z4), $MachinePrecision] * N[(z3 * N[(N[(N[(z4 * z4), $MachinePrecision] * z2), $MachinePrecision] * z2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z5 * z5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(z0 \cdot z1\right) \cdot z1\\
t\_0 \cdot \frac{t\_0}{z3 \cdot \left(\left(z4 \cdot z4\right) \cdot \left(z3 \cdot \left(\left(\left(z4 \cdot z4\right) \cdot z2\right) \cdot z2\right)\right)\right)} - z5 \cdot z5
\end{array}
Initial program 49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6449.9%
Applied rewrites49.9%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6452.9%
Applied rewrites52.9%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
swap-sqrN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
Applied rewrites63.4%
herbie shell --seed 2025260 -o generate:taylor -o generate:evaluate
(FPCore (z1 z0 z4 z2 z3 z5)
:name "(- (* (* (* z1 z1) z0) (/ (* (* z1 z1) z0) (* (* (* (* z4 z4) z2) (* (* z4 z4) z2)) (* z3 z3)))) (* z5 z5))"
:precision binary64
(- (* (* (* z1 z1) z0) (/ (* (* z1 z1) z0) (* (* (* (* z4 z4) z2) (* (* z4 z4) z2)) (* z3 z3)))) (* z5 z5)))