
(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 6 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}
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(if (<= z_m 4.6e+154)
(fma x x (* (- (* z_m z_m) t) (* y -4.0)))
(if (<= z_m 7.5e+220)
(+ (* x x) (- (* y (* t 4.0)) (* z_m (/ (* y (* z_m (* t 4.0))) t))))
(* -4.0 (* t (* y (+ -1.0 (* z_m (/ z_m t)))))))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 4.6e+154) {
tmp = fma(x, x, (((z_m * z_m) - t) * (y * -4.0)));
} else if (z_m <= 7.5e+220) {
tmp = (x * x) + ((y * (t * 4.0)) - (z_m * ((y * (z_m * (t * 4.0))) / t)));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 4.6e+154) tmp = fma(x, x, Float64(Float64(Float64(z_m * z_m) - t) * Float64(y * -4.0))); elseif (z_m <= 7.5e+220) tmp = Float64(Float64(x * x) + Float64(Float64(y * Float64(t * 4.0)) - Float64(z_m * Float64(Float64(y * Float64(z_m * Float64(t * 4.0))) / t)))); else tmp = Float64(-4.0 * Float64(t * Float64(y * Float64(-1.0 + Float64(z_m * Float64(z_m / t)))))); end return tmp end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 4.6e+154], N[(x * x + N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 7.5e+220], N[(N[(x * x), $MachinePrecision] + N[(N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * N[(N[(y * N[(z$95$m * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * N[(y * N[(-1.0 + N[(z$95$m * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 4.6 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z\_m \cdot z\_m - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{elif}\;z\_m \leq 7.5 \cdot 10^{+220}:\\
\;\;\;\;x \cdot x + \left(y \cdot \left(t \cdot 4\right) - z\_m \cdot \frac{y \cdot \left(z\_m \cdot \left(t \cdot 4\right)\right)}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \left(y \cdot \left(-1 + z\_m \cdot \frac{z\_m}{t}\right)\right)\right)\\
\end{array}
\end{array}
if z < 4.6e154Initial program 95.6%
fmm-def96.9%
distribute-lft-neg-in96.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
metadata-eval96.9%
Simplified96.9%
if 4.6e154 < z < 7.5000000000000003e220Initial program 54.8%
Taylor expanded in t around inf 54.8%
unpow254.8%
associate-/l*54.8%
fmm-def54.8%
metadata-eval54.8%
Simplified54.8%
associate-*r*60.8%
*-commutative60.8%
associate-*r*60.8%
fma-undefine60.8%
distribute-lft-in60.8%
associate-*r*60.8%
*-commutative60.8%
associate-*l*60.8%
associate-*r*60.8%
*-commutative60.8%
associate-*l*60.8%
Applied egg-rr60.8%
associate-*r*73.2%
clear-num73.2%
un-div-inv73.1%
Applied egg-rr73.1%
associate-/r/86.8%
associate-*l*86.8%
Applied egg-rr86.8%
if 7.5000000000000003e220 < z Initial program 75.1%
Taylor expanded in t around inf 75.1%
unpow275.1%
associate-/l*75.1%
fmm-def75.1%
metadata-eval75.1%
Simplified75.1%
Taylor expanded in x around 0 85.7%
unpow285.7%
associate-*r/90.4%
*-commutative90.4%
Applied egg-rr90.4%
Final simplification95.9%
z_m = (fabs.f64 z)
(FPCore (x y z_m t)
:precision binary64
(if (<= z_m 1.85e+132)
(+ (* x x) (* (* y 4.0) (- t (* z_m z_m))))
(if (<= z_m 5e+220)
(+ (* x x) (- (* y (* t 4.0)) (* z_m (/ (* y (* z_m (* t 4.0))) t))))
(* -4.0 (* t (* y (+ -1.0 (* z_m (/ z_m t)))))))))z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.85e+132) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else if (z_m <= 5e+220) {
tmp = (x * x) + ((y * (t * 4.0)) - (z_m * ((y * (z_m * (t * 4.0))) / t)));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 1.85d+132) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
else if (z_m <= 5d+220) then
tmp = (x * x) + ((y * (t * 4.0d0)) - (z_m * ((y * (z_m * (t * 4.0d0))) / t)))
else
tmp = (-4.0d0) * (t * (y * ((-1.0d0) + (z_m * (z_m / t)))))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.85e+132) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else if (z_m <= 5e+220) {
tmp = (x * x) + ((y * (t * 4.0)) - (z_m * ((y * (z_m * (t * 4.0))) / t)));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if z_m <= 1.85e+132: tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))) elif z_m <= 5e+220: tmp = (x * x) + ((y * (t * 4.0)) - (z_m * ((y * (z_m * (t * 4.0))) / t))) else: tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t))))) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1.85e+132) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m)))); elseif (z_m <= 5e+220) tmp = Float64(Float64(x * x) + Float64(Float64(y * Float64(t * 4.0)) - Float64(z_m * Float64(Float64(y * Float64(z_m * Float64(t * 4.0))) / t)))); else tmp = Float64(-4.0 * Float64(t * Float64(y * Float64(-1.0 + Float64(z_m * Float64(z_m / t)))))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (z_m <= 1.85e+132) tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))); elseif (z_m <= 5e+220) tmp = (x * x) + ((y * (t * 4.0)) - (z_m * ((y * (z_m * (t * 4.0))) / t))); else tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t))))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.85e+132], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z$95$m, 5e+220], N[(N[(x * x), $MachinePrecision] + N[(N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision] - N[(z$95$m * N[(N[(y * N[(z$95$m * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * N[(y * N[(-1.0 + N[(z$95$m * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.85 \cdot 10^{+132}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{elif}\;z\_m \leq 5 \cdot 10^{+220}:\\
\;\;\;\;x \cdot x + \left(y \cdot \left(t \cdot 4\right) - z\_m \cdot \frac{y \cdot \left(z\_m \cdot \left(t \cdot 4\right)\right)}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \left(y \cdot \left(-1 + z\_m \cdot \frac{z\_m}{t}\right)\right)\right)\\
\end{array}
\end{array}
if z < 1.85000000000000005e132Initial program 95.5%
if 1.85000000000000005e132 < z < 5.0000000000000002e220Initial program 66.1%
Taylor expanded in t around inf 61.1%
unpow261.1%
associate-/l*61.1%
fmm-def61.1%
metadata-eval61.1%
Simplified61.1%
associate-*r*65.6%
*-commutative65.6%
associate-*r*65.6%
fma-undefine65.6%
distribute-lft-in65.6%
associate-*r*65.6%
*-commutative65.6%
associate-*l*65.6%
associate-*r*65.6%
*-commutative65.6%
associate-*l*65.6%
Applied egg-rr65.6%
associate-*r*74.9%
clear-num74.9%
un-div-inv74.8%
Applied egg-rr74.8%
associate-/r/90.1%
associate-*l*90.1%
Applied egg-rr90.1%
if 5.0000000000000002e220 < z Initial program 75.1%
Taylor expanded in t around inf 75.1%
unpow275.1%
associate-/l*75.1%
fmm-def75.1%
metadata-eval75.1%
Simplified75.1%
Taylor expanded in x around 0 85.7%
unpow285.7%
associate-*r/90.4%
*-commutative90.4%
Applied egg-rr90.4%
Final simplification94.7%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= (* (- (* z_m z_m) t) (* y 4.0)) 2e+295) (+ (* x x) (* (* y 4.0) (- t (* z_m z_m)))) (* -4.0 (* t (* y (+ -1.0 (* z_m (/ z_m t))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if ((((z_m * z_m) - t) * (y * 4.0)) <= 2e+295) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if ((((z_m * z_m) - t) * (y * 4.0d0)) <= 2d+295) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z_m * z_m)))
else
tmp = (-4.0d0) * (t * (y * ((-1.0d0) + (z_m * (z_m / t)))))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if ((((z_m * z_m) - t) * (y * 4.0)) <= 2e+295) {
tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m)));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if (((z_m * z_m) - t) * (y * 4.0)) <= 2e+295: tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))) else: tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t))))) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (Float64(Float64(Float64(z_m * z_m) - t) * Float64(y * 4.0)) <= 2e+295) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z_m * z_m)))); else tmp = Float64(-4.0 * Float64(t * Float64(y * Float64(-1.0 + Float64(z_m * Float64(z_m / t)))))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if ((((z_m * z_m) - t) * (y * 4.0)) <= 2e+295) tmp = (x * x) + ((y * 4.0) * (t - (z_m * z_m))); else tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t))))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[N[(N[(N[(z$95$m * z$95$m), $MachinePrecision] - t), $MachinePrecision] * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], 2e+295], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z$95$m * z$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * N[(y * N[(-1.0 + N[(z$95$m * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(z\_m \cdot z\_m - t\right) \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+295}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z\_m \cdot z\_m\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \left(y \cdot \left(-1 + z\_m \cdot \frac{z\_m}{t}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 2e295Initial program 96.8%
if 2e295 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) Initial program 67.4%
Taylor expanded in t around inf 67.4%
unpow267.4%
associate-/l*67.4%
fmm-def67.4%
metadata-eval67.4%
Simplified67.4%
Taylor expanded in x around 0 78.5%
unpow278.5%
associate-*r/82.4%
*-commutative82.4%
Applied egg-rr82.4%
Final simplification94.3%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (if (<= z_m 1.2e+75) (- (* x x) (* y (* t -4.0))) (* -4.0 (* t (* y (+ -1.0 (* z_m (/ z_m t))))))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.2e+75) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
real(8) :: tmp
if (z_m <= 1.2d+75) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (-4.0d0) * (t * (y * ((-1.0d0) + (z_m * (z_m / t)))))
end if
code = tmp
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
double tmp;
if (z_m <= 1.2e+75) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t)))));
}
return tmp;
}
z_m = math.fabs(z) def code(x, y, z_m, t): tmp = 0 if z_m <= 1.2e+75: tmp = (x * x) - (y * (t * -4.0)) else: tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t))))) return tmp
z_m = abs(z) function code(x, y, z_m, t) tmp = 0.0 if (z_m <= 1.2e+75) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(-4.0 * Float64(t * Float64(y * Float64(-1.0 + Float64(z_m * Float64(z_m / t)))))); end return tmp end
z_m = abs(z); function tmp_2 = code(x, y, z_m, t) tmp = 0.0; if (z_m <= 1.2e+75) tmp = (x * x) - (y * (t * -4.0)); else tmp = -4.0 * (t * (y * (-1.0 + (z_m * (z_m / t))))); end tmp_2 = tmp; end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := If[LessEqual[z$95$m, 1.2e+75], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(t * N[(y * N[(-1.0 + N[(z$95$m * N[(z$95$m / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z_m = \left|z\right|
\\
\begin{array}{l}
\mathbf{if}\;z\_m \leq 1.2 \cdot 10^{+75}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(t \cdot \left(y \cdot \left(-1 + z\_m \cdot \frac{z\_m}{t}\right)\right)\right)\\
\end{array}
\end{array}
if z < 1.2e75Initial program 95.2%
Taylor expanded in z around 0 74.2%
*-commutative74.2%
*-commutative74.2%
associate-*l*74.2%
Simplified74.2%
if 1.2e75 < z Initial program 78.3%
Taylor expanded in t around inf 71.0%
unpow271.0%
associate-/l*71.0%
fmm-def71.0%
metadata-eval71.0%
Simplified71.0%
Taylor expanded in x around 0 69.3%
unpow269.3%
associate-*r/72.7%
*-commutative72.7%
Applied egg-rr72.7%
Final simplification73.9%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (- (* x x) (* y (* t -4.0))))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return (x * x) - (y * (t * -4.0));
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = (x * x) - (y * (t * (-4.0d0)))
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return (x * x) - (y * (t * -4.0));
}
z_m = math.fabs(z) def code(x, y, z_m, t): return (x * x) - (y * (t * -4.0))
z_m = abs(z) function code(x, y, z_m, t) return Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = (x * x) - (y * (t * -4.0)); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
x \cdot x - y \cdot \left(t \cdot -4\right)
\end{array}
Initial program 91.7%
Taylor expanded in z around 0 66.5%
*-commutative66.5%
*-commutative66.5%
associate-*l*66.5%
Simplified66.5%
Final simplification66.5%
z_m = (fabs.f64 z) (FPCore (x y z_m t) :precision binary64 (* 4.0 (* t y)))
z_m = fabs(z);
double code(double x, double y, double z_m, double t) {
return 4.0 * (t * y);
}
z_m = abs(z)
real(8) function code(x, y, z_m, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z_m
real(8), intent (in) :: t
code = 4.0d0 * (t * y)
end function
z_m = Math.abs(z);
public static double code(double x, double y, double z_m, double t) {
return 4.0 * (t * y);
}
z_m = math.fabs(z) def code(x, y, z_m, t): return 4.0 * (t * y)
z_m = abs(z) function code(x, y, z_m, t) return Float64(4.0 * Float64(t * y)) end
z_m = abs(z); function tmp = code(x, y, z_m, t) tmp = 4.0 * (t * y); end
z_m = N[Abs[z], $MachinePrecision] code[x_, y_, z$95$m_, t_] := N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
z_m = \left|z\right|
\\
4 \cdot \left(t \cdot y\right)
\end{array}
Initial program 91.7%
Taylor expanded in t around inf 30.6%
*-commutative30.6%
Simplified30.6%
Final simplification30.6%
(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 2024076
(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))))