
(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 9 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 1.7e+162) (fma x x (* (* (- (* z_m z_m) t) y) -4.0)) (fma x x (* (fma (* z_m y) z_m (* t y)) -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.7e+162) {
tmp = fma(x, x, ((((z_m * z_m) - t) * y) * -4.0));
} else {
tmp = fma(x, x, (fma((z_m * y), z_m, (t * y)) * -4.0));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1.7e+162) tmp = fma(x, x, Float64(Float64(Float64(Float64(z_m * z_m) - t) * y) * -4.0)); else tmp = fma(x, x, Float64(fma(Float64(z_m * y), z_m, Float64(t * y)) * -4.0)); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.7e+162], N[(x * x + N[(N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(N[(N[(z$95$m * y), $MachinePrecision] * z$95$m + N[(t * y), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.7 \cdot 10^{+162}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(z\_m \cdot z\_m - t\right) \cdot y\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \mathsf{fma}\left(z\_m \cdot y, z\_m, t \cdot y\right) \cdot -4\right)\\
\end{array}
\end{array}
if z < 1.70000000000000001e162Initial program 88.0%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval93.1
Applied rewrites93.1%
if 1.70000000000000001e162 < z Initial program 66.0%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval76.0
Applied rewrites76.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6484.8
Applied rewrites84.8%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6484.8
Applied rewrites89.8%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (- (* z_m z_m) t)))
(if (<= t_1 -4e-32)
(* (* 4.0 y) t)
(if (<= t_1 2e+197) (* x x) (* (* (* -4.0 z_m) y) z_m)))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (z_m * z_m) - t;
double tmp;
if (t_1 <= -4e-32) {
tmp = (4.0 * y) * t;
} else if (t_1 <= 2e+197) {
tmp = x * x;
} else {
tmp = ((-4.0 * z_m) * y) * z_m;
}
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 * z_m) - t
if (t_1 <= (-4d-32)) then
tmp = (4.0d0 * y) * t
else if (t_1 <= 2d+197) then
tmp = x * x
else
tmp = (((-4.0d0) * z_m) * y) * z_m
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 * z_m) - t;
double tmp;
if (t_1 <= -4e-32) {
tmp = (4.0 * y) * t;
} else if (t_1 <= 2e+197) {
tmp = x * x;
} else {
tmp = ((-4.0 * z_m) * y) * z_m;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): t_1 = (z_m * z_m) - t tmp = 0 if t_1 <= -4e-32: tmp = (4.0 * y) * t elif t_1 <= 2e+197: tmp = x * x else: tmp = ((-4.0 * z_m) * y) * z_m return tmp
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(z_m * z_m) - t) tmp = 0.0 if (t_1 <= -4e-32) tmp = Float64(Float64(4.0 * y) * t); elseif (t_1 <= 2e+197) tmp = Float64(x * x); else tmp = Float64(Float64(Float64(-4.0 * z_m) * y) * z_m); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) t_1 = (z_m * z_m) - t; tmp = 0.0; if (t_1 <= -4e-32) tmp = (4.0 * y) * t; elseif (t_1 <= 2e+197) tmp = x * x; else tmp = ((-4.0 * z_m) * y) * z_m; 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 * z$95$m), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-32], N[(N[(4.0 * y), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 2e+197], N[(x * x), $MachinePrecision], N[(N[(N[(-4.0 * z$95$m), $MachinePrecision] * y), $MachinePrecision] * z$95$m), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := z\_m \cdot z\_m - t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-32}:\\
\;\;\;\;\left(4 \cdot y\right) \cdot t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+197}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\_m\right) \cdot y\right) \cdot z\_m\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < -4.00000000000000022e-32Initial program 89.5%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6469.1
Applied rewrites69.1%
if -4.00000000000000022e-32 < (-.f64 (*.f64 z z) t) < 1.9999999999999999e197Initial program 100.0%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6463.3
Applied rewrites63.3%
if 1.9999999999999999e197 < (-.f64 (*.f64 z z) t) Initial program 69.8%
Taylor expanded in z around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6463.9
Applied rewrites63.9%
Applied rewrites76.5%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (- (* z_m z_m) t)))
(if (<= t_1 -4e-32)
(* (* 4.0 y) t)
(if (<= t_1 2e+197) (* x x) (* (* (* z_m z_m) y) -4.0)))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (z_m * z_m) - t;
double tmp;
if (t_1 <= -4e-32) {
tmp = (4.0 * y) * t;
} else if (t_1 <= 2e+197) {
tmp = x * x;
} else {
tmp = ((z_m * z_m) * y) * -4.0;
}
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 * z_m) - t
if (t_1 <= (-4d-32)) then
tmp = (4.0d0 * y) * t
else if (t_1 <= 2d+197) then
tmp = x * x
else
tmp = ((z_m * z_m) * y) * (-4.0d0)
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 * z_m) - t;
double tmp;
if (t_1 <= -4e-32) {
tmp = (4.0 * y) * t;
} else if (t_1 <= 2e+197) {
tmp = x * x;
} else {
tmp = ((z_m * z_m) * y) * -4.0;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): t_1 = (z_m * z_m) - t tmp = 0 if t_1 <= -4e-32: tmp = (4.0 * y) * t elif t_1 <= 2e+197: tmp = x * x else: tmp = ((z_m * z_m) * y) * -4.0 return tmp
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(z_m * z_m) - t) tmp = 0.0 if (t_1 <= -4e-32) tmp = Float64(Float64(4.0 * y) * t); elseif (t_1 <= 2e+197) tmp = Float64(x * x); else tmp = Float64(Float64(Float64(z_m * z_m) * y) * -4.0); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) t_1 = (z_m * z_m) - t; tmp = 0.0; if (t_1 <= -4e-32) tmp = (4.0 * y) * t; elseif (t_1 <= 2e+197) tmp = x * x; else tmp = ((z_m * z_m) * y) * -4.0; 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 * z$95$m), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-32], N[(N[(4.0 * y), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[t$95$1, 2e+197], N[(x * x), $MachinePrecision], N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := z\_m \cdot z\_m - t\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-32}:\\
\;\;\;\;\left(4 \cdot y\right) \cdot t\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+197}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z\_m \cdot z\_m\right) \cdot y\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < -4.00000000000000022e-32Initial program 89.5%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6469.1
Applied rewrites69.1%
if -4.00000000000000022e-32 < (-.f64 (*.f64 z z) t) < 1.9999999999999999e197Initial program 100.0%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6463.3
Applied rewrites63.3%
if 1.9999999999999999e197 < (-.f64 (*.f64 z z) t) Initial program 69.8%
Taylor expanded in z around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6463.9
Applied rewrites63.9%
Final simplification64.4%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 2.15e+150) (fma x x (* (* (- (* z_m z_m) t) y) -4.0)) (* (* (* -4.0 z_m) y) z_m)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 2.15e+150) {
tmp = fma(x, x, ((((z_m * z_m) - t) * y) * -4.0));
} else {
tmp = ((-4.0 * z_m) * y) * z_m;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 2.15e+150) tmp = fma(x, x, Float64(Float64(Float64(Float64(z_m * z_m) - t) * y) * -4.0)); else tmp = Float64(Float64(Float64(-4.0 * z_m) * y) * z_m); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 2.15e+150], N[(x * x + N[(N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z$95$m), $MachinePrecision] * y), $MachinePrecision] * z$95$m), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 2.15 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(z\_m \cdot z\_m - t\right) \cdot y\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\_m\right) \cdot y\right) \cdot z\_m\\
\end{array}
\end{array}
if z < 2.14999999999999999e150Initial program 87.9%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval93.0
Applied rewrites93.0%
if 2.14999999999999999e150 < z Initial program 69.1%
Taylor expanded in z around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.2
Applied rewrites78.2%
Applied rewrites90.9%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (fma x x (* -4.0 (fma (* z_m y) z_m (* (- t) y)))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return fma(x, x, (-4.0 * fma((z_m * y), z_m, (-t * y))));
}
z_m = abs(z) function code(x, y, z_m, t) return fma(x, x, Float64(-4.0 * fma(Float64(z_m * y), z_m, Float64(Float64(-t) * y)))) end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(x * x + N[(-4.0 * N[(N[(z$95$m * y), $MachinePrecision] * z$95$m + N[((-t) * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
\mathsf{fma}\left(x, x, -4 \cdot \mathsf{fma}\left(z\_m \cdot y, z\_m, \left(-t\right) \cdot y\right)\right)
\end{array}
Initial program 86.3%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval91.8
Applied rewrites91.8%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
distribute-rgt-inN/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-neg.f6496.4
Applied rewrites96.4%
Final simplification96.4%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 1e+141) (fma x x (* 4.0 (* t y))) (* (* (* -4.0 z_m) y) z_m)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 1e+141) {
tmp = fma(x, x, (4.0 * (t * y)));
} else {
tmp = ((-4.0 * z_m) * y) * z_m;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 1e+141) tmp = fma(x, x, Float64(4.0 * Float64(t * y))); else tmp = Float64(Float64(Float64(-4.0 * z_m) * y) * z_m); 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], 1e+141], N[(x * x + N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z$95$m), $MachinePrecision] * y), $MachinePrecision] * z$95$m), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(x, x, 4 \cdot \left(t \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\_m\right) \cdot y\right) \cdot z\_m\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000002e141Initial program 95.5%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval98.7
Applied rewrites98.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6492.8
Applied rewrites92.8%
if 1.00000000000000002e141 < (*.f64 z z) Initial program 71.6%
Taylor expanded in z around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
Applied rewrites85.3%
Final simplification89.9%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 1e+141) (fma (* t y) 4.0 (* x x)) (* (* (* -4.0 z_m) y) z_m)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 1e+141) {
tmp = fma((t * y), 4.0, (x * x));
} else {
tmp = ((-4.0 * z_m) * y) * z_m;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 1e+141) tmp = fma(Float64(t * y), 4.0, Float64(x * x)); else tmp = Float64(Float64(Float64(-4.0 * z_m) * y) * z_m); 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], 1e+141], N[(N[(t * y), $MachinePrecision] * 4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z$95$m), $MachinePrecision] * y), $MachinePrecision] * z$95$m), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 10^{+141}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot y, 4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\_m\right) \cdot y\right) \cdot z\_m\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000002e141Initial program 95.5%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.6
Applied rewrites89.6%
if 1.00000000000000002e141 < (*.f64 z z) Initial program 71.6%
Taylor expanded in z around inf
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
Applied rewrites85.3%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* x x) 6.2e+71) (* (* 4.0 y) t) (* x x)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 6.2e+71) {
tmp = (4.0 * y) * t;
} 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) <= 6.2d+71) then
tmp = (4.0d0 * y) * t
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) <= 6.2e+71) {
tmp = (4.0 * y) * t;
} else {
tmp = x * x;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (x * x) <= 6.2e+71: tmp = (4.0 * y) * t else: tmp = x * x return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(x * x) <= 6.2e+71) tmp = Float64(Float64(4.0 * y) * t); 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) <= 6.2e+71) tmp = (4.0 * y) * t; 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], 6.2e+71], N[(N[(4.0 * y), $MachinePrecision] * t), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 6.2 \cdot 10^{+71}:\\
\;\;\;\;\left(4 \cdot y\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 6.20000000000000036e71Initial program 91.1%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6448.3
Applied rewrites48.3%
if 6.20000000000000036e71 < (*.f64 x x) Initial program 80.8%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6476.4
Applied rewrites76.4%
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 86.3%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6442.5
Applied rewrites42.5%
(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 2024276
(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))))