
(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}
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+300) (fma x x (* (- (* z z) t) (* y -4.0))) (+ (* x x) (- (* t (* 4.0 (* (* z (* z y)) (/ -1.0 t)))) (* t (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+300) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) + ((t * (4.0 * ((z * (z * y)) * (-1.0 / t)))) - (t * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+300) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) + Float64(Float64(t * Float64(4.0 * Float64(Float64(z * Float64(z * y)) * Float64(-1.0 / t)))) - Float64(t * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+300], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(N[(t * N[(4.0 * N[(N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(t \cdot \left(4 \cdot \left(\left(z \cdot \left(z \cdot y\right)\right) \cdot \frac{-1}{t}\right)\right) - t \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e300Initial program 96.8%
fma-neg98.4%
distribute-lft-neg-in98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
metadata-eval98.4%
Simplified98.4%
if 2.0000000000000001e300 < (*.f64 z z) Initial program 67.3%
Taylor expanded in t around inf 67.3%
+-commutative67.3%
fma-define67.3%
associate-/l*67.3%
*-commutative67.3%
Simplified67.3%
add-sqr-sqrt20.4%
sqrt-prod15.7%
sqr-neg15.7%
sqrt-unprod0.0%
add-sqr-sqrt7.7%
fma-undefine7.7%
distribute-rgt-in7.7%
clear-num7.7%
un-div-inv7.7%
add-sqr-sqrt0.0%
sqrt-unprod15.7%
sqr-neg15.7%
sqrt-prod20.4%
add-sqr-sqrt64.3%
*-commutative64.3%
add-sqr-sqrt43.8%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-prod17.4%
add-sqr-sqrt64.3%
add-sqr-sqrt41.9%
sqrt-unprod59.7%
Applied egg-rr64.3%
div-inv64.3%
clear-num64.3%
unpow264.3%
associate-*r/71.6%
/-rgt-identity71.6%
/-rgt-identity71.6%
associate-*r*80.2%
div-inv80.2%
associate-*r*81.6%
Applied egg-rr81.6%
Final simplification94.1%
(FPCore (x y z t) :precision binary64 (if (<= x 1.45e+150) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (fma x x (* t (* y 4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.45e+150) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = fma(x, x, (t * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (x <= 1.45e+150) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = fma(x, x, Float64(t * Float64(y * 4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.45e+150], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+150}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, t \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if x < 1.45000000000000005e150Initial program 91.3%
if 1.45000000000000005e150 < x Initial program 75.8%
fma-neg81.8%
distribute-lft-neg-in81.8%
*-commutative81.8%
distribute-rgt-neg-in81.8%
metadata-eval81.8%
Simplified81.8%
Taylor expanded in z around 0 97.0%
neg-mul-197.0%
Simplified97.0%
add-exp-log93.2%
add-sqr-sqrt36.0%
sqrt-unprod78.5%
sqr-neg78.5%
sqrt-prod57.2%
add-sqr-sqrt93.2%
add-sqr-sqrt48.1%
sqrt-unprod93.2%
swap-sqr93.2%
metadata-eval93.2%
metadata-eval93.2%
swap-sqr93.2%
sqrt-unprod45.1%
add-sqr-sqrt93.2%
Applied egg-rr93.2%
rem-exp-log97.0%
Applied egg-rr97.0%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+284) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (+ (* x x) (- (* t (* 4.0 (* (* z (* z y)) (/ -1.0 t)))) (* t (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+284) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + ((t * (4.0 * ((z * (z * y)) * (-1.0 / t)))) - (t * (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+284) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) + ((t * (4.0d0 * ((z * (z * y)) * ((-1.0d0) / t)))) - (t * (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+284) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + ((t * (4.0 * ((z * (z * y)) * (-1.0 / t)))) - (t * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+284: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) + ((t * (4.0 * ((z * (z * y)) * (-1.0 / t)))) - (t * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+284) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) + Float64(Float64(t * Float64(4.0 * Float64(Float64(z * Float64(z * y)) * Float64(-1.0 / t)))) - Float64(t * Float64(y * 4.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+284) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) + ((t * (4.0 * ((z * (z * y)) * (-1.0 / t)))) - (t * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+284], 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[(N[(t * N[(4.0 * N[(N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+284}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \left(t \cdot \left(4 \cdot \left(\left(z \cdot \left(z \cdot y\right)\right) \cdot \frac{-1}{t}\right)\right) - t \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999999e284Initial program 97.2%
if 4.9999999999999999e284 < (*.f64 z z) Initial program 67.8%
Taylor expanded in t around inf 67.8%
+-commutative67.8%
fma-define67.8%
associate-/l*67.8%
*-commutative67.8%
Simplified67.8%
add-sqr-sqrt19.2%
sqrt-prod14.8%
sqr-neg14.8%
sqrt-unprod0.0%
add-sqr-sqrt8.7%
fma-undefine8.7%
distribute-rgt-in8.7%
clear-num8.7%
un-div-inv8.7%
add-sqr-sqrt0.0%
sqrt-unprod14.8%
sqr-neg14.8%
sqrt-prod19.2%
add-sqr-sqrt64.9%
*-commutative64.9%
add-sqr-sqrt45.6%
sqrt-unprod53.0%
sqr-neg53.0%
sqrt-prod16.4%
add-sqr-sqrt64.9%
add-sqr-sqrt40.9%
sqrt-unprod59.1%
Applied egg-rr64.9%
div-inv64.9%
clear-num64.9%
unpow264.9%
associate-*r/71.8%
/-rgt-identity71.8%
/-rgt-identity71.8%
associate-*r*79.9%
div-inv79.8%
associate-*r*81.3%
Applied egg-rr81.3%
Final simplification92.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+284) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (- (* x x) (+ (* t (* y 4.0)) (* t (* 4.0 (* (* z y) (/ z t))))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+284) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - ((t * (y * 4.0)) + (t * (4.0 * ((z * y) * (z / t)))));
}
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+284) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) - ((t * (y * 4.0d0)) + (t * (4.0d0 * ((z * y) * (z / t)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+284) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - ((t * (y * 4.0)) + (t * (4.0 * ((z * y) * (z / t)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+284: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) - ((t * (y * 4.0)) + (t * (4.0 * ((z * y) * (z / t))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+284) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) - Float64(Float64(t * Float64(y * 4.0)) + Float64(t * Float64(4.0 * Float64(Float64(z * y) * Float64(z / t)))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+284) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) - ((t * (y * 4.0)) + (t * (4.0 * ((z * y) * (z / t))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+284], 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[(N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision] + N[(t * N[(4.0 * N[(N[(z * y), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+284}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - \left(t \cdot \left(y \cdot 4\right) + t \cdot \left(4 \cdot \left(\left(z \cdot y\right) \cdot \frac{z}{t}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999999e284Initial program 97.2%
if 4.9999999999999999e284 < (*.f64 z z) Initial program 67.8%
Taylor expanded in t around inf 67.8%
+-commutative67.8%
fma-define67.8%
associate-/l*67.8%
*-commutative67.8%
Simplified67.8%
add-sqr-sqrt19.2%
sqrt-prod14.8%
sqr-neg14.8%
sqrt-unprod0.0%
add-sqr-sqrt8.7%
fma-undefine8.7%
distribute-rgt-in8.7%
clear-num8.7%
un-div-inv8.7%
add-sqr-sqrt0.0%
sqrt-unprod14.8%
sqr-neg14.8%
sqrt-prod19.2%
add-sqr-sqrt64.9%
*-commutative64.9%
add-sqr-sqrt45.6%
sqrt-unprod53.0%
sqr-neg53.0%
sqrt-prod16.4%
add-sqr-sqrt64.9%
add-sqr-sqrt40.9%
sqrt-unprod59.1%
Applied egg-rr64.9%
div-inv64.9%
clear-num64.9%
unpow264.9%
associate-*r/71.8%
/-rgt-identity71.8%
/-rgt-identity71.8%
associate-*r*79.9%
Applied egg-rr79.9%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5e+294) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5e+294) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} 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+294) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
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+294) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5e+294: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5e+294) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 5e+294) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+294], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+294}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 4.9999999999999999e294Initial program 93.5%
if 4.9999999999999999e294 < (*.f64 x x) Initial program 76.9%
Taylor expanded in y around 0 76.9%
Simplified89.2%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1e+29) (* 4.0 (* t y)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1e+29) {
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) <= 1d+29) 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) <= 1e+29) {
tmp = 4.0 * (t * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1e+29: tmp = 4.0 * (t * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1e+29) tmp = Float64(4.0 * Float64(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) <= 1e+29) 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], 1e+29], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{+29}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 9.99999999999999914e28Initial program 91.5%
Taylor expanded in t around inf 47.5%
*-commutative47.5%
Simplified47.5%
if 9.99999999999999914e28 < (*.f64 x x) Initial program 86.9%
Taylor expanded in y around 0 86.9%
Simplified72.5%
Final simplification59.4%
(FPCore (x y z t) :precision binary64 (- (* x x) (* -4.0 (* t y))))
double code(double x, double y, double z, double t) {
return (x * x) - (-4.0 * (t * y));
}
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) * (t * y))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (-4.0 * (t * y));
}
def code(x, y, z, t): return (x * x) - (-4.0 * (t * y))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(-4.0 * Float64(t * y))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (-4.0 * (t * y)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - -4 \cdot \left(t \cdot y\right)
\end{array}
Initial program 89.3%
Taylor expanded in z around 0 65.6%
*-commutative65.6%
Simplified65.6%
Final simplification65.6%
(FPCore (x y z t) :precision binary64 (* 4.0 (* t y)))
double code(double x, double y, double z, double t) {
return 4.0 * (t * y);
}
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 * (t * y)
end function
public static double code(double x, double y, double z, double t) {
return 4.0 * (t * y);
}
def code(x, y, z, t): return 4.0 * (t * y)
function code(x, y, z, t) return Float64(4.0 * Float64(t * y)) end
function tmp = code(x, y, z, t) tmp = 4.0 * (t * y); end
code[x_, y_, z_, t_] := N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
4 \cdot \left(t \cdot y\right)
\end{array}
Initial program 89.3%
Taylor expanded in t around inf 31.3%
*-commutative31.3%
Simplified31.3%
Final simplification31.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 2024100
(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))))