
(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 7 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+307) (fma (* y 4.0) (- t (* z z)) (* x x)) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+307) {
tmp = fma((y * 4.0), (t - (z * z)), (x * x));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+307) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+307], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999986e306Initial program 96.3%
cancel-sign-sub-inv96.3%
distribute-lft-neg-out96.3%
+-commutative96.3%
associate-*l*96.3%
distribute-lft-neg-in96.3%
associate-*l*96.3%
distribute-rgt-neg-in96.3%
fma-define98.4%
sub-neg98.4%
+-commutative98.4%
distribute-neg-in98.4%
remove-double-neg98.4%
sub-neg98.4%
Simplified98.4%
if 9.99999999999999986e306 < (*.f64 z z) Initial program 75.1%
cancel-sign-sub-inv75.1%
distribute-lft-neg-out75.1%
+-commutative75.1%
associate-*l*73.6%
distribute-lft-neg-in73.6%
associate-*l*75.1%
distribute-rgt-neg-in75.1%
fma-define75.1%
sub-neg75.1%
+-commutative75.1%
distribute-neg-in75.1%
remove-double-neg75.1%
sub-neg75.1%
Simplified75.1%
Taylor expanded in z around inf 78.1%
associate-*r*78.1%
*-commutative78.1%
*-commutative78.1%
Simplified78.1%
pow278.1%
add-sqr-sqrt46.8%
pow246.8%
sqrt-prod46.8%
sqrt-prod20.0%
add-sqr-sqrt52.5%
Applied egg-rr52.5%
unpow252.5%
swap-sqr46.9%
add-sqr-sqrt78.1%
associate-*l*91.0%
Applied egg-rr91.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+307) (fma x x (* (* y -4.0) (- (* z z) t))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+307) {
tmp = fma(x, x, ((y * -4.0) * ((z * z) - t)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+307) tmp = fma(x, x, Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+307], N[(x * x + N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999986e306Initial program 96.3%
fma-neg97.8%
distribute-lft-neg-in97.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
metadata-eval97.8%
Simplified97.8%
if 9.99999999999999986e306 < (*.f64 z z) Initial program 75.1%
cancel-sign-sub-inv75.1%
distribute-lft-neg-out75.1%
+-commutative75.1%
associate-*l*73.6%
distribute-lft-neg-in73.6%
associate-*l*75.1%
distribute-rgt-neg-in75.1%
fma-define75.1%
sub-neg75.1%
+-commutative75.1%
distribute-neg-in75.1%
remove-double-neg75.1%
sub-neg75.1%
Simplified75.1%
Taylor expanded in z around inf 78.1%
associate-*r*78.1%
*-commutative78.1%
*-commutative78.1%
Simplified78.1%
pow278.1%
add-sqr-sqrt46.8%
pow246.8%
sqrt-prod46.8%
sqrt-prod20.0%
add-sqr-sqrt52.5%
Applied egg-rr52.5%
unpow252.5%
swap-sqr46.9%
add-sqr-sqrt78.1%
associate-*l*91.0%
Applied egg-rr91.0%
Final simplification96.1%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 2e+145)
(- (* x x) (* t (* y -4.0)))
(if (or (<= (* z z) 5e+183) (not (<= (* z z) 4e+227)))
(* z (* z (* y -4.0)))
(* y (+ (* 4.0 t) (* x (/ x y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+145) {
tmp = (x * x) - (t * (y * -4.0));
} else if (((z * z) <= 5e+183) || !((z * z) <= 4e+227)) {
tmp = z * (z * (y * -4.0));
} else {
tmp = y * ((4.0 * t) + (x * (x / y)));
}
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+145) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else if (((z * z) <= 5d+183) .or. (.not. ((z * z) <= 4d+227))) then
tmp = z * (z * (y * (-4.0d0)))
else
tmp = y * ((4.0d0 * t) + (x * (x / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+145) {
tmp = (x * x) - (t * (y * -4.0));
} else if (((z * z) <= 5e+183) || !((z * z) <= 4e+227)) {
tmp = z * (z * (y * -4.0));
} else {
tmp = y * ((4.0 * t) + (x * (x / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+145: tmp = (x * x) - (t * (y * -4.0)) elif ((z * z) <= 5e+183) or not ((z * z) <= 4e+227): tmp = z * (z * (y * -4.0)) else: tmp = y * ((4.0 * t) + (x * (x / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+145) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); elseif ((Float64(z * z) <= 5e+183) || !(Float64(z * z) <= 4e+227)) tmp = Float64(z * Float64(z * Float64(y * -4.0))); else tmp = Float64(y * Float64(Float64(4.0 * t) + Float64(x * Float64(x / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 2e+145) tmp = (x * x) - (t * (y * -4.0)); elseif (((z * z) <= 5e+183) || ~(((z * z) <= 4e+227))) tmp = z * (z * (y * -4.0)); else tmp = y * ((4.0 * t) + (x * (x / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+145], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(z * z), $MachinePrecision], 5e+183], N[Not[LessEqual[N[(z * z), $MachinePrecision], 4e+227]], $MachinePrecision]], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(4.0 * t), $MachinePrecision] + N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+145}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+183} \lor \neg \left(z \cdot z \leq 4 \cdot 10^{+227}\right):\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(4 \cdot t + x \cdot \frac{x}{y}\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2e145Initial program 97.5%
Taylor expanded in z around 0 89.9%
*-commutative89.9%
associate-*r*89.9%
Simplified89.9%
if 2e145 < (*.f64 z z) < 5.00000000000000009e183 or 4.0000000000000004e227 < (*.f64 z z) Initial program 79.8%
cancel-sign-sub-inv79.8%
distribute-lft-neg-out79.8%
+-commutative79.8%
associate-*l*78.7%
distribute-lft-neg-in78.7%
associate-*l*79.8%
distribute-rgt-neg-in79.8%
fma-define79.8%
sub-neg79.8%
+-commutative79.8%
distribute-neg-in79.8%
remove-double-neg79.8%
sub-neg79.8%
Simplified79.8%
Taylor expanded in z around inf 78.6%
associate-*r*78.6%
*-commutative78.6%
*-commutative78.6%
Simplified78.6%
pow278.6%
add-sqr-sqrt47.6%
pow247.6%
sqrt-prod47.5%
sqrt-prod19.9%
add-sqr-sqrt51.8%
Applied egg-rr51.8%
unpow251.8%
swap-sqr47.5%
add-sqr-sqrt78.6%
associate-*l*88.4%
Applied egg-rr88.4%
if 5.00000000000000009e183 < (*.f64 z z) < 4.0000000000000004e227Initial program 77.8%
fma-neg88.9%
distribute-lft-neg-in88.9%
*-commutative88.9%
distribute-rgt-neg-in88.9%
metadata-eval88.9%
Simplified88.9%
Taylor expanded in z around 0 77.8%
neg-mul-177.8%
Simplified77.8%
Taylor expanded in y around inf 88.9%
unpow288.9%
associate-/l*88.9%
Applied egg-rr88.9%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+307) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+307) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (z * (y * -4.0));
}
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) <= 1d+307) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+307) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e+307: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+307) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 1e+307) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+307], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+307}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999986e306Initial program 96.3%
if 9.99999999999999986e306 < (*.f64 z z) Initial program 75.1%
cancel-sign-sub-inv75.1%
distribute-lft-neg-out75.1%
+-commutative75.1%
associate-*l*73.6%
distribute-lft-neg-in73.6%
associate-*l*75.1%
distribute-rgt-neg-in75.1%
fma-define75.1%
sub-neg75.1%
+-commutative75.1%
distribute-neg-in75.1%
remove-double-neg75.1%
sub-neg75.1%
Simplified75.1%
Taylor expanded in z around inf 78.1%
associate-*r*78.1%
*-commutative78.1%
*-commutative78.1%
Simplified78.1%
pow278.1%
add-sqr-sqrt46.8%
pow246.8%
sqrt-prod46.8%
sqrt-prod20.0%
add-sqr-sqrt52.5%
Applied egg-rr52.5%
unpow252.5%
swap-sqr46.9%
add-sqr-sqrt78.1%
associate-*l*91.0%
Applied egg-rr91.0%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (<= z 3.4e+73) (- (* x x) (* t (* y -4.0))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.4e+73) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = z * (z * (y * -4.0));
}
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 <= 3.4d+73) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.4e+73) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 3.4e+73: tmp = (x * x) - (t * (y * -4.0)) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 3.4e+73) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 3.4e+73) tmp = (x * x) - (t * (y * -4.0)); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 3.4e+73], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.4 \cdot 10^{+73}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 3.4000000000000002e73Initial program 93.2%
Taylor expanded in z around 0 75.0%
*-commutative75.0%
associate-*r*75.0%
Simplified75.0%
if 3.4000000000000002e73 < z Initial program 78.7%
cancel-sign-sub-inv78.7%
distribute-lft-neg-out78.7%
+-commutative78.7%
associate-*l*78.7%
distribute-lft-neg-in78.7%
associate-*l*78.7%
distribute-rgt-neg-in78.7%
fma-define78.7%
sub-neg78.7%
+-commutative78.7%
distribute-neg-in78.7%
remove-double-neg78.7%
sub-neg78.7%
Simplified78.7%
Taylor expanded in z around inf 76.3%
associate-*r*76.3%
*-commutative76.3%
*-commutative76.3%
Simplified76.3%
pow276.3%
add-sqr-sqrt41.6%
pow241.6%
sqrt-prod41.6%
sqrt-prod43.8%
add-sqr-sqrt43.9%
Applied egg-rr43.9%
unpow243.9%
swap-sqr41.5%
add-sqr-sqrt76.3%
associate-*l*85.4%
Applied egg-rr85.4%
(FPCore (x y z t) :precision binary64 (if (<= z 6.2e+36) (* 4.0 (* y t)) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.2e+36) {
tmp = 4.0 * (y * t);
} else {
tmp = z * (z * (y * -4.0));
}
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 <= 6.2d+36) then
tmp = 4.0d0 * (y * t)
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.2e+36) {
tmp = 4.0 * (y * t);
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 6.2e+36: tmp = 4.0 * (y * t) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 6.2e+36) tmp = Float64(4.0 * Float64(y * t)); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 6.2e+36) tmp = 4.0 * (y * t); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 6.2e+36], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.2 \cdot 10^{+36}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 6.1999999999999999e36Initial program 93.1%
cancel-sign-sub-inv93.1%
distribute-lft-neg-out93.1%
+-commutative93.1%
associate-*l*92.7%
distribute-lft-neg-in92.7%
associate-*l*93.1%
distribute-rgt-neg-in93.1%
fma-define95.0%
sub-neg95.0%
+-commutative95.0%
distribute-neg-in95.0%
remove-double-neg95.0%
sub-neg95.0%
Simplified95.0%
Taylor expanded in t around inf 35.1%
*-commutative35.1%
Simplified35.1%
if 6.1999999999999999e36 < z Initial program 80.2%
cancel-sign-sub-inv80.2%
distribute-lft-neg-out80.2%
+-commutative80.2%
associate-*l*80.2%
distribute-lft-neg-in80.2%
associate-*l*80.2%
distribute-rgt-neg-in80.2%
fma-define80.2%
sub-neg80.2%
+-commutative80.2%
distribute-neg-in80.2%
remove-double-neg80.2%
sub-neg80.2%
Simplified80.2%
Taylor expanded in z around inf 71.3%
associate-*r*71.3%
*-commutative71.3%
*-commutative71.3%
Simplified71.3%
pow271.3%
add-sqr-sqrt38.9%
pow238.9%
sqrt-prod38.9%
sqrt-prod40.9%
add-sqr-sqrt41.0%
Applied egg-rr41.0%
unpow241.0%
swap-sqr38.8%
add-sqr-sqrt71.3%
associate-*l*79.8%
Applied egg-rr79.8%
(FPCore (x y z t) :precision binary64 (* 4.0 (* y t)))
double code(double x, double y, double z, double t) {
return 4.0 * (y * 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 = 4.0d0 * (y * t)
end function
public static double code(double x, double y, double z, double t) {
return 4.0 * (y * t);
}
def code(x, y, z, t): return 4.0 * (y * t)
function code(x, y, z, t) return Float64(4.0 * Float64(y * t)) end
function tmp = code(x, y, z, t) tmp = 4.0 * (y * t); end
code[x_, y_, z_, t_] := N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(y \cdot t\right)
\end{array}
Initial program 90.9%
cancel-sign-sub-inv90.9%
distribute-lft-neg-out90.9%
+-commutative90.9%
associate-*l*90.5%
distribute-lft-neg-in90.5%
associate-*l*90.9%
distribute-rgt-neg-in90.9%
fma-define92.5%
sub-neg92.5%
+-commutative92.5%
distribute-neg-in92.5%
remove-double-neg92.5%
sub-neg92.5%
Simplified92.5%
Taylor expanded in t around inf 31.3%
*-commutative31.3%
Simplified31.3%
(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 2024111
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:alt
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))