
(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 10 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) 1e+263) (fma (* (- (* z z) t) -4.0) y (* x x)) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+263) {
tmp = fma((((z * z) - t) * -4.0), y, (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) <= 1e+263) tmp = fma(Float64(Float64(Float64(z * z) - t) * -4.0), y, 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], 1e+263], N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * -4.0), $MachinePrecision] * y + 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 10^{+263}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z - t\right) \cdot -4, y, 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) < 1.00000000000000002e263Initial program 97.7%
sub-neg97.7%
+-commutative97.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
metadata-eval97.7%
associate-*r*97.7%
fma-def99.4%
Applied egg-rr99.4%
if 1.00000000000000002e263 < (*.f64 z z) Initial program 67.3%
Taylor expanded in z around inf 67.3%
*-commutative67.3%
unpow267.3%
*-commutative67.3%
associate-*r*67.3%
associate-*l*93.2%
*-commutative93.2%
Simplified93.2%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 5e+305)
(fma x x (* t_1 (* -4.0 y)))
(- (* x x) (* z (* z (* y 4.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= 5e+305) {
tmp = fma(x, x, (t_1 * (-4.0 * y)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= 5e+305) tmp = fma(x, x, Float64(t_1 * Float64(-4.0 * y))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+305], N[(x * x + N[(t$95$1 * N[(-4.0 * y), $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}
t_1 := z \cdot z - t\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(x, x, t_1 \cdot \left(-4 \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < 5.00000000000000009e305Initial program 98.3%
fma-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
distribute-rgt-neg-in98.8%
metadata-eval98.8%
Simplified98.8%
if 5.00000000000000009e305 < (-.f64 (*.f64 z z) t) Initial program 60.8%
Taylor expanded in z around inf 60.8%
*-commutative60.8%
unpow260.8%
*-commutative60.8%
associate-*r*60.8%
associate-*l*90.6%
*-commutative90.6%
Simplified90.6%
Final simplification96.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* t (* -4.0 y)))))
(if (<= (* z z) 5e-8)
t_1
(if (<= (* z z) 2e+230)
(* (- (* z z) t) (* -4.0 y))
(if (<= (* z z) 5e+265) t_1 (* z (* y (* z -4.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (t * (-4.0 * y));
double tmp;
if ((z * z) <= 5e-8) {
tmp = t_1;
} else if ((z * z) <= 2e+230) {
tmp = ((z * z) - t) * (-4.0 * y);
} else if ((z * z) <= 5e+265) {
tmp = t_1;
} else {
tmp = z * (y * (z * -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) :: t_1
real(8) :: tmp
t_1 = (x * x) - (t * ((-4.0d0) * y))
if ((z * z) <= 5d-8) then
tmp = t_1
else if ((z * z) <= 2d+230) then
tmp = ((z * z) - t) * ((-4.0d0) * y)
else if ((z * z) <= 5d+265) then
tmp = t_1
else
tmp = z * (y * (z * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (t * (-4.0 * y));
double tmp;
if ((z * z) <= 5e-8) {
tmp = t_1;
} else if ((z * z) <= 2e+230) {
tmp = ((z * z) - t) * (-4.0 * y);
} else if ((z * z) <= 5e+265) {
tmp = t_1;
} else {
tmp = z * (y * (z * -4.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * x) - (t * (-4.0 * y)) tmp = 0 if (z * z) <= 5e-8: tmp = t_1 elif (z * z) <= 2e+230: tmp = ((z * z) - t) * (-4.0 * y) elif (z * z) <= 5e+265: tmp = t_1 else: tmp = z * (y * (z * -4.0)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(t * Float64(-4.0 * y))) tmp = 0.0 if (Float64(z * z) <= 5e-8) tmp = t_1; elseif (Float64(z * z) <= 2e+230) tmp = Float64(Float64(Float64(z * z) - t) * Float64(-4.0 * y)); elseif (Float64(z * z) <= 5e+265) tmp = t_1; else tmp = Float64(z * Float64(y * Float64(z * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * x) - (t * (-4.0 * y)); tmp = 0.0; if ((z * z) <= 5e-8) tmp = t_1; elseif ((z * z) <= 2e+230) tmp = ((z * z) - t) * (-4.0 * y); elseif ((z * z) <= 5e+265) tmp = t_1; else tmp = z * (y * (z * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(t * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 5e-8], t$95$1, If[LessEqual[N[(z * z), $MachinePrecision], 2e+230], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+265], t$95$1, N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot x - t \cdot \left(-4 \cdot y\right)\\
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-8}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+230}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(-4 \cdot y\right)\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+265}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999998e-8 or 2.0000000000000002e230 < (*.f64 z z) < 5.0000000000000002e265Initial program 97.6%
Taylor expanded in z around 0 94.3%
associate-*r*94.3%
Simplified94.3%
if 4.9999999999999998e-8 < (*.f64 z z) < 2.0000000000000002e230Initial program 98.0%
Taylor expanded in x around 0 76.6%
*-commutative76.6%
*-commutative76.6%
unpow276.6%
*-commutative76.6%
associate-*l*76.6%
Simplified76.6%
if 5.0000000000000002e265 < (*.f64 z z) Initial program 66.9%
Taylor expanded in x around 0 71.1%
*-commutative71.1%
*-commutative71.1%
unpow271.1%
*-commutative71.1%
associate-*l*71.1%
Simplified71.1%
add-cbrt-cube64.6%
pow364.6%
*-commutative64.6%
Applied egg-rr64.6%
Taylor expanded in z around inf 64.6%
unpow264.6%
Simplified64.6%
rem-cbrt-cube71.1%
add-sqr-sqrt45.9%
pow245.9%
sqrt-unprod37.4%
*-commutative37.4%
*-commutative37.4%
swap-sqr37.4%
metadata-eval37.4%
metadata-eval37.4%
swap-sqr37.4%
sqrt-unprod5.9%
pow25.9%
*-commutative5.9%
sqrt-prod5.9%
metadata-eval5.9%
unpow-prod-down0.7%
unpow20.7%
*-commutative0.7%
associate-*r*0.7%
Applied egg-rr86.5%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (<= (- (* z z) t) 5e+305) (+ (* 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) - t) <= 5e+305) {
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) - t) <= 5d+305) 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) - t) <= 5e+305) {
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) - t) <= 5e+305: 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(Float64(z * z) - t) <= 5e+305) 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) - t) <= 5e+305) 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[(N[(z * z), $MachinePrecision] - t), $MachinePrecision], 5e+305], 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 - t \leq 5 \cdot 10^{+305}:\\
\;\;\;\;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 (*.f64 z z) t) < 5.00000000000000009e305Initial program 98.3%
if 5.00000000000000009e305 < (-.f64 (*.f64 z z) t) Initial program 60.8%
Taylor expanded in z around inf 60.8%
*-commutative60.8%
unpow260.8%
*-commutative60.8%
associate-*r*60.8%
associate-*l*90.6%
*-commutative90.6%
Simplified90.6%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-106) (- (* x x) (* t (* -4.0 y))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-106) {
tmp = (x * x) - (t * (-4.0 * y));
} 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-106) then
tmp = (x * x) - (t * ((-4.0d0) * y))
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-106) {
tmp = (x * x) - (t * (-4.0 * y));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-106: tmp = (x * x) - (t * (-4.0 * y)) 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-106) tmp = Float64(Float64(x * x) - Float64(t * Float64(-4.0 * y))); 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-106) tmp = (x * x) - (t * (-4.0 * y)); 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-106], N[(N[(x * x), $MachinePrecision] - N[(t * N[(-4.0 * y), $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^{-106}:\\
\;\;\;\;x \cdot x - t \cdot \left(-4 \cdot y\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) < 4.99999999999999983e-106Initial program 99.0%
Taylor expanded in z around 0 98.5%
associate-*r*98.5%
Simplified98.5%
if 4.99999999999999983e-106 < (*.f64 z z) Initial program 82.7%
Taylor expanded in z around inf 73.0%
*-commutative73.0%
unpow273.0%
*-commutative73.0%
associate-*r*73.0%
associate-*l*85.1%
*-commutative85.1%
Simplified85.1%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 8e-109) (* (* z z) (* -4.0 y)) (if (<= (* x x) 1.75e+67) (* y (* t 4.0)) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e-109) {
tmp = (z * z) * (-4.0 * y);
} else if ((x * x) <= 1.75e+67) {
tmp = y * (t * 4.0);
} 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) <= 8d-109) then
tmp = (z * z) * ((-4.0d0) * y)
else if ((x * x) <= 1.75d+67) then
tmp = y * (t * 4.0d0)
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) <= 8e-109) {
tmp = (z * z) * (-4.0 * y);
} else if ((x * x) <= 1.75e+67) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 8e-109: tmp = (z * z) * (-4.0 * y) elif (x * x) <= 1.75e+67: tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 8e-109) tmp = Float64(Float64(z * z) * Float64(-4.0 * y)); elseif (Float64(x * x) <= 1.75e+67) tmp = Float64(y * Float64(t * 4.0)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 8e-109) tmp = (z * z) * (-4.0 * y); elseif ((x * x) <= 1.75e+67) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8e-109], N[(N[(z * z), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 1.75e+67], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8 \cdot 10^{-109}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)\\
\mathbf{elif}\;x \cdot x \leq 1.75 \cdot 10^{+67}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 7.9999999999999999e-109Initial program 95.1%
Taylor expanded in z around inf 53.0%
*-commutative53.0%
unpow253.0%
*-commutative53.0%
associate-*l*53.0%
Simplified53.0%
if 7.9999999999999999e-109 < (*.f64 x x) < 1.75e67Initial program 88.8%
Taylor expanded in t around inf 44.6%
*-commutative44.6%
associate-*r*44.6%
*-commutative44.6%
Simplified44.6%
if 1.75e67 < (*.f64 x x) Initial program 82.1%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
Final simplification61.7%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 6.1e-21) (* z (* y (* z -4.0))) (if (<= (* x x) 7.8e+66) (* y (* t 4.0)) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 6.1e-21) {
tmp = z * (y * (z * -4.0));
} else if ((x * x) <= 7.8e+66) {
tmp = y * (t * 4.0);
} 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) <= 6.1d-21) then
tmp = z * (y * (z * (-4.0d0)))
else if ((x * x) <= 7.8d+66) then
tmp = y * (t * 4.0d0)
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) <= 6.1e-21) {
tmp = z * (y * (z * -4.0));
} else if ((x * x) <= 7.8e+66) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 6.1e-21: tmp = z * (y * (z * -4.0)) elif (x * x) <= 7.8e+66: tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 6.1e-21) tmp = Float64(z * Float64(y * Float64(z * -4.0))); elseif (Float64(x * x) <= 7.8e+66) tmp = Float64(y * Float64(t * 4.0)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 6.1e-21) tmp = z * (y * (z * -4.0)); elseif ((x * x) <= 7.8e+66) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 6.1e-21], N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 7.8e+66], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 6.1 \cdot 10^{-21}:\\
\;\;\;\;z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\mathbf{elif}\;x \cdot x \leq 7.8 \cdot 10^{+66}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 6.10000000000000013e-21Initial program 93.0%
Taylor expanded in x around 0 83.2%
*-commutative83.2%
*-commutative83.2%
unpow283.2%
*-commutative83.2%
associate-*l*83.2%
Simplified83.2%
add-cbrt-cube55.0%
pow355.0%
*-commutative55.0%
Applied egg-rr55.0%
Taylor expanded in z around inf 37.6%
unpow237.6%
Simplified37.6%
rem-cbrt-cube49.3%
add-sqr-sqrt32.1%
pow232.1%
sqrt-unprod26.1%
*-commutative26.1%
*-commutative26.1%
swap-sqr26.1%
metadata-eval26.1%
metadata-eval26.1%
swap-sqr26.1%
sqrt-unprod2.7%
pow22.7%
*-commutative2.7%
sqrt-prod2.7%
metadata-eval2.7%
unpow-prod-down2.7%
unpow22.7%
*-commutative2.7%
associate-*r*2.7%
Applied egg-rr56.2%
if 6.10000000000000013e-21 < (*.f64 x x) < 7.8000000000000007e66Initial program 99.9%
Taylor expanded in t around inf 62.1%
*-commutative62.1%
associate-*r*62.1%
*-commutative62.1%
Simplified62.1%
if 7.8000000000000007e66 < (*.f64 x x) Initial program 82.1%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5.5e+71) (* (- (* z z) t) (* -4.0 y)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5.5e+71) {
tmp = ((z * z) - t) * (-4.0 * 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) <= 5.5d+71) then
tmp = ((z * z) - t) * ((-4.0d0) * 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) <= 5.5e+71) {
tmp = ((z * z) - t) * (-4.0 * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5.5e+71: tmp = ((z * z) - t) * (-4.0 * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5.5e+71) tmp = Float64(Float64(Float64(z * z) - t) * Float64(-4.0 * y)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 5.5e+71) tmp = ((z * z) - t) * (-4.0 * y); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5.5e+71], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5.5 \cdot 10^{+71}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(-4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.5e71Initial program 93.7%
Taylor expanded in x around 0 82.7%
*-commutative82.7%
*-commutative82.7%
unpow282.7%
*-commutative82.7%
associate-*l*82.7%
Simplified82.7%
if 5.5e71 < (*.f64 x x) Initial program 82.0%
Taylor expanded in x around inf 77.7%
unpow277.7%
Simplified77.7%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5.8e+66) (* y (* t 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5.8e+66) {
tmp = y * (t * 4.0);
} 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) <= 5.8d+66) then
tmp = y * (t * 4.0d0)
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) <= 5.8e+66) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5.8e+66: tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5.8e+66) tmp = Float64(y * Float64(t * 4.0)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 5.8e+66) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5.8e+66], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5.8 \cdot 10^{+66}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.79999999999999972e66Initial program 93.7%
Taylor expanded in t around inf 43.0%
*-commutative43.0%
associate-*r*43.0%
*-commutative43.0%
Simplified43.0%
if 5.79999999999999972e66 < (*.f64 x x) Initial program 82.1%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
Final simplification56.9%
(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 88.9%
Taylor expanded in x around inf 41.7%
unpow241.7%
Simplified41.7%
Final simplification41.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 2023279
(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))))