
(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 8 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 1e+213) (fma (* (* y -4.0) z_m) z_m (fma (* (- t) y) -4.0 (* x x))) (* (* (* y z_m) z_m) -4.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1e+213) {
tmp = fma(((y * -4.0) * z_m), z_m, fma((-t * y), -4.0, (x * x)));
} else {
tmp = ((y * z_m) * z_m) * -4.0;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1e+213) tmp = fma(Float64(Float64(y * -4.0) * z_m), z_m, fma(Float64(Float64(-t) * y), -4.0, Float64(x * x))); else tmp = Float64(Float64(Float64(y * z_m) * 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, 1e+213], N[(N[(N[(y * -4.0), $MachinePrecision] * z$95$m), $MachinePrecision] * z$95$m + N[(N[((-t) * y), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 10^{+213}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot -4\right) \cdot z\_m, z\_m, \mathsf{fma}\left(\left(-t\right) \cdot y, -4, x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot z\_m\right) \cdot z\_m\right) \cdot -4\\
\end{array}
\end{array}
if z < 9.99999999999999984e212Initial program 92.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites96.9%
if 9.99999999999999984e212 < z Initial program 65.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.3
Applied rewrites77.3%
Applied rewrites95.9%
Final simplification96.8%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 3.4e+138) (fma (* (- t) -4.0) y (fma (* (* z_m z_m) y) -4.0 (* x x))) (* (* (* y z_m) z_m) -4.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 3.4e+138) {
tmp = fma((-t * -4.0), y, fma(((z_m * z_m) * y), -4.0, (x * x)));
} else {
tmp = ((y * z_m) * z_m) * -4.0;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 3.4e+138) tmp = fma(Float64(Float64(-t) * -4.0), y, fma(Float64(Float64(z_m * z_m) * y), -4.0, Float64(x * x))); else tmp = Float64(Float64(Float64(y * z_m) * 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, 3.4e+138], N[(N[((-t) * -4.0), $MachinePrecision] * y + N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] * y), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 3.4 \cdot 10^{+138}:\\
\;\;\;\;\mathsf{fma}\left(\left(-t\right) \cdot -4, y, \mathsf{fma}\left(\left(z\_m \cdot z\_m\right) \cdot y, -4, x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot z\_m\right) \cdot z\_m\right) \cdot -4\\
\end{array}
\end{array}
if z < 3.40000000000000011e138Initial program 95.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites97.6%
lift-fma.f64N/A
+-commutativeN/A
lift-fma.f64N/A
associate-+l+N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
lift-*.f64N/A
associate-*l*N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*l*N/A
lift-*.f64N/A
lift-fma.f64N/A
lower-fma.f64N/A
Applied rewrites95.1%
if 3.40000000000000011e138 < z Initial program 65.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6475.2
Applied rewrites75.2%
Applied rewrites90.5%
Final simplification94.3%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 5e-68) (* (* 4.0 t) y) (if (<= (* z_m z_m) 1e+123) (* x x) (* (* (* y z_m) z_m) -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 5e-68) {
tmp = (4.0 * t) * y;
} else if ((z_m * z_m) <= 1e+123) {
tmp = x * x;
} else {
tmp = ((y * z_m) * z_m) * -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) :: tmp
if ((z_m * z_m) <= 5d-68) then
tmp = (4.0d0 * t) * y
else if ((z_m * z_m) <= 1d+123) then
tmp = x * x
else
tmp = ((y * z_m) * z_m) * (-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 tmp;
if ((z_m * z_m) <= 5e-68) {
tmp = (4.0 * t) * y;
} else if ((z_m * z_m) <= 1e+123) {
tmp = x * x;
} else {
tmp = ((y * z_m) * z_m) * -4.0;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 5e-68: tmp = (4.0 * t) * y elif (z_m * z_m) <= 1e+123: tmp = x * x else: tmp = ((y * z_m) * z_m) * -4.0 return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 5e-68) tmp = Float64(Float64(4.0 * t) * y); elseif (Float64(z_m * z_m) <= 1e+123) tmp = Float64(x * x); else tmp = Float64(Float64(Float64(y * z_m) * z_m) * -4.0); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if ((z_m * z_m) <= 5e-68) tmp = (4.0 * t) * y; elseif ((z_m * z_m) <= 1e+123) tmp = x * x; else tmp = ((y * z_m) * z_m) * -4.0; end tmp_2 = 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], 5e-68], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(z$95$m * z$95$m), $MachinePrecision], 1e+123], N[(x * x), $MachinePrecision], N[(N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 5 \cdot 10^{-68}:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\
\mathbf{elif}\;z\_m \cdot z\_m \leq 10^{+123}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot z\_m\right) \cdot z\_m\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999971e-68Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6456.7
Applied rewrites56.7%
Applied rewrites56.7%
if 4.99999999999999971e-68 < (*.f64 z z) < 9.99999999999999978e122Initial program 97.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6443.2
Applied rewrites43.2%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6461.0
Applied rewrites61.0%
if 9.99999999999999978e122 < (*.f64 z z) Initial program 80.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.9
Applied rewrites74.9%
Applied rewrites84.8%
Final simplification70.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* z_m z_m) 2e+268) (- (* x x) (* (- (* z_m z_m) t) (* 4.0 y))) (* (* (* y z_m) z_m) -4.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((z_m * z_m) <= 2e+268) {
tmp = (x * x) - (((z_m * z_m) - t) * (4.0 * y));
} else {
tmp = ((y * z_m) * z_m) * -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) :: tmp
if ((z_m * z_m) <= 2d+268) then
tmp = (x * x) - (((z_m * z_m) - t) * (4.0d0 * y))
else
tmp = ((y * z_m) * z_m) * (-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 tmp;
if ((z_m * z_m) <= 2e+268) {
tmp = (x * x) - (((z_m * z_m) - t) * (4.0 * y));
} else {
tmp = ((y * z_m) * z_m) * -4.0;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (z_m * z_m) <= 2e+268: tmp = (x * x) - (((z_m * z_m) - t) * (4.0 * y)) else: tmp = ((y * z_m) * z_m) * -4.0 return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(z_m * z_m) <= 2e+268) tmp = Float64(Float64(x * x) - Float64(Float64(Float64(z_m * z_m) - t) * Float64(4.0 * y))); else tmp = Float64(Float64(Float64(y * z_m) * z_m) * -4.0); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if ((z_m * z_m) <= 2e+268) tmp = (x * x) - (((z_m * z_m) - t) * (4.0 * y)); else tmp = ((y * z_m) * z_m) * -4.0; end tmp_2 = 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], 2e+268], N[(N[(x * x), $MachinePrecision] - N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \cdot z\_m \leq 2 \cdot 10^{+268}:\\
\;\;\;\;x \cdot x - \left(z\_m \cdot z\_m - t\right) \cdot \left(4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot z\_m\right) \cdot z\_m\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e268Initial program 99.4%
if 1.9999999999999999e268 < (*.f64 z z) Initial program 71.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.2
Applied rewrites77.2%
Applied rewrites91.6%
Final simplification96.8%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(let* ((t_1 (* (* y z_m) z_m)))
(if (<= z_m 9.5e+41)
(fma (* 4.0 t) y (* x x))
(if (<= z_m 6.5e+213) (fma t_1 -4.0 (* x x)) (* t_1 -4.0)))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double t_1 = (y * z_m) * z_m;
double tmp;
if (z_m <= 9.5e+41) {
tmp = fma((4.0 * t), y, (x * x));
} else if (z_m <= 6.5e+213) {
tmp = fma(t_1, -4.0, (x * x));
} else {
tmp = t_1 * -4.0;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) t_1 = Float64(Float64(y * z_m) * z_m) tmp = 0.0 if (z_m <= 9.5e+41) tmp = fma(Float64(4.0 * t), y, Float64(x * x)); elseif (z_m <= 6.5e+213) tmp = fma(t_1, -4.0, Float64(x * x)); else tmp = Float64(t_1 * -4.0); end return tmp end
z_m = N[Abs[z], $MachinePrecision]
code[x_, y_, z$95$m_, t_] := Block[{t$95$1 = N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision]}, If[LessEqual[z$95$m, 9.5e+41], N[(N[(4.0 * t), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 6.5e+213], N[(t$95$1 * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * -4.0), $MachinePrecision]]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
t_1 := \left(y \cdot z\_m\right) \cdot z\_m\\
\mathbf{if}\;z\_m \leq 9.5 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(4 \cdot t, y, x \cdot x\right)\\
\mathbf{elif}\;z\_m \leq 6.5 \cdot 10^{+213}:\\
\;\;\;\;\mathsf{fma}\left(t\_1, -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot -4\\
\end{array}
\end{array}
if z < 9.4999999999999996e41Initial program 94.7%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.3
Applied rewrites72.3%
Applied rewrites72.8%
if 9.4999999999999996e41 < z < 6.49999999999999982e213Initial program 81.8%
Taylor expanded in t around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.8
Applied rewrites81.8%
Applied rewrites93.7%
if 6.49999999999999982e213 < z Initial program 65.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.3
Applied rewrites77.3%
Applied rewrites95.9%
Final simplification77.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 3.5e+61) (fma (* 4.0 t) y (* x x)) (* (* (* y z_m) z_m) -4.0)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 3.5e+61) {
tmp = fma((4.0 * t), y, (x * x));
} else {
tmp = ((y * z_m) * z_m) * -4.0;
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 3.5e+61) tmp = fma(Float64(4.0 * t), y, Float64(x * x)); else tmp = Float64(Float64(Float64(y * z_m) * 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, 3.5e+61], N[(N[(4.0 * t), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * z$95$m), $MachinePrecision] * z$95$m), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 3.5 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(4 \cdot t, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot z\_m\right) \cdot z\_m\right) \cdot -4\\
\end{array}
\end{array}
if z < 3.50000000000000018e61Initial program 94.8%
Taylor expanded in z around 0
cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.7
Applied rewrites72.7%
Applied rewrites73.2%
if 3.50000000000000018e61 < z Initial program 73.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.0
Applied rewrites77.0%
Applied rewrites89.0%
Final simplification76.6%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* x x) 82000000000000.0) (* (* 4.0 t) y) (* x x)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((x * x) <= 82000000000000.0) {
tmp = (4.0 * t) * y;
} 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) <= 82000000000000.0d0) then
tmp = (4.0d0 * t) * y
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) <= 82000000000000.0) {
tmp = (4.0 * t) * y;
} else {
tmp = x * x;
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (x * x) <= 82000000000000.0: tmp = (4.0 * t) * y else: tmp = x * x return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(x * x) <= 82000000000000.0) tmp = Float64(Float64(4.0 * t) * y); 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) <= 82000000000000.0) tmp = (4.0 * t) * y; 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], 82000000000000.0], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 82000000000000:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 8.2e13Initial program 91.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6439.8
Applied rewrites39.8%
Applied rewrites39.8%
if 8.2e13 < (*.f64 x x) Initial program 88.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6443.0
Applied rewrites43.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6467.4
Applied rewrites67.4%
Final simplification52.6%
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 90.2%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6465.7
Applied rewrites65.7%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6436.2
Applied rewrites36.2%
(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 2024298
(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))))