
(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 13 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}
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 1.15e-183) (fma (- z) (/ (- z) (* t t)) (pow (/ x y_m) 2.0)) (fma (/ (/ x y_m) y_m) x (* (/ z t) (* (/ 1.0 t) z)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 1.15e-183) {
tmp = fma(-z, (-z / (t * t)), pow((x / y_m), 2.0));
} else {
tmp = fma(((x / y_m) / y_m), x, ((z / t) * ((1.0 / t) * z)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 1.15e-183) tmp = fma(Float64(-z), Float64(Float64(-z) / Float64(t * t)), (Float64(x / y_m) ^ 2.0)); else tmp = fma(Float64(Float64(x / y_m) / y_m), x, Float64(Float64(z / t) * Float64(Float64(1.0 / t) * z))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 1.15e-183], N[((-z) * N[((-z) / N[(t * t), $MachinePrecision]), $MachinePrecision] + N[Power[N[(x / y$95$m), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x + N[(N[(z / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 1.15 \cdot 10^{-183}:\\
\;\;\;\;\mathsf{fma}\left(-z, \frac{-z}{t \cdot t}, {\left(\frac{x}{y\_m}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{x}{y\_m}}{y\_m}, x, \frac{z}{t} \cdot \left(\frac{1}{t} \cdot z\right)\right)\\
\end{array}
\end{array}
if y < 1.15000000000000008e-183Initial program 58.5%
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.0
Applied rewrites96.0%
if 1.15000000000000008e-183 < y Initial program 67.7%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/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
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6494.5
Applied rewrites94.5%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
times-fracN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-inversesN/A
times-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-/.f6489.2
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.3%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y_m y_m))))
(if (<= t_1 1e-252)
(* (/ z t) (/ z t))
(if (<= t_1 INFINITY)
(fma (/ x (* y_m y_m)) x (* (fabs z) (/ (fabs z) (* t t))))
(fma (/ (/ x y_m) y_m) x (/ (* z z) (* t t)))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= 1e-252) {
tmp = (z / t) * (z / t);
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma((x / (y_m * y_m)), x, (fabs(z) * (fabs(z) / (t * t))));
} else {
tmp = fma(((x / y_m) / y_m), x, ((z * z) / (t * t)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(Float64(x * x) / Float64(y_m * y_m)) tmp = 0.0 if (t_1 <= 1e-252) tmp = Float64(Float64(z / t) * Float64(z / t)); elseif (t_1 <= Inf) tmp = fma(Float64(x / Float64(y_m * y_m)), x, Float64(abs(z) * Float64(abs(z) / Float64(t * t)))); else tmp = fma(Float64(Float64(x / y_m) / y_m), x, Float64(Float64(z * z) / Float64(t * t))); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-252], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * x + N[(N[Abs[z], $MachinePrecision] * N[(N[Abs[z], $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y\_m \cdot y\_m}\\
\mathbf{if}\;t\_1 \leq 10^{-252}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y\_m \cdot y\_m}, x, \left|z\right| \cdot \frac{\left|z\right|}{t \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{x}{y\_m}}{y\_m}, x, \frac{z \cdot z}{t \cdot t}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.99999999999999943e-253Initial program 69.6%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6491.8
Applied rewrites91.8%
if 9.99999999999999943e-253 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 79.3%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/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-/.f6497.9
Applied rewrites97.9%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
sqr-abs-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
pow2N/A
lift-*.f6493.4
Applied rewrites93.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lower-*.f6491.7
Applied rewrites91.7%
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
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-/.f6486.6
Applied rewrites86.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6471.2
Applied rewrites71.2%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y_m y_m))))
(if (<= t_1 1e-252)
(* (/ z t) (/ z t))
(if (<= t_1 INFINITY)
(fma (/ x (* y_m y_m)) x (* (fabs z) (/ (fabs z) (* t t))))
(/ (* (/ z t) z) t)))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= 1e-252) {
tmp = (z / t) * (z / t);
} else if (t_1 <= ((double) INFINITY)) {
tmp = fma((x / (y_m * y_m)), x, (fabs(z) * (fabs(z) / (t * t))));
} else {
tmp = ((z / t) * z) / t;
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(Float64(x * x) / Float64(y_m * y_m)) tmp = 0.0 if (t_1 <= 1e-252) tmp = Float64(Float64(z / t) * Float64(z / t)); elseif (t_1 <= Inf) tmp = fma(Float64(x / Float64(y_m * y_m)), x, Float64(abs(z) * Float64(abs(z) / Float64(t * t)))); else tmp = Float64(Float64(Float64(z / t) * z) / t); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-252], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * x + N[(N[Abs[z], $MachinePrecision] * N[(N[Abs[z], $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y\_m \cdot y\_m}\\
\mathbf{if}\;t\_1 \leq 10^{-252}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y\_m \cdot y\_m}, x, \left|z\right| \cdot \frac{\left|z\right|}{t \cdot t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z}{t} \cdot z}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.99999999999999943e-253Initial program 69.6%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6491.8
Applied rewrites91.8%
if 9.99999999999999943e-253 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 79.3%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/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-/.f6497.9
Applied rewrites97.9%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
sqr-abs-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
pow2N/A
lift-*.f6493.4
Applied rewrites93.4%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lower-*.f6491.7
Applied rewrites91.7%
if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 0.0%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6449.3
Applied rewrites49.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6447.2
Applied rewrites47.2%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y_m y_m))))
(if (<= t_1 1e-252)
(* (/ z t) (/ z t))
(if (<= t_1 INFINITY) (+ t_1 (* (/ z (* t t)) z)) (/ (* (/ z t) z) t)))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= 1e-252) {
tmp = (z / t) * (z / t);
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + ((z / (t * t)) * z);
} else {
tmp = ((z / t) * z) / t;
}
return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= 1e-252) {
tmp = (z / t) * (z / t);
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 + ((z / (t * t)) * z);
} else {
tmp = ((z / t) * z) / t;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = (x * x) / (y_m * y_m) tmp = 0 if t_1 <= 1e-252: tmp = (z / t) * (z / t) elif t_1 <= math.inf: tmp = t_1 + ((z / (t * t)) * z) else: tmp = ((z / t) * z) / t return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(Float64(x * x) / Float64(y_m * y_m)) tmp = 0.0 if (t_1 <= 1e-252) tmp = Float64(Float64(z / t) * Float64(z / t)); elseif (t_1 <= Inf) tmp = Float64(t_1 + Float64(Float64(z / Float64(t * t)) * z)); else tmp = Float64(Float64(Float64(z / t) * z) / t); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = (x * x) / (y_m * y_m); tmp = 0.0; if (t_1 <= 1e-252) tmp = (z / t) * (z / t); elseif (t_1 <= Inf) tmp = t_1 + ((z / (t * t)) * z); else tmp = ((z / t) * z) / t; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e-252], N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 + N[(N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / t), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y\_m \cdot y\_m}\\
\mathbf{if}\;t\_1 \leq 10^{-252}:\\
\;\;\;\;\frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + \frac{z}{t \cdot t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{z}{t} \cdot z}{t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.99999999999999943e-253Initial program 69.6%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6491.8
Applied rewrites91.8%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6491.8
Applied rewrites91.8%
if 9.99999999999999943e-253 < (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 79.3%
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-/.f6491.2
Applied rewrites91.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lift-*.f6488.3
Applied rewrites88.3%
if +inf.0 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 0.0%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6449.3
Applied rewrites49.3%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6447.2
Applied rewrites47.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= (/ (* x x) (* y_m y_m)) 5e+175) (fma (/ x (* y_m y_m)) x (* (/ z t) (* (/ 1.0 t) z))) (fma (/ (/ x y_m) y_m) x (/ (* (/ z t) z) t))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (((x * x) / (y_m * y_m)) <= 5e+175) {
tmp = fma((x / (y_m * y_m)), x, ((z / t) * ((1.0 / t) * z)));
} else {
tmp = fma(((x / y_m) / y_m), x, (((z / t) * z) / t));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (Float64(Float64(x * x) / Float64(y_m * y_m)) <= 5e+175) tmp = fma(Float64(x / Float64(y_m * y_m)), x, Float64(Float64(z / t) * Float64(Float64(1.0 / t) * z))); else tmp = fma(Float64(Float64(x / y_m) / y_m), x, Float64(Float64(Float64(z / t) * z) / t)); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision], 5e+175], N[(N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * x + N[(N[(z / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x + N[(N[(N[(z / t), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot x}{y\_m \cdot y\_m} \leq 5 \cdot 10^{+175}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y\_m \cdot y\_m}, x, \frac{z}{t} \cdot \left(\frac{1}{t} \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{x}{y\_m}}{y\_m}, x, \frac{\frac{z}{t} \cdot z}{t}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 5e175Initial program 73.4%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/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.6
Applied rewrites98.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6493.5
Applied rewrites93.5%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
times-fracN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-inversesN/A
times-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-/.f6487.9
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lower-*.f6497.2
Applied rewrites97.2%
if 5e175 < (/.f64 (*.f64 x x) (*.f64 y y)) Initial program 58.0%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/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-/.f6494.5
Applied rewrites94.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6493.6
Applied rewrites93.6%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y_m y_m))))
(if (<= t_1 1e+38)
(+ t_1 (* (/ z t) (/ z t)))
(fma (/ (/ x y_m) y_m) x (* (fabs z) (/ (fabs z) (* t t)))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= 1e+38) {
tmp = t_1 + ((z / t) * (z / t));
} else {
tmp = fma(((x / y_m) / y_m), x, (fabs(z) * (fabs(z) / (t * t))));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(Float64(x * x) / Float64(y_m * y_m)) tmp = 0.0 if (t_1 <= 1e+38) tmp = Float64(t_1 + Float64(Float64(z / t) * Float64(z / t))); else tmp = fma(Float64(Float64(x / y_m) / y_m), x, Float64(abs(z) * Float64(abs(z) / Float64(t * t)))); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+38], N[(t$95$1 + N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x + N[(N[Abs[z], $MachinePrecision] * N[(N[Abs[z], $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y\_m \cdot y\_m}\\
\mathbf{if}\;t\_1 \leq 10^{+38}:\\
\;\;\;\;t\_1 + \frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{x}{y\_m}}{y\_m}, x, \left|z\right| \cdot \frac{\left|z\right|}{t \cdot t}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < 9.99999999999999977e37Initial program 72.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
if 9.99999999999999977e37 < (/.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
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-/.f6495.0
Applied rewrites95.0%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
sqr-abs-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
pow2N/A
lift-*.f6490.4
Applied rewrites90.4%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y_m y_m))))
(if (<= t_1 INFINITY)
(+ t_1 (* (/ z t) (/ z t)))
(+ (/ (* (/ x y_m) x) y_m) (/ (* z z) (* t t))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + ((z / t) * (z / t));
} else {
tmp = (((x / y_m) * x) / y_m) + ((z * z) / (t * t));
}
return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1 + ((z / t) * (z / t));
} else {
tmp = (((x / y_m) * x) / y_m) + ((z * z) / (t * t));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m, z, t): t_1 = (x * x) / (y_m * y_m) tmp = 0 if t_1 <= math.inf: tmp = t_1 + ((z / t) * (z / t)) else: tmp = (((x / y_m) * x) / y_m) + ((z * z) / (t * t)) return tmp
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(Float64(x * x) / Float64(y_m * y_m)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(t_1 + Float64(Float64(z / t) * Float64(z / t))); else tmp = Float64(Float64(Float64(Float64(x / y_m) * x) / y_m) + Float64(Float64(z * z) / Float64(t * t))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m, z, t) t_1 = (x * x) / (y_m * y_m); tmp = 0.0; if (t_1 <= Inf) tmp = t_1 + ((z / t) * (z / t)); else tmp = (((x / y_m) * x) / y_m) + ((z * z) / (t * t)); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(t$95$1 + N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x / y$95$m), $MachinePrecision] * x), $MachinePrecision] / y$95$m), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y\_m \cdot y\_m}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + \frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y\_m} \cdot x}{y\_m} + \frac{z \cdot z}{t \cdot t}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 75.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6492.4
Applied rewrites92.4%
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
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6472.1
Applied rewrites72.1%
y_m = (fabs.f64 y)
(FPCore (x y_m z t)
:precision binary64
(let* ((t_1 (/ (* x x) (* y_m y_m))))
(if (<= t_1 INFINITY)
(+ t_1 (* (/ z t) (/ z t)))
(fma (/ (/ x y_m) y_m) x (/ (* z z) (* t t))))))y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double t_1 = (x * x) / (y_m * y_m);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + ((z / t) * (z / t));
} else {
tmp = fma(((x / y_m) / y_m), x, ((z * z) / (t * t)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) t_1 = Float64(Float64(x * x) / Float64(y_m * y_m)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(t_1 + Float64(Float64(z / t) * Float64(z / t))); else tmp = fma(Float64(Float64(x / y_m) / y_m), x, Float64(Float64(z * z) / Float64(t * t))); end return tmp end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(t$95$1 + N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_1 := \frac{x \cdot x}{y\_m \cdot y\_m}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + \frac{z}{t} \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{x}{y\_m}}{y\_m}, x, \frac{z \cdot z}{t \cdot t}\right)\\
\end{array}
\end{array}
if (/.f64 (*.f64 x x) (*.f64 y y)) < +inf.0Initial program 75.4%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
lower-/.f6492.4
Applied rewrites92.4%
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
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-/.f6486.6
Applied rewrites86.6%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6471.2
Applied rewrites71.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 5.2e-216) (/ (fma (* z (/ z t)) y_m (* t (* x (/ x y_m)))) (* t y_m)) (fma (/ (/ x y_m) y_m) x (* (/ z t) (* (/ 1.0 t) z)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 5.2e-216) {
tmp = fma((z * (z / t)), y_m, (t * (x * (x / y_m)))) / (t * y_m);
} else {
tmp = fma(((x / y_m) / y_m), x, ((z / t) * ((1.0 / t) * z)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 5.2e-216) tmp = Float64(fma(Float64(z * Float64(z / t)), y_m, Float64(t * Float64(x * Float64(x / y_m)))) / Float64(t * y_m)); else tmp = fma(Float64(Float64(x / y_m) / y_m), x, Float64(Float64(z / t) * Float64(Float64(1.0 / t) * z))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 5.2e-216], N[(N[(N[(z * N[(z / t), $MachinePrecision]), $MachinePrecision] * y$95$m + N[(t * N[(x * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * y$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x / y$95$m), $MachinePrecision] / y$95$m), $MachinePrecision] * x + N[(N[(z / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 5.2 \cdot 10^{-216}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot \frac{z}{t}, y\_m, t \cdot \left(x \cdot \frac{x}{y\_m}\right)\right)}{t \cdot y\_m}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{x}{y\_m}}{y\_m}, x, \frac{z}{t} \cdot \left(\frac{1}{t} \cdot z\right)\right)\\
\end{array}
\end{array}
if y < 5.1999999999999997e-216Initial program 59.1%
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.9%
if 5.1999999999999997e-216 < y 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
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.1
Applied rewrites98.1%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6494.6
Applied rewrites94.6%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
times-fracN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-inversesN/A
times-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-/.f6489.1
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.2%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (if (<= y_m 9.5e-166) (+ (/ (* (/ x y_m) x) y_m) (/ (* z z) (* t t))) (fma (/ x (* y_m y_m)) x (* (/ z t) (* (/ 1.0 t) z)))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
double tmp;
if (y_m <= 9.5e-166) {
tmp = (((x / y_m) * x) / y_m) + ((z * z) / (t * t));
} else {
tmp = fma((x / (y_m * y_m)), x, ((z / t) * ((1.0 / t) * z)));
}
return tmp;
}
y_m = abs(y) function code(x, y_m, z, t) tmp = 0.0 if (y_m <= 9.5e-166) tmp = Float64(Float64(Float64(Float64(x / y_m) * x) / y_m) + Float64(Float64(z * z) / Float64(t * t))); else tmp = fma(Float64(x / Float64(y_m * y_m)), x, Float64(Float64(z / t) * Float64(Float64(1.0 / t) * z))); end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := If[LessEqual[y$95$m, 9.5e-166], N[(N[(N[(N[(x / y$95$m), $MachinePrecision] * x), $MachinePrecision] / y$95$m), $MachinePrecision] + N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y$95$m * y$95$m), $MachinePrecision]), $MachinePrecision] * x + N[(N[(z / t), $MachinePrecision] * N[(N[(1.0 / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 9.5 \cdot 10^{-166}:\\
\;\;\;\;\frac{\frac{x}{y\_m} \cdot x}{y\_m} + \frac{z \cdot z}{t \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{y\_m \cdot y\_m}, x, \frac{z}{t} \cdot \left(\frac{1}{t} \cdot z\right)\right)\\
\end{array}
\end{array}
if y < 9.50000000000000046e-166Initial program 57.9%
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
times-fracN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f6482.4
Applied rewrites82.4%
if 9.50000000000000046e-166 < y Initial program 68.2%
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/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
times-fracN/A
pow2N/A
associate-/r*N/A
lower-/.f64N/A
pow2N/A
associate-*l/N/A
lower-*.f64N/A
lift-/.f6494.4
Applied rewrites94.4%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
frac-2negN/A
mul-1-negN/A
*-commutativeN/A
mul-1-negN/A
*-commutativeN/A
times-fracN/A
associate-/l*N/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
*-inversesN/A
times-fracN/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lower-*.f64N/A
lift-/.f6489.2
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
pow2N/A
lower-/.f64N/A
pow2N/A
lower-*.f6493.4
Applied rewrites93.4%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (* (/ z t) (/ z t)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
return (z / t) * (z / t);
}
y_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_m, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z / t) * (z / t)
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
return (z / t) * (z / t);
}
y_m = math.fabs(y) def code(x, y_m, z, t): return (z / t) * (z / t)
y_m = abs(y) function code(x, y_m, z, t) return Float64(Float64(z / t) * Float64(z / t)) end
y_m = abs(y); function tmp = code(x, y_m, z, t) tmp = (z / t) * (z / t); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{z}{t} \cdot \frac{z}{t}
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
lower-*.f64N/A
lift-/.f64N/A
lift-/.f6458.5
Applied rewrites58.5%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (* (fabs z) (/ z (* t t))))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
return fabs(z) * (z / (t * t));
}
y_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_m, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
code = abs(z) * (z / (t * t))
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
return Math.abs(z) * (z / (t * t));
}
y_m = math.fabs(y) def code(x, y_m, z, t): return math.fabs(z) * (z / (t * t))
y_m = abs(y) function code(x, y_m, z, t) return Float64(abs(z) * Float64(z / Float64(t * t))) end
y_m = abs(y); function tmp = code(x, y_m, z, t) tmp = abs(z) * (z / (t * t)); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := N[(N[Abs[z], $MachinePrecision] * N[(z / N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\left|z\right| \cdot \frac{z}{t \cdot t}
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
sqr-abs-revN/A
pow2N/A
associate-/l*N/A
lower-*.f64N/A
lower-fabs.f64N/A
lower-/.f64N/A
lower-fabs.f64N/A
pow2N/A
lift-*.f6452.2
Applied rewrites52.2%
lift-fabs.f64N/A
rem-sqrt-square-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow130.9
Applied rewrites30.9%
y_m = (fabs.f64 y) (FPCore (x y_m z t) :precision binary64 (/ (* z z) (* t t)))
y_m = fabs(y);
double code(double x, double y_m, double z, double t) {
return (z * z) / (t * t);
}
y_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_m, z, t)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z * z) / (t * t)
end function
y_m = Math.abs(y);
public static double code(double x, double y_m, double z, double t) {
return (z * z) / (t * t);
}
y_m = math.fabs(y) def code(x, y_m, z, t): return (z * z) / (t * t)
y_m = abs(y) function code(x, y_m, z, t) return Float64(Float64(z * z) / Float64(t * t)) end
y_m = abs(y); function tmp = code(x, y_m, z, t) tmp = (z * z) / (t * t); end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_, z_, t_] := N[(N[(z * z), $MachinePrecision] / N[(t * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y_m = \left|y\right|
\\
\frac{z \cdot z}{t \cdot t}
\end{array}
Initial program 65.8%
Taylor expanded in x around 0
pow2N/A
pow2N/A
times-fracN/A
pow2N/A
lower-pow.f64N/A
lower-/.f6458.5
Applied rewrites58.5%
lift-/.f64N/A
lift-pow.f64N/A
unpow2N/A
times-fracN/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f6448.0
Applied rewrites48.0%
(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 2025091
(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))))