
(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+251) (fma (* y 4.0) (fma z (- z) t) (* x x)) (/ (* y (* z -4.0)) (/ 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+251) {
tmp = fma((y * 4.0), fma(z, -z, t), (x * x));
} else {
tmp = (y * (z * -4.0)) / (1.0 / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+251) tmp = fma(Float64(y * 4.0), fma(z, Float64(-z), t), Float64(x * x)); else tmp = Float64(Float64(y * Float64(z * -4.0)) / Float64(1.0 / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+251], N[(N[(y * 4.0), $MachinePrecision] * N[(z * (-z) + t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, \mathsf{fma}\left(z, -z, t\right), x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot -4\right)}{\frac{1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e251Initial program 97.3%
cancel-sign-sub-inv97.3%
distribute-lft-neg-out97.3%
+-commutative97.3%
distribute-lft-neg-out97.3%
distribute-lft-neg-in97.3%
distribute-rgt-neg-in97.3%
fma-define99.4%
neg-sub099.4%
associate-+l-99.4%
neg-sub099.4%
distribute-rgt-neg-out99.4%
fma-define99.4%
Simplified99.4%
if 2.0000000000000001e251 < (*.f64 z z) Initial program 65.0%
fmm-def78.5%
distribute-lft-neg-in78.5%
*-commutative78.5%
distribute-rgt-neg-in78.5%
metadata-eval78.5%
Simplified78.5%
Taylor expanded in z around inf 78.5%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow278.5%
/-rgt-identity78.5%
clear-num78.4%
un-div-inv78.4%
Applied egg-rr78.4%
associate-*l/88.1%
*-commutative88.1%
associate-*r*88.1%
Applied egg-rr88.1%
Final simplification96.5%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+251) (fma (* y 4.0) (- t (* z z)) (* x x)) (/ (* y (* z -4.0)) (/ 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+251) {
tmp = fma((y * 4.0), (t - (z * z)), (x * x));
} else {
tmp = (y * (z * -4.0)) / (1.0 / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+251) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(Float64(y * Float64(z * -4.0)) / Float64(1.0 / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+251], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot -4\right)}{\frac{1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e251Initial program 97.3%
cancel-sign-sub-inv97.3%
distribute-lft-neg-out97.3%
+-commutative97.3%
distribute-lft-neg-out97.3%
distribute-lft-neg-in97.3%
distribute-rgt-neg-in97.3%
fma-define99.4%
sub-neg99.4%
+-commutative99.4%
distribute-neg-in99.4%
remove-double-neg99.4%
sub-neg99.4%
Simplified99.4%
if 2.0000000000000001e251 < (*.f64 z z) Initial program 65.0%
fmm-def78.5%
distribute-lft-neg-in78.5%
*-commutative78.5%
distribute-rgt-neg-in78.5%
metadata-eval78.5%
Simplified78.5%
Taylor expanded in z around inf 78.5%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow278.5%
/-rgt-identity78.5%
clear-num78.4%
un-div-inv78.4%
Applied egg-rr78.4%
associate-*l/88.1%
*-commutative88.1%
associate-*r*88.1%
Applied egg-rr88.1%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+251) (fma x x (* (- (* z z) t) (* y -4.0))) (/ (* y (* z -4.0)) (/ 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+251) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (y * (z * -4.0)) / (1.0 / z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+251) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(y * Float64(z * -4.0)) / Float64(1.0 / z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+251], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot -4\right)}{\frac{1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e251Initial program 97.3%
fmm-def97.8%
distribute-lft-neg-in97.8%
*-commutative97.8%
distribute-rgt-neg-in97.8%
metadata-eval97.8%
Simplified97.8%
if 2.0000000000000001e251 < (*.f64 z z) Initial program 65.0%
fmm-def78.5%
distribute-lft-neg-in78.5%
*-commutative78.5%
distribute-rgt-neg-in78.5%
metadata-eval78.5%
Simplified78.5%
Taylor expanded in z around inf 78.5%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow278.5%
/-rgt-identity78.5%
clear-num78.4%
un-div-inv78.4%
Applied egg-rr78.4%
associate-*l/88.1%
*-commutative88.1%
associate-*r*88.1%
Applied egg-rr88.1%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+251) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (/ (* y (* z -4.0)) (/ 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+251) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (y * (z * -4.0)) / (1.0 / 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+251) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (y * (z * (-4.0d0))) / (1.0d0 / 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+251) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (y * (z * -4.0)) / (1.0 / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+251: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (y * (z * -4.0)) / (1.0 / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+251) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(y * Float64(z * -4.0)) / Float64(1.0 / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 2e+251) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (y * (z * -4.0)) / (1.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+251], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+251}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot -4\right)}{\frac{1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e251Initial program 97.3%
if 2.0000000000000001e251 < (*.f64 z z) Initial program 65.0%
fmm-def78.5%
distribute-lft-neg-in78.5%
*-commutative78.5%
distribute-rgt-neg-in78.5%
metadata-eval78.5%
Simplified78.5%
Taylor expanded in z around inf 78.5%
associate-*r*78.5%
*-commutative78.5%
*-commutative78.5%
Simplified78.5%
unpow278.5%
/-rgt-identity78.5%
clear-num78.4%
un-div-inv78.4%
Applied egg-rr78.4%
associate-*l/88.1%
*-commutative88.1%
associate-*r*88.1%
Applied egg-rr88.1%
Final simplification94.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+200) (- (* x x) (* y (* t -4.0))) (/ (* y (* z -4.0)) (/ 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+200) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (y * (z * -4.0)) / (1.0 / 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) <= 5d+200) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (y * (z * (-4.0d0))) / (1.0d0 / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+200) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (y * (z * -4.0)) / (1.0 / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+200: tmp = (x * x) - (y * (t * -4.0)) else: tmp = (y * (z * -4.0)) / (1.0 / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+200) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(y * Float64(z * -4.0)) / Float64(1.0 / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+200) tmp = (x * x) - (y * (t * -4.0)); else tmp = (y * (z * -4.0)) / (1.0 / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+200], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision] / N[(1.0 / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+200}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(z \cdot -4\right)}{\frac{1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000019e200Initial program 97.2%
Taylor expanded in z around 0 84.3%
*-commutative84.3%
*-commutative84.3%
associate-*l*83.7%
Simplified83.7%
if 5.00000000000000019e200 < (*.f64 z z) Initial program 67.9%
fmm-def80.2%
distribute-lft-neg-in80.2%
*-commutative80.2%
distribute-rgt-neg-in80.2%
metadata-eval80.2%
Simplified80.2%
Taylor expanded in z around inf 78.8%
associate-*r*78.8%
*-commutative78.8%
*-commutative78.8%
Simplified78.8%
unpow278.8%
/-rgt-identity78.8%
clear-num78.8%
un-div-inv78.8%
Applied egg-rr78.8%
associate-*l/87.6%
*-commutative87.6%
associate-*r*87.6%
Applied egg-rr87.6%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (<= z 2.35e+101) (- (* x x) (* y (* t -4.0))) (* (* z z) (* y -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.35e+101) {
tmp = (x * x) - (y * (t * -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 <= 2.35d+101) then
tmp = (x * x) - (y * (t * (-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 <= 2.35e+101) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (z * z) * (y * -4.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 2.35e+101: tmp = (x * x) - (y * (t * -4.0)) else: tmp = (z * z) * (y * -4.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 2.35e+101) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(z * z) * Float64(y * -4.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 2.35e+101) tmp = (x * x) - (y * (t * -4.0)); else tmp = (z * z) * (y * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.35e+101], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.35 \cdot 10^{+101}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if z < 2.34999999999999985e101Initial program 91.4%
Taylor expanded in z around 0 76.1%
*-commutative76.1%
*-commutative76.1%
associate-*l*75.6%
Simplified75.6%
if 2.34999999999999985e101 < z Initial program 74.3%
fmm-def84.8%
distribute-lft-neg-in84.8%
*-commutative84.8%
distribute-rgt-neg-in84.8%
metadata-eval84.8%
Simplified84.8%
Taylor expanded in z around inf 82.1%
associate-*r*82.1%
*-commutative82.1%
*-commutative82.1%
Simplified82.1%
unpow282.1%
Applied egg-rr82.1%
(FPCore (x y z t) :precision binary64 (if (<= z 1.2e-11) (* 4.0 (* y t)) (* (* z z) (* y -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.2e-11) {
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 <= 1.2d-11) 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 <= 1.2e-11) {
tmp = 4.0 * (y * t);
} else {
tmp = (z * z) * (y * -4.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.2e-11: 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 <= 1.2e-11) tmp = Float64(4.0 * Float64(y * t)); else tmp = Float64(Float64(z * z) * Float64(y * -4.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.2e-11) 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, 1.2e-11], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(N[(z * z), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.2 \cdot 10^{-11}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(y \cdot -4\right)\\
\end{array}
\end{array}
if z < 1.2000000000000001e-11Initial program 90.3%
fmm-def93.4%
distribute-lft-neg-in93.4%
*-commutative93.4%
distribute-rgt-neg-in93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in t around inf 41.0%
*-commutative41.0%
Simplified41.0%
if 1.2000000000000001e-11 < z Initial program 84.4%
fmm-def90.8%
distribute-lft-neg-in90.8%
*-commutative90.8%
distribute-rgt-neg-in90.8%
metadata-eval90.8%
Simplified90.8%
Taylor expanded in z around inf 64.7%
associate-*r*64.7%
*-commutative64.7%
*-commutative64.7%
Simplified64.7%
unpow264.7%
Applied egg-rr64.7%
(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 88.9%
fmm-def92.8%
distribute-lft-neg-in92.8%
*-commutative92.8%
distribute-rgt-neg-in92.8%
metadata-eval92.8%
Simplified92.8%
Taylor expanded in t around inf 35.0%
*-commutative35.0%
Simplified35.0%
(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 2024191
(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))))