
(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}
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+299) (fma (- (* z z) t) (* y -4.0) (* x x)) (* (* (* -4.0 z) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+299) {
tmp = fma(((z * z) - t), (y * -4.0), (x * x));
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+299) tmp = fma(Float64(Float64(z * z) - t), Float64(y * -4.0), Float64(x * x)); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+299], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+299}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot z - t, y \cdot -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 z z) < 1.0000000000000001e299Initial program 96.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval99.4
Applied rewrites99.4%
if 1.0000000000000001e299 < (*.f64 z z) Initial program 67.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.4
Applied rewrites81.4%
Applied rewrites92.6%
Final simplification97.7%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e+25)
(fma (* y t) 4.0 (* x x))
(if (<= (* z z) 2e+249)
(* (* y (- (* z z) t)) -4.0)
(* (* (* -4.0 z) y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+25) {
tmp = fma((y * t), 4.0, (x * x));
} else if ((z * z) <= 2e+249) {
tmp = (y * ((z * z) - t)) * -4.0;
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+25) tmp = fma(Float64(y * t), 4.0, Float64(x * x)); elseif (Float64(z * z) <= 2e+249) tmp = Float64(Float64(y * Float64(Float64(z * z) - t)) * -4.0); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+25], N[(N[(y * t), $MachinePrecision] * 4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+249], N[(N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+25}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot t, 4, x \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+249}:\\
\;\;\;\;\left(y \cdot \left(z \cdot z - t\right)\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000024e25Initial program 97.8%
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-*.f6494.8
Applied rewrites94.8%
if 5.00000000000000024e25 < (*.f64 z z) < 1.9999999999999998e249Initial program 92.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6480.3
Applied rewrites80.3%
if 1.9999999999999998e249 < (*.f64 z z) Initial program 70.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.7
Applied rewrites79.7%
Applied rewrites89.6%
Final simplification90.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e-322) (* (* 4.0 t) y) (if (<= (* z z) 2e+81) (* x x) (* (* (* -4.0 z) y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e-322) {
tmp = (4.0 * t) * y;
} else if ((z * z) <= 2e+81) {
tmp = x * x;
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
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
real(8) :: tmp
if ((z * z) <= 2d-322) then
tmp = (4.0d0 * t) * y
else if ((z * z) <= 2d+81) then
tmp = x * x
else
tmp = (((-4.0d0) * z) * y) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e-322) {
tmp = (4.0 * t) * y;
} else if ((z * z) <= 2e+81) {
tmp = x * x;
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e-322: tmp = (4.0 * t) * y elif (z * z) <= 2e+81: tmp = x * x else: tmp = ((-4.0 * z) * y) * z return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e-322) tmp = Float64(Float64(4.0 * t) * y); elseif (Float64(z * z) <= 2e+81) tmp = Float64(x * x); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 2e-322) tmp = (4.0 * t) * y; elseif ((z * z) <= 2e+81) tmp = x * x; else tmp = ((-4.0 * z) * y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e-322], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+81], N[(x * x), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{-322}:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+81}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 z z) < 1.97626e-322Initial program 98.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6458.1
Applied rewrites58.1%
Applied rewrites58.1%
if 1.97626e-322 < (*.f64 z z) < 1.99999999999999984e81Initial program 96.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6414.2
Applied rewrites14.2%
Applied rewrites14.3%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6464.2
Applied rewrites64.2%
if 1.99999999999999984e81 < (*.f64 z z) Initial program 77.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.4
Applied rewrites72.4%
Applied rewrites79.2%
Final simplification69.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+299) (fma x x (* (* y (- (* z z) t)) -4.0)) (* (* (* -4.0 z) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+299) {
tmp = fma(x, x, ((y * ((z * z) - t)) * -4.0));
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+299) tmp = fma(x, x, Float64(Float64(y * Float64(Float64(z * z) - t)) * -4.0)); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+299], N[(x * x + N[(N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+299}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot \left(z \cdot z - t\right)\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 z z) < 1.0000000000000001e299Initial program 96.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-eval96.8
Applied rewrites96.8%
if 1.0000000000000001e299 < (*.f64 z z) Initial program 67.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6481.4
Applied rewrites81.4%
Applied rewrites92.6%
Final simplification95.7%
(FPCore (x y z t) :precision binary64 (if (<= z 6.6e+34) (fma x x (* (* (- t) y) -4.0)) (if (<= z 4e+189) (fma (* (* y z) z) -4.0 (* x x)) (* (* (* -4.0 z) y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.6e+34) {
tmp = fma(x, x, ((-t * y) * -4.0));
} else if (z <= 4e+189) {
tmp = fma(((y * z) * z), -4.0, (x * x));
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 6.6e+34) tmp = fma(x, x, Float64(Float64(Float64(-t) * y) * -4.0)); elseif (z <= 4e+189) tmp = fma(Float64(Float64(y * z) * z), -4.0, Float64(x * x)); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 6.6e+34], N[(x * x + N[(N[((-t) * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4e+189], N[(N[(N[(y * z), $MachinePrecision] * z), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.6 \cdot 10^{+34}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(-t\right) \cdot y\right) \cdot -4\right)\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+189}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot z\right) \cdot z, -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if z < 6.59999999999999976e34Initial program 92.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-eval94.6
Applied rewrites94.6%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6478.1
Applied rewrites78.1%
if 6.59999999999999976e34 < z < 4.0000000000000001e189Initial program 85.1%
Taylor expanded in t around 0
cancel-sign-sub-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-*.f6470.5
Applied rewrites70.5%
Applied rewrites82.3%
if 4.0000000000000001e189 < z Initial program 71.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.8
Applied rewrites89.8%
Applied rewrites96.4%
(FPCore (x y z t) :precision binary64 (if (<= z 1.3e+29) (fma x x (* (* (- t) y) -4.0)) (if (<= z 7.6e+129) (* (* y (- (* z z) t)) -4.0) (* (* (* -4.0 z) y) z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.3e+29) {
tmp = fma(x, x, ((-t * y) * -4.0));
} else if (z <= 7.6e+129) {
tmp = (y * ((z * z) - t)) * -4.0;
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 1.3e+29) tmp = fma(x, x, Float64(Float64(Float64(-t) * y) * -4.0)); elseif (z <= 7.6e+129) tmp = Float64(Float64(y * Float64(Float64(z * z) - t)) * -4.0); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.3e+29], N[(x * x + N[(N[((-t) * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+129], N[(N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.3 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(-t\right) \cdot y\right) \cdot -4\right)\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+129}:\\
\;\;\;\;\left(y \cdot \left(z \cdot z - t\right)\right) \cdot -4\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if z < 1.3e29Initial program 91.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-eval94.5
Applied rewrites94.5%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6477.8
Applied rewrites77.8%
if 1.3e29 < z < 7.60000000000000011e129Initial program 99.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6490.6
Applied rewrites90.6%
if 7.60000000000000011e129 < z Initial program 67.4%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.6
Applied rewrites77.6%
Applied rewrites87.4%
Final simplification80.5%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+132) (fma (* y t) 4.0 (* x x)) (* (* (* -4.0 z) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+132) {
tmp = fma((y * t), 4.0, (x * x));
} else {
tmp = ((-4.0 * z) * y) * z;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+132) tmp = fma(Float64(y * t), 4.0, Float64(x * x)); else tmp = Float64(Float64(Float64(-4.0 * z) * y) * z); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+132], N[(N[(y * t), $MachinePrecision] * 4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * z), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot t, 4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-4 \cdot z\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if (*.f64 z z) < 1.99999999999999998e132Initial program 97.4%
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-*.f6491.2
Applied rewrites91.2%
if 1.99999999999999998e132 < (*.f64 z z) Initial program 75.2%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Applied rewrites83.6%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5e-151) (* (* 4.0 t) y) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5e-151) {
tmp = (4.0 * t) * y;
} else {
tmp = x * x;
}
return tmp;
}
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
real(8) :: tmp
if ((x * x) <= 5d-151) then
tmp = (4.0d0 * t) * y
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5e-151) {
tmp = (4.0 * t) * y;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5e-151: tmp = (4.0 * t) * y else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5e-151) tmp = Float64(Float64(4.0 * t) * y); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 5e-151) tmp = (4.0 * t) * y; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e-151], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{-151}:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000000003e-151Initial program 95.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6454.0
Applied rewrites54.0%
Applied rewrites54.0%
if 5.00000000000000003e-151 < (*.f64 x x) Initial program 84.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6429.1
Applied rewrites29.1%
Applied rewrites31.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6462.4
Applied rewrites62.4%
Final simplification59.1%
(FPCore (x y z t) :precision binary64 (* x x))
double code(double x, double y, double z, double t) {
return x * x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x * x;
}
def code(x, y, z, t): return x * x
function code(x, y, z, t) return Float64(x * x) end
function tmp = code(x, y, z, t) tmp = x * x; end
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x
\end{array}
Initial program 88.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6436.5
Applied rewrites36.5%
Applied rewrites39.4%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6440.8
Applied rewrites40.8%
(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 2024296
(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))))