
(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) 1.2e+281) (fma x x (* (- (* z z) t) (* y -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1.2e+281) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1.2e+281) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); 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], 1.2e+281], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $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 1.2 \cdot 10^{+281}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\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.2e281Initial program 98.7%
fma-neg99.3%
*-commutative99.3%
distribute-rgt-neg-in99.3%
distribute-rgt-neg-in99.3%
metadata-eval99.3%
Simplified99.3%
if 1.2e281 < (*.f64 z z) Initial program 85.5%
Taylor expanded in z around inf 85.5%
*-commutative85.5%
unpow285.5%
*-commutative85.5%
associate-*r*85.5%
associate-*l*96.4%
*-commutative96.4%
Simplified96.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* t (* y -4.0)))))
(if (<= (* z z) 1e-65)
t_1
(if (<= (* z z) 4e+58)
(* (- (* z z) t) (* y -4.0))
(if (<= (* z z) 5e+193) t_1 (* -4.0 (* z (* z y))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (t * (y * -4.0));
double tmp;
if ((z * z) <= 1e-65) {
tmp = t_1;
} else if ((z * z) <= 4e+58) {
tmp = ((z * z) - t) * (y * -4.0);
} else if ((z * z) <= 5e+193) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * x) - (t * (y * (-4.0d0)))
if ((z * z) <= 1d-65) then
tmp = t_1
else if ((z * z) <= 4d+58) then
tmp = ((z * z) - t) * (y * (-4.0d0))
else if ((z * z) <= 5d+193) then
tmp = t_1
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 t_1 = (x * x) - (t * (y * -4.0));
double tmp;
if ((z * z) <= 1e-65) {
tmp = t_1;
} else if ((z * z) <= 4e+58) {
tmp = ((z * z) - t) * (y * -4.0);
} else if ((z * z) <= 5e+193) {
tmp = t_1;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * x) - (t * (y * -4.0)) tmp = 0 if (z * z) <= 1e-65: tmp = t_1 elif (z * z) <= 4e+58: tmp = ((z * z) - t) * (y * -4.0) elif (z * z) <= 5e+193: tmp = t_1 else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))) tmp = 0.0 if (Float64(z * z) <= 1e-65) tmp = t_1; elseif (Float64(z * z) <= 4e+58) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)); elseif (Float64(z * z) <= 5e+193) tmp = t_1; else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * x) - (t * (y * -4.0)); tmp = 0.0; if ((z * z) <= 1e-65) tmp = t_1; elseif ((z * z) <= 4e+58) tmp = ((z * z) - t) * (y * -4.0); elseif ((z * z) <= 5e+193) tmp = t_1; else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 1e-65], t$95$1, If[LessEqual[N[(z * z), $MachinePrecision], 4e+58], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 5e+193], t$95$1, N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{if}\;z \cdot z \leq 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{+58}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 5 \cdot 10^{+193}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999923e-66 or 3.99999999999999978e58 < (*.f64 z z) < 4.99999999999999972e193Initial program 99.1%
Taylor expanded in z around 0 91.8%
associate-*r*91.8%
Simplified91.8%
if 9.99999999999999923e-66 < (*.f64 z z) < 3.99999999999999978e58Initial program 99.9%
Taylor expanded in x around 0 79.7%
*-commutative79.7%
*-commutative79.7%
unpow279.7%
*-commutative79.7%
associate-*l*79.7%
Simplified79.7%
if 4.99999999999999972e193 < (*.f64 z z) Initial program 87.4%
Taylor expanded in z around inf 85.0%
unpow285.0%
*-commutative85.0%
associate-*l*88.3%
Simplified88.3%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1.2e+281) (+ (* 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) <= 1.2e+281) {
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) <= 1.2d+281) 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) <= 1.2e+281) {
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) <= 1.2e+281: 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(z * z) <= 1.2e+281) 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) <= 1.2e+281) 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[(z * z), $MachinePrecision], 1.2e+281], 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 \leq 1.2 \cdot 10^{+281}:\\
\;\;\;\;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 z z) < 1.2e281Initial program 98.7%
if 1.2e281 < (*.f64 z z) Initial program 85.5%
Taylor expanded in z around inf 85.5%
*-commutative85.5%
unpow285.5%
*-commutative85.5%
associate-*r*85.5%
associate-*l*96.4%
*-commutative96.4%
Simplified96.4%
Final simplification98.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 6.8e-7) (* 4.0 (* t y)) (if (<= (* z z) 7.4e+142) (* x x) (* -4.0 (* (* z z) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 6.8e-7) {
tmp = 4.0 * (t * y);
} else if ((z * z) <= 7.4e+142) {
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) <= 6.8d-7) then
tmp = 4.0d0 * (t * y)
else if ((z * z) <= 7.4d+142) 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) <= 6.8e-7) {
tmp = 4.0 * (t * y);
} else if ((z * z) <= 7.4e+142) {
tmp = x * x;
} else {
tmp = -4.0 * ((z * z) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 6.8e-7: tmp = 4.0 * (t * y) elif (z * z) <= 7.4e+142: 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) <= 6.8e-7) tmp = Float64(4.0 * Float64(t * y)); elseif (Float64(z * z) <= 7.4e+142) 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) <= 6.8e-7) tmp = 4.0 * (t * y); elseif ((z * z) <= 7.4e+142) 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], 6.8e-7], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 7.4e+142], 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 6.8 \cdot 10^{-7}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{elif}\;z \cdot z \leq 7.4 \cdot 10^{+142}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 6.79999999999999948e-7Initial program 99.0%
Taylor expanded in t around inf 57.3%
if 6.79999999999999948e-7 < (*.f64 z z) < 7.3999999999999995e142Initial program 99.9%
Taylor expanded in x around inf 54.1%
unpow254.1%
Simplified54.1%
if 7.3999999999999995e142 < (*.f64 z z) Initial program 88.5%
Taylor expanded in z around inf 81.4%
unpow281.4%
Simplified81.4%
Final simplification67.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-29) (- (* x x) (* t (* y -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-29) {
tmp = (x * x) - (t * (y * -4.0));
} 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-29) then
tmp = (x * x) - (t * (y * (-4.0d0)))
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-29) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-29: tmp = (x * x) - (t * (y * -4.0)) 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-29) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); 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-29) tmp = (x * x) - (t * (y * -4.0)); 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-29], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $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^{-29}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\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.99999999999999986e-29Initial program 99.0%
Taylor expanded in z around 0 95.8%
associate-*r*95.8%
Simplified95.8%
if 4.99999999999999986e-29 < (*.f64 z z) Initial program 91.1%
Taylor expanded in z around inf 84.3%
*-commutative84.3%
unpow284.3%
*-commutative84.3%
associate-*r*84.3%
associate-*l*90.5%
*-commutative90.5%
Simplified90.5%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 8.5e+196) (* (- (* z z) t) (* y -4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8.5e+196) {
tmp = ((z * z) - t) * (y * -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) <= 8.5d+196) then
tmp = ((z * z) - t) * (y * (-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) <= 8.5e+196) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 8.5e+196: tmp = ((z * z) - t) * (y * -4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 8.5e+196) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -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) <= 8.5e+196) tmp = ((z * z) - t) * (y * -4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8.5e+196], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8.5 \cdot 10^{+196}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 8.50000000000000041e196Initial program 95.7%
Taylor expanded in x around 0 84.6%
*-commutative84.6%
*-commutative84.6%
unpow284.6%
*-commutative84.6%
associate-*l*84.6%
Simplified84.6%
if 8.50000000000000041e196 < (*.f64 x x) Initial program 91.3%
Taylor expanded in x around inf 85.4%
unpow285.4%
Simplified85.4%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (<= z 0.22) (* 4.0 (* t y)) (if (<= z 1.15e+73) (* x x) (* -4.0 (* z (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 0.22) {
tmp = 4.0 * (t * y);
} else if (z <= 1.15e+73) {
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 <= 0.22d0) then
tmp = 4.0d0 * (t * y)
else if (z <= 1.15d+73) 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 <= 0.22) {
tmp = 4.0 * (t * y);
} else if (z <= 1.15e+73) {
tmp = x * x;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 0.22: tmp = 4.0 * (t * y) elif z <= 1.15e+73: tmp = x * x else: tmp = -4.0 * (z * (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 0.22) tmp = Float64(4.0 * Float64(t * y)); elseif (z <= 1.15e+73) tmp = Float64(x * x); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 0.22) tmp = 4.0 * (t * y); elseif (z <= 1.15e+73) tmp = x * x; else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 0.22], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e+73], N[(x * x), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 0.22:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+73}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 0.220000000000000001Initial program 97.1%
Taylor expanded in t around inf 40.4%
if 0.220000000000000001 < z < 1.15e73Initial program 99.9%
Taylor expanded in x around inf 63.0%
unpow263.0%
Simplified63.0%
if 1.15e73 < z Initial program 84.6%
Taylor expanded in z around inf 75.1%
unpow275.1%
*-commutative75.1%
associate-*l*83.8%
Simplified83.8%
Final simplification52.7%
(FPCore (x y z t) :precision binary64 (if (<= x 1e-48) (* 4.0 (* t y)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1e-48) {
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 <= 1d-48) 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 <= 1e-48) {
tmp = 4.0 * (t * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1e-48: tmp = 4.0 * (t * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1e-48) 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 <= 1e-48) tmp = 4.0 * (t * y); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1e-48], N[(4.0 * N[(t * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-48}:\\
\;\;\;\;4 \cdot \left(t \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 9.9999999999999997e-49Initial program 94.6%
Taylor expanded in t around inf 35.8%
if 9.9999999999999997e-49 < x Initial program 93.2%
Taylor expanded in x around inf 65.6%
unpow265.6%
Simplified65.6%
Final simplification42.5%
(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 94.3%
Taylor expanded in x around inf 38.1%
unpow238.1%
Simplified38.1%
Final simplification38.1%
(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 2023200
(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))))