
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 6.7e+156) (fma x x (* y (* (fma z_m z_m (- t)) -4.0))) (- (* x x) (* z_m (* y (* z_m 4.0))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 6.7e+156) {
tmp = fma(x, x, (y * (fma(z_m, z_m, -t) * -4.0)));
} else {
tmp = (x * x) - (z_m * (y * (z_m * 4.0)));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 6.7e+156) tmp = fma(x, x, Float64(y * Float64(fma(z_m, z_m, Float64(-t)) * -4.0))); else tmp = Float64(Float64(x * x) - Float64(z_m * Float64(y * Float64(z_m * 4.0)))); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 6.7e+156], N[(x * x + N[(y * N[(N[(z$95$m * z$95$m + (-t)), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z$95$m * N[(y * N[(z$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 6.7 \cdot 10^{+156}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(\mathsf{fma}\left(z\_m, z\_m, -t\right) \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z\_m \cdot \left(y \cdot \left(z\_m \cdot 4\right)\right)\\
\end{array}
\end{array}
if z < 6.7e156Initial program 94.3%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-neg.f64N/A
metadata-eval96.1
Applied rewrites96.1%
if 6.7e156 < z Initial program 80.3%
Taylor expanded in z around inf
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6496.5
Applied rewrites96.5%
Final simplification96.1%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (* (* z_m -4.0) (* z_m y))))
(if (<= x 2.55e-172)
t_1
(if (<= x 2.8e-24) (* y (* t 4.0)) (if (<= x 1.1e+43) t_1 (* x x))))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (z_m * -4.0) * (z_m * y);
double tmp;
if (x <= 2.55e-172) {
tmp = t_1;
} else if (x <= 2.8e-24) {
tmp = y * (t * 4.0);
} else if (x <= 1.1e+43) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (z_m * (-4.0d0)) * (z_m * y)
if (x <= 2.55d-172) then
tmp = t_1
else if (x <= 2.8d-24) then
tmp = y * (t * 4.0d0)
else if (x <= 1.1d+43) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double t_1 = (z_m * -4.0) * (z_m * y);
double tmp;
if (x <= 2.55e-172) {
tmp = t_1;
} else if (x <= 2.8e-24) {
tmp = y * (t * 4.0);
} else if (x <= 1.1e+43) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): t_1 = (z_m * -4.0) * (z_m * y) tmp = 0 if x <= 2.55e-172: tmp = t_1 elif x <= 2.8e-24: tmp = y * (t * 4.0) elif x <= 1.1e+43: tmp = t_1 else: tmp = x * x return tmp
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(z_m * -4.0) * Float64(z_m * y)) tmp = 0.0 if (x <= 2.55e-172) tmp = t_1; elseif (x <= 2.8e-24) tmp = Float64(y * Float64(t * 4.0)); elseif (x <= 1.1e+43) tmp = t_1; else tmp = Float64(x * x); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) t_1 = (z_m * -4.0) * (z_m * y); tmp = 0.0; if (x <= 2.55e-172) tmp = t_1; elseif (x <= 2.8e-24) tmp = y * (t * 4.0); elseif (x <= 1.1e+43) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(z$95$m * -4.0), $MachinePrecision] * N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.55e-172], t$95$1, If[LessEqual[x, 2.8e-24], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e+43], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := \left(z\_m \cdot -4\right) \cdot \left(z\_m \cdot y\right)\\
\mathbf{if}\;x \leq 2.55 \cdot 10^{-172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{-24}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 2.5499999999999999e-172 or 2.8000000000000002e-24 < x < 1.1e43Initial program 93.3%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.3
Applied rewrites42.3%
Applied rewrites44.6%
if 2.5499999999999999e-172 < x < 2.8000000000000002e-24Initial program 97.5%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6460.7
Applied rewrites60.7%
if 1.1e43 < x Initial program 87.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6471.4
Applied rewrites71.4%
Final simplification53.2%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (* -4.0 (* y (* z_m z_m)))))
(if (<= x 2.55e-172)
t_1
(if (<= x 1.65e-38) (* y (* t 4.0)) (if (<= x 1.1e+43) t_1 (* x x))))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = -4.0 * (y * (z_m * z_m));
double tmp;
if (x <= 2.55e-172) {
tmp = t_1;
} else if (x <= 1.65e-38) {
tmp = y * (t * 4.0);
} else if (x <= 1.1e+43) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (-4.0d0) * (y * (z_m * z_m))
if (x <= 2.55d-172) then
tmp = t_1
else if (x <= 1.65d-38) then
tmp = y * (t * 4.0d0)
else if (x <= 1.1d+43) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double t_1 = -4.0 * (y * (z_m * z_m));
double tmp;
if (x <= 2.55e-172) {
tmp = t_1;
} else if (x <= 1.65e-38) {
tmp = y * (t * 4.0);
} else if (x <= 1.1e+43) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): t_1 = -4.0 * (y * (z_m * z_m)) tmp = 0 if x <= 2.55e-172: tmp = t_1 elif x <= 1.65e-38: tmp = y * (t * 4.0) elif x <= 1.1e+43: tmp = t_1 else: tmp = x * x return tmp
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(-4.0 * Float64(y * Float64(z_m * z_m))) tmp = 0.0 if (x <= 2.55e-172) tmp = t_1; elseif (x <= 1.65e-38) tmp = Float64(y * Float64(t * 4.0)); elseif (x <= 1.1e+43) tmp = t_1; else tmp = Float64(x * x); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) t_1 = -4.0 * (y * (z_m * z_m)); tmp = 0.0; if (x <= 2.55e-172) tmp = t_1; elseif (x <= 1.65e-38) tmp = y * (t * 4.0); elseif (x <= 1.1e+43) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(-4.0 * N[(y * N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.55e-172], t$95$1, If[LessEqual[x, 1.65e-38], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e+43], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := -4 \cdot \left(y \cdot \left(z\_m \cdot z\_m\right)\right)\\
\mathbf{if}\;x \leq 2.55 \cdot 10^{-172}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.65 \cdot 10^{-38}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 2.5499999999999999e-172 or 1.6500000000000001e-38 < x < 1.1e43Initial program 93.4%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6442.4
Applied rewrites42.4%
if 2.5499999999999999e-172 < x < 1.6500000000000001e-38Initial program 97.4%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6461.1
Applied rewrites61.1%
if 1.1e43 < x Initial program 87.9%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6471.4
Applied rewrites71.4%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* x x) 2e+82) (* y (fma z_m (* z_m -4.0) (* t 4.0))) (fma y (* t 4.0) (* x x))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 2e+82) {
tmp = y * fma(z_m, (z_m * -4.0), (t * 4.0));
} else {
tmp = fma(y, (t * 4.0), (x * x));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(x * x) <= 2e+82) tmp = Float64(y * fma(z_m, Float64(z_m * -4.0), Float64(t * 4.0))); else tmp = fma(y, Float64(t * 4.0), Float64(x * x)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e+82], N[(y * N[(z$95$m * N[(z$95$m * -4.0), $MachinePrecision] + N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(t * 4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+82}:\\
\;\;\;\;y \cdot \mathsf{fma}\left(z\_m, z\_m \cdot -4, t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, t \cdot 4, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.9999999999999999e82Initial program 94.5%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6483.5
Applied rewrites83.5%
Applied rewrites83.5%
Applied rewrites84.2%
if 1.9999999999999999e82 < (*.f64 x x) Initial program 90.6%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.7
Applied rewrites86.7%
Final simplification85.3%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 8.2e-16) (fma x x (* y (* t 4.0))) (- (* x x) (* z_m (* y (* z_m 4.0))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 8.2e-16) {
tmp = fma(x, x, (y * (t * 4.0)));
} else {
tmp = (x * x) - (z_m * (y * (z_m * 4.0)));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 8.2e-16) tmp = fma(x, x, Float64(y * Float64(t * 4.0))); else tmp = Float64(Float64(x * x) - Float64(z_m * Float64(y * Float64(z_m * 4.0)))); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 8.2e-16], N[(x * x + N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z$95$m * N[(y * N[(z$95$m * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 8.2 \cdot 10^{-16}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(t \cdot 4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z\_m \cdot \left(y \cdot \left(z\_m \cdot 4\right)\right)\\
\end{array}
\end{array}
if z < 8.20000000000000012e-16Initial program 93.3%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-neg.f64N/A
metadata-eval95.3
Applied rewrites95.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6477.8
Applied rewrites77.8%
if 8.20000000000000012e-16 < z Initial program 91.2%
Taylor expanded in z around inf
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6489.4
Applied rewrites89.4%
Final simplification80.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* x x) 2e+82) (* (- (* z_m z_m) t) (* y -4.0)) (fma y (* t 4.0) (* x x))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 2e+82) {
tmp = ((z_m * z_m) - t) * (y * -4.0);
} else {
tmp = fma(y, (t * 4.0), (x * x));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(x * x) <= 2e+82) tmp = Float64(Float64(Float64(z_m * z_m) - t) * Float64(y * -4.0)); else tmp = fma(y, Float64(t * 4.0), Float64(x * x)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2e+82], N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(t * 4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+82}:\\
\;\;\;\;\left(z\_m \cdot z\_m - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, t \cdot 4, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.9999999999999999e82Initial program 94.5%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6483.5
Applied rewrites83.5%
if 1.9999999999999999e82 < (*.f64 x x) Initial program 90.6%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.7
Applied rewrites86.7%
Final simplification85.0%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 4e+99) (fma x x (* y (* t 4.0))) (* (* z_m -4.0) (* z_m y))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 4e+99) {
tmp = fma(x, x, (y * (t * 4.0)));
} else {
tmp = (z_m * -4.0) * (z_m * y);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 4e+99) tmp = fma(x, x, Float64(y * Float64(t * 4.0))); else tmp = Float64(Float64(z_m * -4.0) * Float64(z_m * y)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e+99], N[(x * x + N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z$95$m * -4.0), $MachinePrecision] * N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(t \cdot 4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z\_m \cdot -4\right) \cdot \left(z\_m \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 3.9999999999999999e99Initial program 98.0%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-neg.f64N/A
metadata-eval99.9
Applied rewrites99.9%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6488.8
Applied rewrites88.8%
if 3.9999999999999999e99 < (*.f64 z z) Initial program 84.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites75.7%
Final simplification83.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 4e+99) (fma y (* t 4.0) (* x x)) (* (* z_m -4.0) (* z_m y))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 4e+99) {
tmp = fma(y, (t * 4.0), (x * x));
} else {
tmp = (z_m * -4.0) * (z_m * y);
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 4e+99) tmp = fma(y, Float64(t * 4.0), Float64(x * x)); else tmp = Float64(Float64(z_m * -4.0) * Float64(z_m * y)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 4e+99], N[(y * N[(t * 4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z$95$m * -4.0), $MachinePrecision] * N[(z$95$m * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 4 \cdot 10^{+99}:\\
\;\;\;\;\mathsf{fma}\left(y, t \cdot 4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z\_m \cdot -4\right) \cdot \left(z\_m \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 3.9999999999999999e99Initial program 98.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.5
Applied rewrites87.5%
if 3.9999999999999999e99 < (*.f64 z z) Initial program 84.9%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites75.7%
Final simplification82.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* x x) 1.9e-47) (* y (* t 4.0)) (* x x)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 1.9e-47) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((x * x) <= 1.9d-47) then
tmp = y * (t * 4.0d0)
else
tmp = x * x
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 1.9e-47) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (x * x) <= 1.9e-47: tmp = y * (t * 4.0) else: tmp = x * x return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(x * x) <= 1.9e-47) tmp = Float64(y * Float64(t * 4.0)); else tmp = Float64(x * x); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if ((x * x) <= 1.9e-47) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.9e-47], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.9 \cdot 10^{-47}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.90000000000000007e-47Initial program 94.1%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6450.0
Applied rewrites50.0%
if 1.90000000000000007e-47 < (*.f64 x x) Initial program 91.6%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6470.9
Applied rewrites70.9%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (* x x))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return x * x;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = x * x
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return x * x;
}
z_m = math.fabs(z) def code(x, y, z_m, t): return x * x
z_m = abs(z) function code(x, y, z_m, t) return Float64(x * x) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = x * x; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x \cdot x
\end{array}
Initial program 92.7%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6444.7
Applied rewrites44.7%
(FPCore (x y z t) :precision binary64 (- (* x x) (* 4.0 (* y (- (* z z) t)))))
double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - (4.0d0 * (y * ((z * z) - t)))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
def code(x, y, z, t): return (x * x) - (4.0 * (y * ((z * z) - t)))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(4.0 * Float64(y * Float64(Float64(z * z) - t)))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (4.0 * (y * ((z * z) - t))); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)
\end{array}
herbie shell --seed 2024233
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:alt
(! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))