
(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) 2e+264) (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) <= 2e+264) {
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) <= 2e+264) tmp = fma(Float64(y * 4.0), Float64(t - Float64(z * z)), Float64(x * x)); else tmp = Float64(Float64(z * Float64(z * y)) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+264], N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+264}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot 4, t - z \cdot z, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 2.00000000000000009e264Initial program 95.5%
cancel-sign-sub-inv95.5%
distribute-lft-neg-out95.5%
+-commutative95.5%
distribute-lft-neg-out95.5%
distribute-lft-neg-in95.5%
distribute-rgt-neg-in95.5%
fma-define99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
sub-neg99.9%
Simplified99.9%
if 2.00000000000000009e264 < (*.f64 z z) Initial program 69.8%
Taylor expanded in z around 0 67.2%
Taylor expanded in z around inf 75.0%
*-commutative75.0%
Simplified75.0%
add-sqr-sqrt38.1%
pow238.1%
*-commutative38.1%
sqrt-prod38.1%
sqrt-pow144.1%
metadata-eval44.1%
pow144.1%
Applied egg-rr44.1%
unpow244.1%
swap-sqr38.1%
add-sqr-sqrt75.0%
*-commutative75.0%
associate-*r*84.7%
Applied egg-rr84.7%
Final simplification95.4%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1e+305) (+ (* x x) (* t (* 4.0 (- y (/ (* z y) (/ t z)))))) (* t (- (/ (pow x 2.0) t) (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1e+305) {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
} else {
tmp = t * ((pow(x, 2.0) / 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 ((x * x) <= 1d+305) then
tmp = (x * x) + (t * (4.0d0 * (y - ((z * y) / (t / z)))))
else
tmp = t * (((x ** 2.0d0) / 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 ((x * x) <= 1e+305) {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
} else {
tmp = t * ((Math.pow(x, 2.0) / t) - (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1e+305: tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z))))) else: tmp = t * ((math.pow(x, 2.0) / t) - (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1e+305) tmp = Float64(Float64(x * x) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / z)))))); else tmp = Float64(t * Float64(Float64((x ^ 2.0) / t) - Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 1e+305) tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z))))); else tmp = t * (((x ^ 2.0) / t) - (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e+305], N[(N[(x * x), $MachinePrecision] + N[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(N[Power[x, 2.0], $MachinePrecision] / t), $MachinePrecision] - N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{+305}:\\
\;\;\;\;x \cdot x + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\frac{{x}^{2}}{t} - y \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 9.9999999999999994e304Initial program 93.8%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
*-commutative90.6%
*-commutative90.6%
metadata-eval90.6%
distribute-rgt-neg-in90.6%
distribute-lft-neg-in90.6%
distribute-rgt-out90.6%
unsub-neg90.6%
associate-/l*89.0%
Simplified89.0%
unpow289.0%
*-un-lft-identity89.0%
times-frac90.1%
Applied egg-rr90.1%
/-rgt-identity90.1%
associate-*r*94.2%
clear-num94.2%
un-div-inv94.2%
Applied egg-rr94.2%
if 9.9999999999999994e304 < (*.f64 x x) Initial program 72.6%
Taylor expanded in z around 0 84.9%
*-commutative84.9%
*-commutative84.9%
associate-*l*84.9%
Simplified84.9%
Taylor expanded in t around inf 94.5%
Final simplification94.3%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e-222)
(* x x)
(if (<= (* z z) 2e-58)
(* 4.0 (* y t))
(if (<= (* z z) 1e+147) (* x x) (* (* z (* z y)) -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-222) {
tmp = x * x;
} else if ((z * z) <= 2e-58) {
tmp = 4.0 * (y * t);
} else if ((z * z) <= 1e+147) {
tmp = x * x;
} 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) <= 5d-222) then
tmp = x * x
else if ((z * z) <= 2d-58) then
tmp = 4.0d0 * (y * t)
else if ((z * z) <= 1d+147) then
tmp = x * x
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) <= 5e-222) {
tmp = x * x;
} else if ((z * z) <= 2e-58) {
tmp = 4.0 * (y * t);
} else if ((z * z) <= 1e+147) {
tmp = x * x;
} else {
tmp = (z * (z * y)) * -4.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-222: tmp = x * x elif (z * z) <= 2e-58: tmp = 4.0 * (y * t) elif (z * z) <= 1e+147: tmp = x * x else: tmp = (z * (z * y)) * -4.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-222) tmp = Float64(x * x); elseif (Float64(z * z) <= 2e-58) tmp = Float64(4.0 * Float64(y * t)); elseif (Float64(z * z) <= 1e+147) tmp = Float64(x * x); else tmp = Float64(Float64(z * Float64(z * y)) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e-222) tmp = x * x; elseif ((z * z) <= 2e-58) tmp = 4.0 * (y * t); elseif ((z * z) <= 1e+147) tmp = x * x; else tmp = (z * (z * y)) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-222], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e-58], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+147], N[(x * x), $MachinePrecision], N[(N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-222}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{-58}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+147}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000008e-222 or 2.0000000000000001e-58 < (*.f64 z z) < 9.9999999999999998e146Initial program 97.1%
Taylor expanded in y around 0 97.1%
Simplified63.5%
--rgt-identity63.5%
Applied egg-rr63.5%
if 5.00000000000000008e-222 < (*.f64 z z) < 2.0000000000000001e-58Initial program 92.7%
fmm-def92.7%
distribute-lft-neg-in92.7%
*-commutative92.7%
distribute-rgt-neg-in92.7%
metadata-eval92.7%
Simplified92.7%
Taylor expanded in t around inf 59.8%
*-commutative59.8%
Simplified59.8%
if 9.9999999999999998e146 < (*.f64 z z) Initial program 76.6%
Taylor expanded in z around 0 71.1%
Taylor expanded in z around inf 70.4%
*-commutative70.4%
Simplified70.4%
add-sqr-sqrt35.5%
pow235.5%
*-commutative35.5%
sqrt-prod35.5%
sqrt-pow139.8%
metadata-eval39.8%
pow139.8%
Applied egg-rr39.8%
unpow239.8%
swap-sqr35.6%
add-sqr-sqrt70.4%
*-commutative70.4%
associate-*r*77.2%
Applied egg-rr77.2%
Final simplification68.7%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 4e-221)
(* x x)
(if (<= (* z z) 1.8e-58)
(* 4.0 (* y t))
(if (<= (* z z) 1.45e+147) (* x x) (* -4.0 (* (* z z) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e-221) {
tmp = x * x;
} else if ((z * z) <= 1.8e-58) {
tmp = 4.0 * (y * t);
} else if ((z * z) <= 1.45e+147) {
tmp = x * x;
} else {
tmp = -4.0 * ((z * z) * 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) <= 4d-221) then
tmp = x * x
else if ((z * z) <= 1.8d-58) then
tmp = 4.0d0 * (y * t)
else if ((z * z) <= 1.45d+147) then
tmp = x * x
else
tmp = (-4.0d0) * ((z * z) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e-221) {
tmp = x * x;
} else if ((z * z) <= 1.8e-58) {
tmp = 4.0 * (y * t);
} else if ((z * z) <= 1.45e+147) {
tmp = x * x;
} else {
tmp = -4.0 * ((z * z) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 4e-221: tmp = x * x elif (z * z) <= 1.8e-58: tmp = 4.0 * (y * t) elif (z * z) <= 1.45e+147: tmp = x * x else: tmp = -4.0 * ((z * z) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e-221) tmp = Float64(x * x); elseif (Float64(z * z) <= 1.8e-58) tmp = Float64(4.0 * Float64(y * t)); elseif (Float64(z * z) <= 1.45e+147) tmp = Float64(x * x); else tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 4e-221) tmp = x * x; elseif ((z * z) <= 1.8e-58) tmp = 4.0 * (y * t); elseif ((z * z) <= 1.45e+147) tmp = x * x; else tmp = -4.0 * ((z * z) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e-221], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.8e-58], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.45e+147], N[(x * x), $MachinePrecision], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{-221}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 1.8 \cdot 10^{-58}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \cdot z \leq 1.45 \cdot 10^{+147}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.00000000000000007e-221 or 1.80000000000000005e-58 < (*.f64 z z) < 1.4499999999999999e147Initial program 97.1%
Taylor expanded in y around 0 97.1%
Simplified63.5%
--rgt-identity63.5%
Applied egg-rr63.5%
if 4.00000000000000007e-221 < (*.f64 z z) < 1.80000000000000005e-58Initial program 92.7%
fmm-def92.7%
distribute-lft-neg-in92.7%
*-commutative92.7%
distribute-rgt-neg-in92.7%
metadata-eval92.7%
Simplified92.7%
Taylor expanded in t around inf 59.8%
*-commutative59.8%
Simplified59.8%
if 1.4499999999999999e147 < (*.f64 z z) Initial program 76.6%
Taylor expanded in z around 0 71.1%
Taylor expanded in z around inf 70.4%
*-commutative70.4%
Simplified70.4%
unpow270.4%
Applied egg-rr70.4%
Final simplification65.8%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5e+305) (+ (* x x) (* t (* 4.0 (- y (/ (* z y) (/ t z)))))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5e+305) {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / 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+305) then
tmp = (x * x) + (t * (4.0d0 * (y - ((z * y) / (t / 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+305) {
tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z)))));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5e+305: tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z))))) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5e+305) tmp = Float64(Float64(x * x) + Float64(t * Float64(4.0 * Float64(y - Float64(Float64(z * y) / Float64(t / 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+305) tmp = (x * x) + (t * (4.0 * (y - ((z * y) / (t / z))))); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+305], N[(N[(x * x), $MachinePrecision] + N[(t * N[(4.0 * N[(y - N[(N[(z * y), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+305}:\\
\;\;\;\;x \cdot x + t \cdot \left(4 \cdot \left(y - \frac{z \cdot y}{\frac{t}{z}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.00000000000000009e305Initial program 93.9%
Taylor expanded in t around inf 90.7%
+-commutative90.7%
*-commutative90.7%
*-commutative90.7%
metadata-eval90.7%
distribute-rgt-neg-in90.7%
distribute-lft-neg-in90.7%
distribute-rgt-out90.7%
unsub-neg90.7%
associate-/l*89.1%
Simplified89.1%
unpow289.1%
*-un-lft-identity89.1%
times-frac90.1%
Applied egg-rr90.1%
/-rgt-identity90.1%
associate-*r*94.3%
clear-num94.3%
un-div-inv94.3%
Applied egg-rr94.3%
if 5.00000000000000009e305 < (*.f64 x x) Initial program 72.2%
Taylor expanded in y around 0 72.2%
Simplified94.4%
--rgt-identity94.4%
Applied egg-rr94.4%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) INFINITY) (+ (* 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) <= ((double) INFINITY)) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = x * x;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= Double.POSITIVE_INFINITY) {
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) <= math.inf: 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) <= Inf) 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) <= Inf) 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], Infinity], 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 \infty:\\
\;\;\;\;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) < +inf.0Initial program 87.8%
if +inf.0 < (*.f64 x x) Initial program 87.8%
Taylor expanded in y around 0 87.8%
Simplified43.4%
--rgt-identity43.4%
Applied egg-rr43.4%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+147) (- (* 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 * z) <= 1e+147) {
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 * z) <= 1d+147) 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 * z) <= 1e+147) {
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 * z) <= 1e+147: 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 (Float64(z * z) <= 1e+147) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(z * Float64(z * y)) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 1e+147) 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[N[(z * z), $MachinePrecision], 1e+147], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+147}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \left(z \cdot y\right)\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 9.9999999999999998e146Initial program 95.9%
Taylor expanded in z around 0 88.1%
*-commutative88.1%
*-commutative88.1%
associate-*l*88.1%
Simplified88.1%
if 9.9999999999999998e146 < (*.f64 z z) Initial program 76.6%
Taylor expanded in z around 0 71.1%
Taylor expanded in z around inf 70.4%
*-commutative70.4%
Simplified70.4%
add-sqr-sqrt35.5%
pow235.5%
*-commutative35.5%
sqrt-prod35.5%
sqrt-pow139.8%
metadata-eval39.8%
pow139.8%
Applied egg-rr39.8%
unpow239.8%
swap-sqr35.6%
add-sqr-sqrt70.4%
*-commutative70.4%
associate-*r*77.2%
Applied egg-rr77.2%
Final simplification83.5%
(FPCore (x y z t) :precision binary64 (if (<= x 3.5e+48) (* 4.0 (* y t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 3.5e+48) {
tmp = 4.0 * (y * t);
} 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 <= 3.5d+48) then
tmp = 4.0d0 * (y * t)
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 <= 3.5e+48) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 3.5e+48: tmp = 4.0 * (y * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 3.5e+48) tmp = Float64(4.0 * Float64(y * t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 3.5e+48) tmp = 4.0 * (y * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 3.5e+48], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.5 \cdot 10^{+48}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 3.4999999999999997e48Initial program 88.8%
fmm-def90.3%
distribute-lft-neg-in90.3%
*-commutative90.3%
distribute-rgt-neg-in90.3%
metadata-eval90.3%
Simplified90.3%
Taylor expanded in t around inf 33.2%
*-commutative33.2%
Simplified33.2%
if 3.4999999999999997e48 < x Initial program 83.0%
Taylor expanded in y around 0 83.0%
Simplified78.2%
--rgt-identity78.2%
Applied egg-rr78.2%
(FPCore (x y z t) :precision binary64 (* x x))
double code(double x, double y, double z, double t) {
return x * x;
}
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
end function
public static double code(double x, double y, double z, double t) {
return x * x;
}
def code(x, y, z, t): return x * x
function code(x, y, z, t) return Float64(x * x) end
function tmp = code(x, y, z, t) tmp = x * x; end
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x
\end{array}
Initial program 87.8%
Taylor expanded in y around 0 87.8%
Simplified43.4%
--rgt-identity43.4%
Applied egg-rr43.4%
(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 2024165
(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))))