
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * x) / (y * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t): return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = ((x * x) / (y * y)) + ((z * z) / (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))
double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * x) / (y * y)) + ((z * z) / (t * t))
end function
public static double code(double x, double y, double z, double t) {
return ((x * x) / (y * y)) + ((z * z) / (t * t));
}
def code(x, y, z, t): return ((x * x) / (y * y)) + ((z * z) / (t * t))
function code(x, y, z, t) return Float64(Float64(Float64(x * x) / Float64(y * y)) + Float64(Float64(z * z) / Float64(t * t))) end
function tmp = code(x, y, z, t) tmp = ((x * x) / (y * y)) + ((z * z) / (t * t)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x}{y \cdot y} + \frac{z \cdot z}{t \cdot t}
\end{array}
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x_m y_m z_m t_m)
:precision binary64
(let* ((t_1 (/ (* z_m z_m) (* t_m t_m))))
(if (<= t_1 2e+228)
(+ (* (/ x_m y_m) (/ x_m y_m)) t_1)
(* (+ (/ z_m t_m) (/ x_m y_m)) (/ z_m t_m)))))x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double t_1 = (z_m * z_m) / (t_m * t_m);
double tmp;
if (t_1 <= 2e+228) {
tmp = ((x_m / y_m) * (x_m / y_m)) + t_1;
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (z_m * z_m) / (t_m * t_m)
if (t_1 <= 2d+228) then
tmp = ((x_m / y_m) * (x_m / y_m)) + t_1
else
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m)
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double t_1 = (z_m * z_m) / (t_m * t_m);
double tmp;
if (t_1 <= 2e+228) {
tmp = ((x_m / y_m) * (x_m / y_m)) + t_1;
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): t_1 = (z_m * z_m) / (t_m * t_m) tmp = 0 if t_1 <= 2e+228: tmp = ((x_m / y_m) * (x_m / y_m)) + t_1 else: tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m) return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) t_1 = Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) tmp = 0.0 if (t_1 <= 2e+228) tmp = Float64(Float64(Float64(x_m / y_m) * Float64(x_m / y_m)) + t_1); else tmp = Float64(Float64(Float64(z_m / t_m) + Float64(x_m / y_m)) * Float64(z_m / t_m)); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) t_1 = (z_m * z_m) / (t_m * t_m); tmp = 0.0; if (t_1 <= 2e+228) tmp = ((x_m / y_m) * (x_m / y_m)) + t_1; else tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := Block[{t$95$1 = N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+228], N[(N[(N[(x$95$m / y$95$m), $MachinePrecision] * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(z$95$m / t$95$m), $MachinePrecision] + N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision] * N[(z$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{z\_m \cdot z\_m}{t\_m \cdot t\_m}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\frac{x\_m}{y\_m} \cdot \frac{x\_m}{y\_m} + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z\_m}{t\_m} + \frac{x\_m}{y\_m}\right) \cdot \frac{z\_m}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 1.9999999999999998e228Initial program 77.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6496.6
Applied rewrites96.6%
if 1.9999999999999998e228 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 55.8%
Applied rewrites81.5%
Taylor expanded in x around 0
lower-/.f6485.9
Applied rewrites85.9%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x_m y_m z_m t_m)
:precision binary64
(let* ((t_1 (/ (* z_m z_m) (* t_m t_m))))
(if (<= t_1 2e-315)
(* (/ x_m y_m) (/ x_m y_m))
(if (<= t_1 2e+228)
(+ (/ (* x_m x_m) (* y_m y_m)) (* z_m (/ z_m (* t_m t_m))))
(* (+ (/ z_m t_m) (/ x_m y_m)) (/ z_m t_m))))))x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double t_1 = (z_m * z_m) / (t_m * t_m);
double tmp;
if (t_1 <= 2e-315) {
tmp = (x_m / y_m) * (x_m / y_m);
} else if (t_1 <= 2e+228) {
tmp = ((x_m * x_m) / (y_m * y_m)) + (z_m * (z_m / (t_m * t_m)));
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (z_m * z_m) / (t_m * t_m)
if (t_1 <= 2d-315) then
tmp = (x_m / y_m) * (x_m / y_m)
else if (t_1 <= 2d+228) then
tmp = ((x_m * x_m) / (y_m * y_m)) + (z_m * (z_m / (t_m * t_m)))
else
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m)
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double t_1 = (z_m * z_m) / (t_m * t_m);
double tmp;
if (t_1 <= 2e-315) {
tmp = (x_m / y_m) * (x_m / y_m);
} else if (t_1 <= 2e+228) {
tmp = ((x_m * x_m) / (y_m * y_m)) + (z_m * (z_m / (t_m * t_m)));
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): t_1 = (z_m * z_m) / (t_m * t_m) tmp = 0 if t_1 <= 2e-315: tmp = (x_m / y_m) * (x_m / y_m) elif t_1 <= 2e+228: tmp = ((x_m * x_m) / (y_m * y_m)) + (z_m * (z_m / (t_m * t_m))) else: tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m) return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) t_1 = Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) tmp = 0.0 if (t_1 <= 2e-315) tmp = Float64(Float64(x_m / y_m) * Float64(x_m / y_m)); elseif (t_1 <= 2e+228) tmp = Float64(Float64(Float64(x_m * x_m) / Float64(y_m * y_m)) + Float64(z_m * Float64(z_m / Float64(t_m * t_m)))); else tmp = Float64(Float64(Float64(z_m / t_m) + Float64(x_m / y_m)) * Float64(z_m / t_m)); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) t_1 = (z_m * z_m) / (t_m * t_m); tmp = 0.0; if (t_1 <= 2e-315) tmp = (x_m / y_m) * (x_m / y_m); elseif (t_1 <= 2e+228) tmp = ((x_m * x_m) / (y_m * y_m)) + (z_m * (z_m / (t_m * t_m))); else tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := Block[{t$95$1 = N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-315], N[(N[(x$95$m / y$95$m), $MachinePrecision] * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+228], N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] + N[(z$95$m * N[(z$95$m / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z$95$m / t$95$m), $MachinePrecision] + N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision] * N[(z$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{z\_m \cdot z\_m}{t\_m \cdot t\_m}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-315}:\\
\;\;\;\;\frac{x\_m}{y\_m} \cdot \frac{x\_m}{y\_m}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\frac{x\_m \cdot x\_m}{y\_m \cdot y\_m} + z\_m \cdot \frac{z\_m}{t\_m \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z\_m}{t\_m} + \frac{x\_m}{y\_m}\right) \cdot \frac{z\_m}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 2.0000000019e-315Initial program 70.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
lift-+.f64N/A
lift-*.f64N/A
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
lift-*.f64N/A
frac-addN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
Applied rewrites86.4%
Taylor expanded in x around inf
unpow2N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6495.2
Applied rewrites95.2%
if 2.0000000019e-315 < (/.f64 (*.f64 z z) (*.f64 t t)) < 1.9999999999999998e228Initial program 92.7%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6492.8
Applied rewrites92.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
sqr-neg-revN/A
associate-/l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-*.f6492.9
Applied rewrites92.9%
if 1.9999999999999998e228 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 55.8%
Applied rewrites81.5%
Taylor expanded in x around 0
lower-/.f6485.9
Applied rewrites85.9%
Final simplification90.5%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
z_m = (fabs.f64 z)
t_m = (fabs.f64 t)
(FPCore (x_m y_m z_m t_m)
:precision binary64
(let* ((t_1 (/ (* z_m z_m) (* t_m t_m))))
(if (<= t_1 2e-315)
(* (/ x_m y_m) (/ x_m y_m))
(if (<= t_1 2e+228)
(+ (/ (* x_m x_m) (* y_m y_m)) t_1)
(* (+ (/ z_m t_m) (/ x_m y_m)) (/ z_m t_m))))))x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double t_1 = (z_m * z_m) / (t_m * t_m);
double tmp;
if (t_1 <= 2e-315) {
tmp = (x_m / y_m) * (x_m / y_m);
} else if (t_1 <= 2e+228) {
tmp = ((x_m * x_m) / (y_m * y_m)) + t_1;
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (z_m * z_m) / (t_m * t_m)
if (t_1 <= 2d-315) then
tmp = (x_m / y_m) * (x_m / y_m)
else if (t_1 <= 2d+228) then
tmp = ((x_m * x_m) / (y_m * y_m)) + t_1
else
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m)
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double t_1 = (z_m * z_m) / (t_m * t_m);
double tmp;
if (t_1 <= 2e-315) {
tmp = (x_m / y_m) * (x_m / y_m);
} else if (t_1 <= 2e+228) {
tmp = ((x_m * x_m) / (y_m * y_m)) + t_1;
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): t_1 = (z_m * z_m) / (t_m * t_m) tmp = 0 if t_1 <= 2e-315: tmp = (x_m / y_m) * (x_m / y_m) elif t_1 <= 2e+228: tmp = ((x_m * x_m) / (y_m * y_m)) + t_1 else: tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m) return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) t_1 = Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) tmp = 0.0 if (t_1 <= 2e-315) tmp = Float64(Float64(x_m / y_m) * Float64(x_m / y_m)); elseif (t_1 <= 2e+228) tmp = Float64(Float64(Float64(x_m * x_m) / Float64(y_m * y_m)) + t_1); else tmp = Float64(Float64(Float64(z_m / t_m) + Float64(x_m / y_m)) * Float64(z_m / t_m)); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) t_1 = (z_m * z_m) / (t_m * t_m); tmp = 0.0; if (t_1 <= 2e-315) tmp = (x_m / y_m) * (x_m / y_m); elseif (t_1 <= 2e+228) tmp = ((x_m * x_m) / (y_m * y_m)) + t_1; else tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
z_m = N[Abs[z], $MachinePrecision]
t_m = N[Abs[t], $MachinePrecision]
code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := Block[{t$95$1 = N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-315], N[(N[(x$95$m / y$95$m), $MachinePrecision] * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+228], N[(N[(N[(x$95$m * x$95$m), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(z$95$m / t$95$m), $MachinePrecision] + N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision] * N[(z$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{z\_m \cdot z\_m}{t\_m \cdot t\_m}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-315}:\\
\;\;\;\;\frac{x\_m}{y\_m} \cdot \frac{x\_m}{y\_m}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+228}:\\
\;\;\;\;\frac{x\_m \cdot x\_m}{y\_m \cdot y\_m} + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z\_m}{t\_m} + \frac{x\_m}{y\_m}\right) \cdot \frac{z\_m}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 2.0000000019e-315Initial program 70.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6474.6
Applied rewrites74.6%
lift-+.f64N/A
lift-*.f64N/A
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
lift-*.f64N/A
frac-addN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
Applied rewrites86.4%
Taylor expanded in x around inf
unpow2N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6495.2
Applied rewrites95.2%
if 2.0000000019e-315 < (/.f64 (*.f64 z z) (*.f64 t t)) < 1.9999999999999998e228Initial program 92.7%
if 1.9999999999999998e228 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 55.8%
Applied rewrites81.5%
Taylor expanded in x around 0
lower-/.f6485.9
Applied rewrites85.9%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) z_m = (fabs.f64 z) t_m = (fabs.f64 t) (FPCore (x_m y_m z_m t_m) :precision binary64 (if (<= (/ (* z_m z_m) (* t_m t_m)) 5e-285) (* (/ x_m y_m) (/ x_m y_m)) (* (+ (/ z_m t_m) (/ x_m y_m)) (/ z_m t_m))))
x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = (x_m / y_m) * (x_m / y_m);
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (((z_m * z_m) / (t_m * t_m)) <= 5d-285) then
tmp = (x_m / y_m) * (x_m / y_m)
else
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m)
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = (x_m / y_m) * (x_m / y_m);
} else {
tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): tmp = 0 if ((z_m * z_m) / (t_m * t_m)) <= 5e-285: tmp = (x_m / y_m) * (x_m / y_m) else: tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m) return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) tmp = 0.0 if (Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) <= 5e-285) tmp = Float64(Float64(x_m / y_m) * Float64(x_m / y_m)); else tmp = Float64(Float64(Float64(z_m / t_m) + Float64(x_m / y_m)) * Float64(z_m / t_m)); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) tmp = 0.0; if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) tmp = (x_m / y_m) * (x_m / y_m); else tmp = ((z_m / t_m) + (x_m / y_m)) * (z_m / t_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision], 5e-285], N[(N[(x$95$m / y$95$m), $MachinePrecision] * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z$95$m / t$95$m), $MachinePrecision] + N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision] * N[(z$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t\_m \cdot t\_m} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{x\_m}{y\_m} \cdot \frac{x\_m}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z\_m}{t\_m} + \frac{x\_m}{y\_m}\right) \cdot \frac{z\_m}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 5.00000000000000018e-285Initial program 70.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6474.9
Applied rewrites74.9%
lift-+.f64N/A
lift-*.f64N/A
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
lift-*.f64N/A
frac-addN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
Applied rewrites86.5%
Taylor expanded in x around inf
unpow2N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
if 5.00000000000000018e-285 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 65.5%
Applied rewrites77.0%
Taylor expanded in x around 0
lower-/.f6481.9
Applied rewrites81.9%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) z_m = (fabs.f64 z) t_m = (fabs.f64 t) (FPCore (x_m y_m z_m t_m) :precision binary64 (if (<= (/ (* z_m z_m) (* t_m t_m)) 5e-285) (* (/ x_m y_m) (/ x_m y_m)) (* (/ z_m t_m) (/ z_m t_m))))
x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = (x_m / y_m) * (x_m / y_m);
} else {
tmp = (z_m / t_m) * (z_m / t_m);
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (((z_m * z_m) / (t_m * t_m)) <= 5d-285) then
tmp = (x_m / y_m) * (x_m / y_m)
else
tmp = (z_m / t_m) * (z_m / t_m)
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = (x_m / y_m) * (x_m / y_m);
} else {
tmp = (z_m / t_m) * (z_m / t_m);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): tmp = 0 if ((z_m * z_m) / (t_m * t_m)) <= 5e-285: tmp = (x_m / y_m) * (x_m / y_m) else: tmp = (z_m / t_m) * (z_m / t_m) return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) tmp = 0.0 if (Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) <= 5e-285) tmp = Float64(Float64(x_m / y_m) * Float64(x_m / y_m)); else tmp = Float64(Float64(z_m / t_m) * Float64(z_m / t_m)); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) tmp = 0.0; if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) tmp = (x_m / y_m) * (x_m / y_m); else tmp = (z_m / t_m) * (z_m / t_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision], 5e-285], N[(N[(x$95$m / y$95$m), $MachinePrecision] * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(z$95$m / t$95$m), $MachinePrecision] * N[(z$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t\_m \cdot t\_m} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{x\_m}{y\_m} \cdot \frac{x\_m}{y\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m}{t\_m} \cdot \frac{z\_m}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 5.00000000000000018e-285Initial program 70.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6474.9
Applied rewrites74.9%
lift-+.f64N/A
lift-*.f64N/A
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
lift-*.f64N/A
frac-addN/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
+-commutativeN/A
lift-fma.f64N/A
Applied rewrites86.5%
Taylor expanded in x around inf
unpow2N/A
unpow2N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6495.3
Applied rewrites95.3%
if 5.00000000000000018e-285 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 65.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6484.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
+-commutativeN/A
*-commutativeN/A
associate-/l/N/A
Applied rewrites81.5%
Final simplification86.5%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) z_m = (fabs.f64 z) t_m = (fabs.f64 t) (FPCore (x_m y_m z_m t_m) :precision binary64 (if (<= (/ (* z_m z_m) (* t_m t_m)) 5e-285) (* (/ (/ x_m y_m) y_m) x_m) (* (/ z_m t_m) (/ z_m t_m))))
x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = ((x_m / y_m) / y_m) * x_m;
} else {
tmp = (z_m / t_m) * (z_m / t_m);
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (((z_m * z_m) / (t_m * t_m)) <= 5d-285) then
tmp = ((x_m / y_m) / y_m) * x_m
else
tmp = (z_m / t_m) * (z_m / t_m)
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = ((x_m / y_m) / y_m) * x_m;
} else {
tmp = (z_m / t_m) * (z_m / t_m);
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): tmp = 0 if ((z_m * z_m) / (t_m * t_m)) <= 5e-285: tmp = ((x_m / y_m) / y_m) * x_m else: tmp = (z_m / t_m) * (z_m / t_m) return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) tmp = 0.0 if (Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) <= 5e-285) tmp = Float64(Float64(Float64(x_m / y_m) / y_m) * x_m); else tmp = Float64(Float64(z_m / t_m) * Float64(z_m / t_m)); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) tmp = 0.0; if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) tmp = ((x_m / y_m) / y_m) * x_m; else tmp = (z_m / t_m) * (z_m / t_m); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision], 5e-285], N[(N[(N[(x$95$m / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x$95$m), $MachinePrecision], N[(N[(z$95$m / t$95$m), $MachinePrecision] * N[(z$95$m / t$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t\_m \cdot t\_m} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{\frac{x\_m}{y\_m}}{y\_m} \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{z\_m}{t\_m} \cdot \frac{z\_m}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 5.00000000000000018e-285Initial program 70.6%
Taylor expanded in x around inf
unpow2N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.4
Applied rewrites87.4%
if 5.00000000000000018e-285 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 65.5%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f64N/A
lift-*.f64N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6482.1
Applied rewrites82.1%
lift-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6484.4
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.4
Applied rewrites84.4%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
+-commutativeN/A
*-commutativeN/A
associate-/l/N/A
Applied rewrites81.5%
Final simplification83.7%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) z_m = (fabs.f64 z) t_m = (fabs.f64 t) (FPCore (x_m y_m z_m t_m) :precision binary64 (if (<= (/ (* z_m z_m) (* t_m t_m)) 5e-285) (* (/ (/ x_m y_m) y_m) x_m) (* (/ (/ z_m t_m) t_m) z_m)))
x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = ((x_m / y_m) / y_m) * x_m;
} else {
tmp = ((z_m / t_m) / t_m) * z_m;
}
return tmp;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
real(8) :: tmp
if (((z_m * z_m) / (t_m * t_m)) <= 5d-285) then
tmp = ((x_m / y_m) / y_m) * x_m
else
tmp = ((z_m / t_m) / t_m) * z_m
end if
code = tmp
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
double tmp;
if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) {
tmp = ((x_m / y_m) / y_m) * x_m;
} else {
tmp = ((z_m / t_m) / t_m) * z_m;
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): tmp = 0 if ((z_m * z_m) / (t_m * t_m)) <= 5e-285: tmp = ((x_m / y_m) / y_m) * x_m else: tmp = ((z_m / t_m) / t_m) * z_m return tmp
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) tmp = 0.0 if (Float64(Float64(z_m * z_m) / Float64(t_m * t_m)) <= 5e-285) tmp = Float64(Float64(Float64(x_m / y_m) / y_m) * x_m); else tmp = Float64(Float64(Float64(z_m / t_m) / t_m) * z_m); end return tmp end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp_2 = code(x_m, y_m, z_m, t_m) tmp = 0.0; if (((z_m * z_m) / (t_m * t_m)) <= 5e-285) tmp = ((x_m / y_m) / y_m) * x_m; else tmp = ((z_m / t_m) / t_m) * z_m; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := If[LessEqual[N[(N[(z$95$m * z$95$m), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision], 5e-285], N[(N[(N[(x$95$m / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x$95$m), $MachinePrecision], N[(N[(N[(z$95$m / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z$95$m), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z\_m \cdot z\_m}{t\_m \cdot t\_m} \leq 5 \cdot 10^{-285}:\\
\;\;\;\;\frac{\frac{x\_m}{y\_m}}{y\_m} \cdot x\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z\_m}{t\_m}}{t\_m} \cdot z\_m\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 5.00000000000000018e-285Initial program 70.6%
Taylor expanded in x around inf
unpow2N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6487.4
Applied rewrites87.4%
if 5.00000000000000018e-285 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 65.5%
Taylor expanded in x around 0
unpow2N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6478.7
Applied rewrites78.7%
Final simplification81.9%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) z_m = (fabs.f64 z) t_m = (fabs.f64 t) (FPCore (x_m y_m z_m t_m) :precision binary64 (* (/ (/ x_m y_m) y_m) x_m))
x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
return ((x_m / y_m) / y_m) * x_m;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
code = ((x_m / y_m) / y_m) * x_m
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
return ((x_m / y_m) / y_m) * x_m;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): return ((x_m / y_m) / y_m) * x_m
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) return Float64(Float64(Float64(x_m / y_m) / y_m) * x_m) end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp = code(x_m, y_m, z_m, t_m) tmp = ((x_m / y_m) / y_m) * x_m; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := N[(N[(N[(x$95$m / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\frac{\frac{x\_m}{y\_m}}{y\_m} \cdot x\_m
\end{array}
Initial program 67.4%
Taylor expanded in x around inf
unpow2N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6449.2
Applied rewrites49.2%
Final simplification49.2%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) z_m = (fabs.f64 z) t_m = (fabs.f64 t) (FPCore (x_m y_m z_m t_m) :precision binary64 (* (/ x_m (* y_m y_m)) x_m))
x_m = fabs(x);
y_m = fabs(y);
z_m = fabs(z);
t_m = fabs(t);
double code(double x_m, double y_m, double z_m, double t_m) {
return (x_m / (y_m * y_m)) * x_m;
}
x_m = private
y_m = private
z_m = private
t_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x_m, y_m, z_m, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8), intent (in) :: z_m
real(8), intent (in) :: t_m
code = (x_m / (y_m * y_m)) * x_m
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
z_m = Math.abs(z);
t_m = Math.abs(t);
public static double code(double x_m, double y_m, double z_m, double t_m) {
return (x_m / (y_m * y_m)) * x_m;
}
x_m = math.fabs(x) y_m = math.fabs(y) z_m = math.fabs(z) t_m = math.fabs(t) def code(x_m, y_m, z_m, t_m): return (x_m / (y_m * y_m)) * x_m
x_m = abs(x) y_m = abs(y) z_m = abs(z) t_m = abs(t) function code(x_m, y_m, z_m, t_m) return Float64(Float64(x_m / Float64(y_m * y_m)) * x_m) end
x_m = abs(x); y_m = abs(y); z_m = abs(z); t_m = abs(t); function tmp = code(x_m, y_m, z_m, t_m) tmp = (x_m / (y_m * y_m)) * x_m; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] z_m = N[Abs[z], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x$95$m_, y$95$m_, z$95$m_, t$95$m_] := N[(N[(x$95$m / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * x$95$m), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
z_m = \left|z\right|
\\
t_m = \left|t\right|
\\
\frac{x\_m}{y\_m \cdot y\_m} \cdot x\_m
\end{array}
Initial program 67.4%
Taylor expanded in x around inf
unpow2N/A
associate-*l/N/A
lower-*.f64N/A
unpow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6449.2
Applied rewrites49.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lift-*.f64N/A
lower-/.f6444.6
Applied rewrites44.6%
Final simplification44.6%
(FPCore (x y z t) :precision binary64 (+ (pow (/ x y) 2.0) (pow (/ z t) 2.0)))
double code(double x, double y, double z, double t) {
return pow((x / y), 2.0) + pow((z / t), 2.0);
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(x, y, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x / y) ** 2.0d0) + ((z / t) ** 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return Math.pow((x / y), 2.0) + Math.pow((z / t), 2.0);
}
def code(x, y, z, t): return math.pow((x / y), 2.0) + math.pow((z / t), 2.0)
function code(x, y, z, t) return Float64((Float64(x / y) ^ 2.0) + (Float64(z / t) ^ 2.0)) end
function tmp = code(x, y, z, t) tmp = ((x / y) ^ 2.0) + ((z / t) ^ 2.0); end
code[x_, y_, z_, t_] := N[(N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(z / t), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\frac{x}{y}\right)}^{2} + {\left(\frac{z}{t}\right)}^{2}
\end{array}
herbie shell --seed 2025026
(FPCore (x y z t)
:name "Graphics.Rasterific.Svg.PathConverter:arcToSegments from rasterific-svg-0.2.3.1"
:precision binary64
:alt
(! :herbie-platform default (+ (pow (/ x y) 2) (pow (/ z t) 2)))
(+ (/ (* x x) (* y y)) (/ (* z z) (* t t))))