
(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}
Herbie found 14 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}
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= t_m 5e-239) (+ (* (- x) (* (/ x y) (/ -1.0 y))) (* (/ z t_m) (/ z t_m))) (fma (/ (/ z t_m) t_m) z (pow (/ x y) 2.0))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 5e-239) {
tmp = (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
} else {
tmp = fma(((z / t_m) / t_m), z, pow((x / y), 2.0));
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (t_m <= 5e-239) tmp = Float64(Float64(Float64(-x) * Float64(Float64(x / y) * Float64(-1.0 / y))) + Float64(Float64(z / t_m) * Float64(z / t_m))); else tmp = fma(Float64(Float64(z / t_m) / t_m), z, (Float64(x / y) ^ 2.0)); end return tmp end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 5e-239], N[(N[((-x) * N[(N[(x / y), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t$95$m), $MachinePrecision] * N[(z / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z + N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 5 \cdot 10^{-239}:\\
\;\;\;\;\left(-x\right) \cdot \left(\frac{x}{y} \cdot \frac{-1}{y}\right) + \frac{z}{t\_m} \cdot \frac{z}{t\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{z}{t\_m}}{t\_m}, z, {\left(\frac{x}{y}\right)}^{2}\right)\\
\end{array}
\end{array}
if t < 5e-239Initial program 61.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqr-neg-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
pow2N/A
lift-*.f6471.1
Applied rewrites71.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f6497.1
Applied rewrites97.1%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mul-1-negN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f6498.7
Applied rewrites98.7%
if 5e-239 < t Initial program 66.9%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))) (t_2 (/ (* (/ z t_m) z) t_m)))
(if (<= t_1 0.0)
t_2
(if (<= t_1 INFINITY) (+ t_1 (* z (/ z (* t_m t_m)))) t_2))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double t_2 = ((z / t_m) * z) / t_m;
double tmp;
if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + (z * (z / (t_m * t_m)));
} else {
tmp = t_2;
}
return tmp;
}
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double t_2 = ((z / t_m) * z) / t_m;
double tmp;
if (t_1 <= 0.0) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 + (z * (z / (t_m * t_m)));
} else {
tmp = t_2;
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * x) / (y * y) t_2 = ((z / t_m) * z) / t_m tmp = 0 if t_1 <= 0.0: tmp = t_2 elif t_1 <= math.inf: tmp = t_1 + (z * (z / (t_m * t_m))) else: tmp = t_2 return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * x) / Float64(y * y)) t_2 = Float64(Float64(Float64(z / t_m) * z) / t_m) tmp = 0.0 if (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(t_1 + Float64(z * Float64(z / Float64(t_m * t_m)))); else tmp = t_2; end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * x) / (y * y); t_2 = ((z / t_m) * z) / t_m; tmp = 0.0; if (t_1 <= 0.0) tmp = t_2; elseif (t_1 <= Inf) tmp = t_1 + (z * (z / (t_m * t_m))); else tmp = t_2; end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], t$95$2, If[LessEqual[t$95$1, Infinity], N[(t$95$1 + N[(z * N[(z / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
t_2 := \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + z \cdot \frac{z}{t\_m \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 0.0 or +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 52.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites73.5%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6423.4
Applied rewrites23.4%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites23.9%
Taylor expanded in x around 0
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6478.3
Applied rewrites78.3%
if 0.0 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 78.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6490.1
Applied rewrites90.1%
lift-/.f64N/A
lift-*.f64N/A
associate-*r/N/A
lift-/.f64N/A
frac-timesN/A
unpow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))) (t_2 (/ (* (/ z t_m) z) t_m)))
(if (<= t_1 1e+264)
t_2
(if (<= t_1 INFINITY) (/ (* (* (/ x y) x) t_m) (* t_m y)) t_2))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double t_2 = ((z / t_m) * z) / t_m;
double tmp;
if (t_1 <= 1e+264) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (((x / y) * x) * t_m) / (t_m * y);
} else {
tmp = t_2;
}
return tmp;
}
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double t_2 = ((z / t_m) * z) / t_m;
double tmp;
if (t_1 <= 1e+264) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (((x / y) * x) * t_m) / (t_m * y);
} else {
tmp = t_2;
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * x) / (y * y) t_2 = ((z / t_m) * z) / t_m tmp = 0 if t_1 <= 1e+264: tmp = t_2 elif t_1 <= math.inf: tmp = (((x / y) * x) * t_m) / (t_m * y) else: tmp = t_2 return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * x) / Float64(y * y)) t_2 = Float64(Float64(Float64(z / t_m) * z) / t_m) tmp = 0.0 if (t_1 <= 1e+264) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(Float64(Float64(Float64(x / y) * x) * t_m) / Float64(t_m * y)); else tmp = t_2; end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * x) / (y * y); t_2 = ((z / t_m) * z) / t_m; tmp = 0.0; if (t_1 <= 1e+264) tmp = t_2; elseif (t_1 <= Inf) tmp = (((x / y) * x) * t_m) / (t_m * y); else tmp = t_2; end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+264], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(t$95$m * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
t_2 := \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\mathbf{if}\;t\_1 \leq 10^{+264}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\left(\frac{x}{y} \cdot x\right) \cdot t\_m}{t\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 1.00000000000000004e264 or +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 60.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites75.9%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6427.2
Applied rewrites27.2%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites27.2%
Taylor expanded in x around 0
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6470.3
Applied rewrites70.3%
if 1.00000000000000004e264 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 77.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites90.7%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6485.0
Applied rewrites85.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6487.8
Applied rewrites87.8%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))) (t_2 (/ (* (/ z t_m) z) t_m)))
(if (<= t_1 1e+264)
t_2
(if (<= t_1 INFINITY) (/ (* x (/ (* x t_m) y)) (* t_m y)) t_2))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double t_2 = ((z / t_m) * z) / t_m;
double tmp;
if (t_1 <= 1e+264) {
tmp = t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = (x * ((x * t_m) / y)) / (t_m * y);
} else {
tmp = t_2;
}
return tmp;
}
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double t_2 = ((z / t_m) * z) / t_m;
double tmp;
if (t_1 <= 1e+264) {
tmp = t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = (x * ((x * t_m) / y)) / (t_m * y);
} else {
tmp = t_2;
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * x) / (y * y) t_2 = ((z / t_m) * z) / t_m tmp = 0 if t_1 <= 1e+264: tmp = t_2 elif t_1 <= math.inf: tmp = (x * ((x * t_m) / y)) / (t_m * y) else: tmp = t_2 return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * x) / Float64(y * y)) t_2 = Float64(Float64(Float64(z / t_m) * z) / t_m) tmp = 0.0 if (t_1 <= 1e+264) tmp = t_2; elseif (t_1 <= Inf) tmp = Float64(Float64(x * Float64(Float64(x * t_m) / y)) / Float64(t_m * y)); else tmp = t_2; end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * x) / (y * y); t_2 = ((z / t_m) * z) / t_m; tmp = 0.0; if (t_1 <= 1e+264) tmp = t_2; elseif (t_1 <= Inf) tmp = (x * ((x * t_m) / y)) / (t_m * y); else tmp = t_2; end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+264], t$95$2, If[LessEqual[t$95$1, Infinity], N[(N[(x * N[(N[(x * t$95$m), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision] / N[(t$95$m * y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
t_2 := \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\mathbf{if}\;t\_1 \leq 10^{+264}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{x \cdot \frac{x \cdot t\_m}{y}}{t\_m \cdot y}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 1.00000000000000004e264 or +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 60.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites75.9%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6427.2
Applied rewrites27.2%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites27.2%
Taylor expanded in x around 0
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6470.3
Applied rewrites70.3%
if 1.00000000000000004e264 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 77.5%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites90.7%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6485.0
Applied rewrites85.0%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-*.f6485.0
Applied rewrites85.0%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* z z) (* t_m t_m))))
(if (<= t_1 5e+165)
(+ (* (/ x y) (/ x y)) t_1)
(+ (* (- x) (/ (- x) (* y y))) (* (/ z t_m) (/ z t_m))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (z * z) / (t_m * t_m);
double tmp;
if (t_1 <= 5e+165) {
tmp = ((x / y) * (x / y)) + t_1;
} else {
tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m));
}
return tmp;
}
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, y, z, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (z * z) / (t_m * t_m)
if (t_1 <= 5d+165) then
tmp = ((x / y) * (x / y)) + t_1
else
tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (z * z) / (t_m * t_m);
double tmp;
if (t_1 <= 5e+165) {
tmp = ((x / y) * (x / y)) + t_1;
} else {
tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (z * z) / (t_m * t_m) tmp = 0 if t_1 <= 5e+165: tmp = ((x / y) * (x / y)) + t_1 else: tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m)) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(z * z) / Float64(t_m * t_m)) tmp = 0.0 if (t_1 <= 5e+165) tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1); else tmp = Float64(Float64(Float64(-x) * Float64(Float64(-x) / Float64(y * y))) + Float64(Float64(z / t_m) * Float64(z / t_m))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (z * z) / (t_m * t_m); tmp = 0.0; if (t_1 <= 5e+165) tmp = ((x / y) * (x / y)) + t_1; else tmp = (-x * (-x / (y * y))) + ((z / t_m) * (z / t_m)); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+165], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[((-x) * N[((-x) / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t$95$m), $MachinePrecision] * N[(z / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t\_m \cdot t\_m}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+165}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(-x\right) \cdot \frac{-x}{y \cdot y} + \frac{z}{t\_m} \cdot \frac{z}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 4.9999999999999997e165Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6495.0
Applied rewrites95.0%
if 4.9999999999999997e165 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 59.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqr-neg-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
pow2N/A
lift-*.f6467.1
Applied rewrites67.1%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f6495.7
Applied rewrites95.7%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= (/ (* z z) (* t_m t_m)) INFINITY) (fma (- z) (/ (- z) (* t_m t_m)) (/ (* (/ x y) x) y)) (+ (* (/ x (* y y)) x) (/ (* (/ z t_m) z) t_m))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (((z * z) / (t_m * t_m)) <= ((double) INFINITY)) {
tmp = fma(-z, (-z / (t_m * t_m)), (((x / y) * x) / y));
} else {
tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (Float64(Float64(z * z) / Float64(t_m * t_m)) <= Inf) tmp = fma(Float64(-z), Float64(Float64(-z) / Float64(t_m * t_m)), Float64(Float64(Float64(x / y) * x) / y)); else tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(Float64(z / t_m) * z) / t_m)); end return tmp end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision], Infinity], N[((-z) * N[((-z) / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{z \cdot z}{t\_m \cdot t\_m} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{-z}{t\_m \cdot t\_m}, \frac{\frac{x}{y} \cdot x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < +inf.0Initial program 75.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
sqr-neg-revN/A
pow2N/A
associate-/l*N/A
pow2N/A
pow2N/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l/N/A
associate-*r/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6493.1
Applied rewrites93.1%
if +inf.0 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f640.0
Applied rewrites0.0%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6482.7
Applied rewrites82.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6475.8
Applied rewrites75.8%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* z z) (* t_m t_m))))
(if (<= t_1 5e+165)
(+ (* (/ x y) (/ x y)) t_1)
(+ (* (/ x (* y y)) x) (/ (* (/ z t_m) z) t_m)))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (z * z) / (t_m * t_m);
double tmp;
if (t_1 <= 5e+165) {
tmp = ((x / y) * (x / y)) + t_1;
} else {
tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
}
return tmp;
}
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, y, z, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (z * z) / (t_m * t_m)
if (t_1 <= 5d+165) then
tmp = ((x / y) * (x / y)) + t_1
else
tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m)
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (z * z) / (t_m * t_m);
double tmp;
if (t_1 <= 5e+165) {
tmp = ((x / y) * (x / y)) + t_1;
} else {
tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (z * z) / (t_m * t_m) tmp = 0 if t_1 <= 5e+165: tmp = ((x / y) * (x / y)) + t_1 else: tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(z * z) / Float64(t_m * t_m)) tmp = 0.0 if (t_1 <= 5e+165) tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + t_1); else tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(Float64(z / t_m) * z) / t_m)); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (z * z) / (t_m * t_m); tmp = 0.0; if (t_1 <= 5e+165) tmp = ((x / y) * (x / y)) + t_1; else tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+165], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{z \cdot z}{t\_m \cdot t\_m}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+165}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 z z) (*.f64 t t)) < 4.9999999999999997e165Initial program 73.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6495.0
Applied rewrites95.0%
if 4.9999999999999997e165 < (/.f64 (*.f64 z z) (*.f64 t t)) Initial program 59.2%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6467.5
Applied rewrites67.5%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6493.4
Applied rewrites93.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6490.9
Applied rewrites90.9%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))))
(if (<= t_1 INFINITY)
(fma (/ (/ z t_m) t_m) z t_1)
(+ (* (/ x y) (/ x y)) (/ (* z z) (* t_m t_m))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = fma(((z / t_m) / t_m), z, t_1);
} else {
tmp = ((x / y) * (x / y)) + ((z * z) / (t_m * t_m));
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * x) / Float64(y * y)) tmp = 0.0 if (t_1 <= Inf) tmp = fma(Float64(Float64(z / t_m) / t_m), z, t_1); else tmp = Float64(Float64(Float64(x / y) * Float64(x / y)) + Float64(Float64(z * z) / Float64(t_m * t_m))); end return tmp end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(N[(N[(z / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z + t$95$1), $MachinePrecision], N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{z}{t\_m}}{t\_m}, z, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} \cdot \frac{x}{y} + \frac{z \cdot z}{t\_m \cdot t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 75.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f6489.6
Applied rewrites89.6%
if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 0.0%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6480.9
Applied rewrites80.9%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (/ (* x x) (* y y))))
(if (<= t_1 INFINITY)
(fma (/ (/ z t_m) t_m) z t_1)
(/ (* (/ z t_m) z) t_m))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * x) / (y * y);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = fma(((z / t_m) / t_m), z, t_1);
} else {
tmp = ((z / t_m) * z) / t_m;
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * x) / Float64(y * y)) tmp = 0.0 if (t_1 <= Inf) tmp = fma(Float64(Float64(z / t_m) / t_m), z, t_1); else tmp = Float64(Float64(Float64(z / t_m) * z) / t_m); end return tmp end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(N[(N[(z / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z + t$95$1), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y \cdot y}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{z}{t\_m}}{t\_m}, z, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 75.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f6489.6
Applied rewrites89.6%
if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 0.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites61.0%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6417.7
Applied rewrites17.7%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites19.2%
Taylor expanded in x around 0
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6450.2
Applied rewrites50.2%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(if (<= (* y y) 5e-297)
(/ (* (* (/ x y) x) t_m) (* t_m y))
(if (<= (* y y) 2e+232)
(+ (* (/ x (* y y)) x) (/ (* z z) (* t_m t_m)))
(/ (* (/ z t_m) z) t_m))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if ((y * y) <= 5e-297) {
tmp = (((x / y) * x) * t_m) / (t_m * y);
} else if ((y * y) <= 2e+232) {
tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m));
} else {
tmp = ((z / t_m) * z) / t_m;
}
return tmp;
}
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, y, z, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: tmp
if ((y * y) <= 5d-297) then
tmp = (((x / y) * x) * t_m) / (t_m * y)
else if ((y * y) <= 2d+232) then
tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m))
else
tmp = ((z / t_m) * z) / t_m
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double tmp;
if ((y * y) <= 5e-297) {
tmp = (((x / y) * x) * t_m) / (t_m * y);
} else if ((y * y) <= 2e+232) {
tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m));
} else {
tmp = ((z / t_m) * z) / t_m;
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): tmp = 0 if (y * y) <= 5e-297: tmp = (((x / y) * x) * t_m) / (t_m * y) elif (y * y) <= 2e+232: tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m)) else: tmp = ((z / t_m) * z) / t_m return tmp
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (Float64(y * y) <= 5e-297) tmp = Float64(Float64(Float64(Float64(x / y) * x) * t_m) / Float64(t_m * y)); elseif (Float64(y * y) <= 2e+232) tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(z * z) / Float64(t_m * t_m))); else tmp = Float64(Float64(Float64(z / t_m) * z) / t_m); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) tmp = 0.0; if ((y * y) <= 5e-297) tmp = (((x / y) * x) * t_m) / (t_m * y); elseif ((y * y) <= 2e+232) tmp = ((x / (y * y)) * x) + ((z * z) / (t_m * t_m)); else tmp = ((z / t_m) * z) / t_m; end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[N[(y * y), $MachinePrecision], 5e-297], N[(N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] * t$95$m), $MachinePrecision] / N[(t$95$m * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * y), $MachinePrecision], 2e+232], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t$95$m * t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;y \cdot y \leq 5 \cdot 10^{-297}:\\
\;\;\;\;\frac{\left(\frac{x}{y} \cdot x\right) \cdot t\_m}{t\_m \cdot y}\\
\mathbf{elif}\;y \cdot y \leq 2 \cdot 10^{+232}:\\
\;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{z \cdot z}{t\_m \cdot t\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\end{array}
\end{array}
if (*.f64 y y) < 5e-297Initial program 61.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites91.2%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6468.1
Applied rewrites68.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6481.4
Applied rewrites81.4%
if 5e-297 < (*.f64 y y) < 2.00000000000000011e232Initial program 76.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6480.8
Applied rewrites80.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
unpow2N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6480.8
Applied rewrites80.8%
if 2.00000000000000011e232 < (*.f64 y y) Initial program 56.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites67.5%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6428.5
Applied rewrites28.5%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites29.3%
Taylor expanded in x around 0
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6476.8
Applied rewrites76.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (+ (* (- x) (* (/ x y) (/ -1.0 y))) (* (/ z t_m) (/ z t_m))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
}
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, y, z, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = (-x * ((x / y) * ((-1.0d0) / y))) + ((z / t_m) * (z / t_m))
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m));
}
t_m = math.fabs(t) def code(x, y, z, t_m): return (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m))
t_m = abs(t) function code(x, y, z, t_m) return Float64(Float64(Float64(-x) * Float64(Float64(x / y) * Float64(-1.0 / y))) + Float64(Float64(z / t_m) * Float64(z / t_m))) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = (-x * ((x / y) * (-1.0 / y))) + ((z / t_m) * (z / t_m)); end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[((-x) * N[(N[(x / y), $MachinePrecision] * N[(-1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(z / t$95$m), $MachinePrecision] * N[(z / t$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\left(-x\right) \cdot \left(\frac{x}{y} \cdot \frac{-1}{y}\right) + \frac{z}{t\_m} \cdot \frac{z}{t\_m}
\end{array}
Initial program 66.3%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
sqr-neg-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
pow2N/A
lift-*.f6473.5
Applied rewrites73.5%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-timesN/A
lift-/.f64N/A
lift-/.f64N/A
lift-*.f6489.9
Applied rewrites89.9%
lift-neg.f64N/A
lift-*.f64N/A
lift-/.f64N/A
mul-1-negN/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lift-/.f64N/A
lower-/.f6496.8
Applied rewrites96.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= t_m 4e-227) (+ (* (/ (/ x y) y) x) (/ (* (/ z t_m) z) t_m)) (fma (/ (/ z t_m) t_m) z (/ (* (/ x y) x) y))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 4e-227) {
tmp = (((x / y) / y) * x) + (((z / t_m) * z) / t_m);
} else {
tmp = fma(((z / t_m) / t_m), z, (((x / y) * x) / y));
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (t_m <= 4e-227) tmp = Float64(Float64(Float64(Float64(x / y) / y) * x) + Float64(Float64(Float64(z / t_m) * z) / t_m)); else tmp = fma(Float64(Float64(z / t_m) / t_m), z, Float64(Float64(Float64(x / y) * x) / y)); end return tmp end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 4e-227], N[(N[(N[(N[(x / y), $MachinePrecision] / y), $MachinePrecision] * x), $MachinePrecision] + N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z + N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 4 \cdot 10^{-227}:\\
\;\;\;\;\frac{\frac{x}{y}}{y} \cdot x + \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{z}{t\_m}}{t\_m}, z, \frac{\frac{x}{y} \cdot x}{y}\right)\\
\end{array}
\end{array}
if t < 3.99999999999999978e-227Initial program 61.7%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6470.8
Applied rewrites70.8%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
if 3.99999999999999978e-227 < t Initial program 67.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l/N/A
associate-*r/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6494.8
Applied rewrites94.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= t_m 3.8e-225) (+ (* (/ x (* y y)) x) (/ (* (/ z t_m) z) t_m)) (fma (/ (/ z t_m) t_m) z (/ (* (/ x y) x) y))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 3.8e-225) {
tmp = ((x / (y * y)) * x) + (((z / t_m) * z) / t_m);
} else {
tmp = fma(((z / t_m) / t_m), z, (((x / y) * x) / y));
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (t_m <= 3.8e-225) tmp = Float64(Float64(Float64(x / Float64(y * y)) * x) + Float64(Float64(Float64(z / t_m) * z) / t_m)); else tmp = fma(Float64(Float64(z / t_m) / t_m), z, Float64(Float64(Float64(x / y) * x) / y)); end return tmp end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 3.8e-225], N[(N[(N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] + N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t$95$m), $MachinePrecision] / t$95$m), $MachinePrecision] * z + N[(N[(N[(x / y), $MachinePrecision] * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 3.8 \cdot 10^{-225}:\\
\;\;\;\;\frac{x}{y \cdot y} \cdot x + \frac{\frac{z}{t\_m} \cdot z}{t\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{z}{t\_m}}{t\_m}, z, \frac{\frac{x}{y} \cdot x}{y}\right)\\
\end{array}
\end{array}
if t < 3.8000000000000003e-225Initial program 61.8%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6471.0
Applied rewrites71.0%
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
pow2N/A
pow2N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lower-/.f6497.9
Applied rewrites97.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6496.4
Applied rewrites96.4%
if 3.8000000000000003e-225 < t Initial program 67.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/l*N/A
*-commutativeN/A
pow2N/A
pow2N/A
lower-fma.f64N/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6498.2
Applied rewrites98.2%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
associate-*l/N/A
associate-*r/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6494.8
Applied rewrites94.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (/ (* (/ z t_m) z) t_m))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return ((z / t_m) * z) / t_m;
}
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, y, z, t_m)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = ((z / t_m) * z) / t_m
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return ((z / t_m) * z) / t_m;
}
t_m = math.fabs(t) def code(x, y, z, t_m): return ((z / t_m) * z) / t_m
t_m = abs(t) function code(x, y, z, t_m) return Float64(Float64(Float64(z / t_m) * z) / t_m) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = ((z / t_m) * z) / t_m; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[(N[(z / t$95$m), $MachinePrecision] * z), $MachinePrecision] / t$95$m), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\frac{\frac{z}{t\_m} \cdot z}{t\_m}
\end{array}
Initial program 66.3%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
+-commutativeN/A
pow2N/A
associate-/r*N/A
pow2N/A
associate-/r*N/A
frac-addN/A
lower-/.f64N/A
Applied rewrites81.2%
Taylor expanded in x around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow2N/A
lift-*.f6447.8
Applied rewrites47.8%
lift-*.f64N/A
lift-/.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
Applied rewrites47.3%
Taylor expanded in x around 0
pow2N/A
associate-*l/N/A
lift-/.f64N/A
lift-*.f6456.8
Applied rewrites56.8%
(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 2025093
(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))))