
(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) 5e+276) (fma (* y 4.0) (fma z (- z) t) (* x x)) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+276) {
tmp = fma((y * 4.0), fma(z, -z, t), (x * x));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+276) tmp = fma(Float64(y * 4.0), fma(z, Float64(-z), t), Float64(x * x)); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+276], N[(N[(y * 4.0), $MachinePrecision] * N[(z * (-z) + t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+276}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, \mathsf{fma}\left(z, -z, t\right), x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000001e276Initial program 96.3%
cancel-sign-sub-inv96.3%
distribute-lft-neg-out96.3%
+-commutative96.3%
distribute-lft-neg-out96.3%
distribute-lft-neg-in96.3%
distribute-rgt-neg-in96.3%
fma-def98.1%
sub-neg98.1%
distribute-neg-in98.1%
distribute-rgt-neg-out98.1%
remove-double-neg98.1%
fma-def98.1%
Simplified98.1%
if 5.00000000000000001e276 < (*.f64 z z) Initial program 69.3%
fma-neg69.3%
Applied egg-rr69.3%
fma-udef69.3%
unpow269.3%
sub-neg69.3%
flip--3.4%
pow-prod-up3.4%
metadata-eval3.4%
sqr-neg3.4%
remove-double-neg3.4%
sub-neg3.4%
clear-num3.4%
un-div-inv3.4%
clear-num3.4%
metadata-eval3.4%
pow-sqr3.4%
add-sqr-sqrt2.3%
sqrt-prod3.4%
Applied egg-rr69.3%
Taylor expanded in z around inf 69.3%
associate-/r/69.3%
/-rgt-identity69.3%
unpow269.3%
associate-*r*90.9%
Applied egg-rr90.9%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+276) (fma x x (* (- (* z z) t) (* y -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+276) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+276) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+276], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+276}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000001e276Initial program 96.3%
fma-neg98.1%
distribute-lft-neg-in98.1%
*-commutative98.1%
distribute-rgt-neg-in98.1%
metadata-eval98.1%
Simplified98.1%
if 5.00000000000000001e276 < (*.f64 z z) Initial program 69.3%
fma-neg69.3%
Applied egg-rr69.3%
fma-udef69.3%
unpow269.3%
sub-neg69.3%
flip--3.4%
pow-prod-up3.4%
metadata-eval3.4%
sqr-neg3.4%
remove-double-neg3.4%
sub-neg3.4%
clear-num3.4%
un-div-inv3.4%
clear-num3.4%
metadata-eval3.4%
pow-sqr3.4%
add-sqr-sqrt2.3%
sqrt-prod3.4%
Applied egg-rr69.3%
Taylor expanded in z around inf 69.3%
associate-/r/69.3%
/-rgt-identity69.3%
unpow269.3%
associate-*r*90.9%
Applied egg-rr90.9%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+276) (fma (* y 4.0) (- t (* z z)) (* x x)) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+276) {
tmp = fma((y * 4.0), (t - (z * z)), (x * x));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+276) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+276], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+276}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000001e276Initial program 96.3%
cancel-sign-sub-inv96.3%
distribute-lft-neg-out96.3%
+-commutative96.3%
distribute-lft-neg-out96.3%
distribute-lft-neg-in96.3%
distribute-rgt-neg-in96.3%
fma-def98.1%
sub-neg98.1%
+-commutative98.1%
distribute-neg-in98.1%
remove-double-neg98.1%
sub-neg98.1%
Simplified98.1%
if 5.00000000000000001e276 < (*.f64 z z) Initial program 69.3%
fma-neg69.3%
Applied egg-rr69.3%
fma-udef69.3%
unpow269.3%
sub-neg69.3%
flip--3.4%
pow-prod-up3.4%
metadata-eval3.4%
sqr-neg3.4%
remove-double-neg3.4%
sub-neg3.4%
clear-num3.4%
un-div-inv3.4%
clear-num3.4%
metadata-eval3.4%
pow-sqr3.4%
add-sqr-sqrt2.3%
sqrt-prod3.4%
Applied egg-rr69.3%
Taylor expanded in z around inf 69.3%
associate-/r/69.3%
/-rgt-identity69.3%
unpow269.3%
associate-*r*90.9%
Applied egg-rr90.9%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+276) (+ (* x x) (* (* 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) <= 5e+276) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (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) <= 5d+276) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) - (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) <= 5e+276) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+276: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+276) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) - 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) <= 5e+276) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) - (z * (z * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+276], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+276}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000001e276Initial program 96.3%
if 5.00000000000000001e276 < (*.f64 z z) Initial program 69.3%
fma-neg69.3%
Applied egg-rr69.3%
fma-udef69.3%
unpow269.3%
sub-neg69.3%
flip--3.4%
pow-prod-up3.4%
metadata-eval3.4%
sqr-neg3.4%
remove-double-neg3.4%
sub-neg3.4%
clear-num3.4%
un-div-inv3.4%
clear-num3.4%
metadata-eval3.4%
pow-sqr3.4%
add-sqr-sqrt2.3%
sqrt-prod3.4%
Applied egg-rr69.3%
Taylor expanded in z around inf 69.3%
associate-/r/69.3%
/-rgt-identity69.3%
unpow269.3%
associate-*r*90.9%
Applied egg-rr90.9%
Final simplification94.5%
(FPCore (x y z t) :precision binary64 (if (<= z 6e+15) (- (* x x) (* y (* t -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6e+15) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (x * x) - (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 <= 6d+15) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (x * x) - (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 <= 6e+15) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 6e+15: tmp = (x * x) - (y * (t * -4.0)) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 6e+15) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(x * x) - 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 <= 6e+15) tmp = (x * x) - (y * (t * -4.0)); else tmp = (x * x) - (z * (z * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 6e+15], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6 \cdot 10^{+15}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if z < 6e15Initial program 93.7%
Taylor expanded in z around 0 71.9%
*-commutative71.9%
*-commutative71.9%
associate-*l*71.3%
Simplified71.3%
if 6e15 < z Initial program 73.1%
fma-neg73.1%
Applied egg-rr73.1%
fma-udef73.1%
unpow273.1%
sub-neg73.1%
flip--22.0%
pow-prod-up22.0%
metadata-eval22.0%
sqr-neg22.0%
remove-double-neg22.0%
sub-neg22.0%
clear-num22.0%
un-div-inv22.0%
clear-num22.0%
metadata-eval22.0%
pow-sqr22.0%
add-sqr-sqrt11.0%
sqrt-prod19.5%
Applied egg-rr68.2%
Taylor expanded in z around inf 70.8%
associate-/r/70.8%
/-rgt-identity70.8%
unpow270.8%
associate-*r*88.0%
Applied egg-rr88.0%
Final simplification76.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* 4.0 (* y t)))) (if (<= x 5.7e+48) t_1 (- (* x x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 4.0 * (y * t);
double tmp;
if (x <= 5.7e+48) {
tmp = t_1;
} else {
tmp = (x * x) - t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = 4.0d0 * (y * t)
if (x <= 5.7d+48) then
tmp = t_1
else
tmp = (x * x) - t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 4.0 * (y * t);
double tmp;
if (x <= 5.7e+48) {
tmp = t_1;
} else {
tmp = (x * x) - t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 4.0 * (y * t) tmp = 0 if x <= 5.7e+48: tmp = t_1 else: tmp = (x * x) - t_1 return tmp
function code(x, y, z, t) t_1 = Float64(4.0 * Float64(y * t)) tmp = 0.0 if (x <= 5.7e+48) tmp = t_1; else tmp = Float64(Float64(x * x) - t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 4.0 * (y * t); tmp = 0.0; if (x <= 5.7e+48) tmp = t_1; else tmp = (x * x) - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5.7e+48], t$95$1, N[(N[(x * x), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 4 \cdot \left(y \cdot t\right)\\
\mathbf{if}\;x \leq 5.7 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - t_1\\
\end{array}
\end{array}
if x < 5.69999999999999968e48Initial program 85.7%
Taylor expanded in t around inf 30.5%
*-commutative30.5%
Simplified30.5%
if 5.69999999999999968e48 < x Initial program 91.5%
fma-neg91.5%
Applied egg-rr91.5%
fma-udef91.5%
unpow291.5%
sub-neg91.5%
flip--54.8%
pow-prod-up54.8%
metadata-eval54.8%
sqr-neg54.8%
remove-double-neg54.8%
sub-neg54.8%
clear-num54.8%
un-div-inv54.8%
clear-num54.8%
metadata-eval54.8%
pow-sqr54.8%
add-sqr-sqrt22.2%
sqrt-prod42.4%
Applied egg-rr84.7%
Taylor expanded in z around 0 73.2%
Final simplification40.3%
(FPCore (x y z t) :precision binary64 (- (* x x) (* y (* t -4.0))))
double code(double x, double y, double z, double t) {
return (x * x) - (y * (t * -4.0));
}
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 * (t * (-4.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (y * (t * -4.0));
}
def code(x, y, z, t): return (x * x) - (y * (t * -4.0))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (y * (t * -4.0)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - y \cdot \left(t \cdot -4\right)
\end{array}
Initial program 87.0%
Taylor expanded in z around 0 58.7%
*-commutative58.7%
*-commutative58.7%
associate-*l*58.3%
Simplified58.3%
Final simplification58.3%
(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 87.0%
fma-neg87.1%
Applied egg-rr87.1%
fma-udef87.0%
unpow287.0%
sub-neg87.0%
flip--48.9%
pow-prod-up48.9%
metadata-eval48.9%
sqr-neg48.9%
remove-double-neg48.9%
sub-neg48.9%
clear-num48.9%
un-div-inv48.8%
clear-num48.8%
metadata-eval48.8%
pow-sqr48.8%
add-sqr-sqrt23.2%
sqrt-prod33.7%
Applied egg-rr66.8%
Taylor expanded in z around 0 39.4%
Taylor expanded in x around 0 6.1%
Final simplification6.1%
(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 87.0%
Taylor expanded in t around inf 26.7%
*-commutative26.7%
Simplified26.7%
Final simplification26.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 2023308
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))