
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
NOTE: z should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= z 3.8e+173) (fma x x (* (- (* z z) t) (* y -4.0))) (* -4.0 (* z (* z y)))))
z = abs(z);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.8e+173) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
z = abs(z) function code(x, y, z, t) tmp = 0.0 if (z <= 3.8e+173) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
NOTE: z should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[z, 3.8e+173], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.8 \cdot 10^{+173}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 3.80000000000000011e173Initial program 97.0%
fma-neg97.0%
*-commutative97.0%
distribute-rgt-neg-in97.0%
distribute-rgt-neg-in97.0%
metadata-eval97.0%
Simplified97.0%
if 3.80000000000000011e173 < z Initial program 78.1%
Taylor expanded in z around inf 81.5%
unpow281.5%
*-commutative81.5%
associate-*l*99.9%
Simplified99.9%
Final simplification97.3%
NOTE: z should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (* y 4.0))))
(if (<= z 6e-188)
t_1
(if (<= z 7.8e-88)
(* x x)
(if (<= z 0.00031)
t_1
(if (or (<= z 8.6e+76) (not (<= z 1.4e+95)))
(* -4.0 (* (* z z) y))
(* x x)))))))z = abs(z);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * 4.0);
double tmp;
if (z <= 6e-188) {
tmp = t_1;
} else if (z <= 7.8e-88) {
tmp = x * x;
} else if (z <= 0.00031) {
tmp = t_1;
} else if ((z <= 8.6e+76) || !(z <= 1.4e+95)) {
tmp = -4.0 * ((z * z) * y);
} else {
tmp = x * x;
}
return tmp;
}
NOTE: z should be positive before calling this function
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 = t * (y * 4.0d0)
if (z <= 6d-188) then
tmp = t_1
else if (z <= 7.8d-88) then
tmp = x * x
else if (z <= 0.00031d0) then
tmp = t_1
else if ((z <= 8.6d+76) .or. (.not. (z <= 1.4d+95))) then
tmp = (-4.0d0) * ((z * z) * y)
else
tmp = x * x
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y * 4.0);
double tmp;
if (z <= 6e-188) {
tmp = t_1;
} else if (z <= 7.8e-88) {
tmp = x * x;
} else if (z <= 0.00031) {
tmp = t_1;
} else if ((z <= 8.6e+76) || !(z <= 1.4e+95)) {
tmp = -4.0 * ((z * z) * y);
} else {
tmp = x * x;
}
return tmp;
}
z = abs(z) def code(x, y, z, t): t_1 = t * (y * 4.0) tmp = 0 if z <= 6e-188: tmp = t_1 elif z <= 7.8e-88: tmp = x * x elif z <= 0.00031: tmp = t_1 elif (z <= 8.6e+76) or not (z <= 1.4e+95): tmp = -4.0 * ((z * z) * y) else: tmp = x * x return tmp
z = abs(z) function code(x, y, z, t) t_1 = Float64(t * Float64(y * 4.0)) tmp = 0.0 if (z <= 6e-188) tmp = t_1; elseif (z <= 7.8e-88) tmp = Float64(x * x); elseif (z <= 0.00031) tmp = t_1; elseif ((z <= 8.6e+76) || !(z <= 1.4e+95)) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); else tmp = Float64(x * x); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z, t) t_1 = t * (y * 4.0); tmp = 0.0; if (z <= 6e-188) tmp = t_1; elseif (z <= 7.8e-88) tmp = x * x; elseif (z <= 0.00031) tmp = t_1; elseif ((z <= 8.6e+76) || ~((z <= 1.4e+95))) tmp = -4.0 * ((z * z) * y); else tmp = x * x; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 6e-188], t$95$1, If[LessEqual[z, 7.8e-88], N[(x * x), $MachinePrecision], If[LessEqual[z, 0.00031], t$95$1, If[Or[LessEqual[z, 8.6e+76], N[Not[LessEqual[z, 1.4e+95]], $MachinePrecision]], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;z \leq 6 \cdot 10^{-188}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-88}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \leq 0.00031:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+76} \lor \neg \left(z \leq 1.4 \cdot 10^{+95}\right):\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if z < 6.00000000000000033e-188 or 7.79999999999999985e-88 < z < 3.1e-4Initial program 97.0%
Taylor expanded in t around inf 42.0%
associate-*r*42.0%
Simplified42.0%
if 6.00000000000000033e-188 < z < 7.79999999999999985e-88 or 8.59999999999999957e76 < z < 1.3999999999999999e95Initial program 100.0%
Taylor expanded in x around inf 74.5%
unpow274.5%
Simplified74.5%
if 3.1e-4 < z < 8.59999999999999957e76 or 1.3999999999999999e95 < z Initial program 87.9%
Taylor expanded in z around inf 68.6%
unpow268.6%
Simplified68.6%
Final simplification52.2%
NOTE: z should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (* y 4.0))))
(if (<= z 3e-186)
t_1
(if (<= z 1.45e-88)
(* x x)
(if (<= z 0.00088)
t_1
(if (<= z 8.5e+74)
(* -4.0 (* (* z z) y))
(if (<= z 1.4e+95) (* x x) (* -4.0 (* z (* z y))))))))))z = abs(z);
double code(double x, double y, double z, double t) {
double t_1 = t * (y * 4.0);
double tmp;
if (z <= 3e-186) {
tmp = t_1;
} else if (z <= 1.45e-88) {
tmp = x * x;
} else if (z <= 0.00088) {
tmp = t_1;
} else if (z <= 8.5e+74) {
tmp = -4.0 * ((z * z) * y);
} else if (z <= 1.4e+95) {
tmp = x * x;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
NOTE: z should be positive before calling this function
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 = t * (y * 4.0d0)
if (z <= 3d-186) then
tmp = t_1
else if (z <= 1.45d-88) then
tmp = x * x
else if (z <= 0.00088d0) then
tmp = t_1
else if (z <= 8.5d+74) then
tmp = (-4.0d0) * ((z * z) * y)
else if (z <= 1.4d+95) then
tmp = x * x
else
tmp = (-4.0d0) * (z * (z * y))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
double t_1 = t * (y * 4.0);
double tmp;
if (z <= 3e-186) {
tmp = t_1;
} else if (z <= 1.45e-88) {
tmp = x * x;
} else if (z <= 0.00088) {
tmp = t_1;
} else if (z <= 8.5e+74) {
tmp = -4.0 * ((z * z) * y);
} else if (z <= 1.4e+95) {
tmp = x * x;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
z = abs(z) def code(x, y, z, t): t_1 = t * (y * 4.0) tmp = 0 if z <= 3e-186: tmp = t_1 elif z <= 1.45e-88: tmp = x * x elif z <= 0.00088: tmp = t_1 elif z <= 8.5e+74: tmp = -4.0 * ((z * z) * y) elif z <= 1.4e+95: tmp = x * x else: tmp = -4.0 * (z * (z * y)) return tmp
z = abs(z) function code(x, y, z, t) t_1 = Float64(t * Float64(y * 4.0)) tmp = 0.0 if (z <= 3e-186) tmp = t_1; elseif (z <= 1.45e-88) tmp = Float64(x * x); elseif (z <= 0.00088) tmp = t_1; elseif (z <= 8.5e+74) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); elseif (z <= 1.4e+95) tmp = Float64(x * x); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z, t) t_1 = t * (y * 4.0); tmp = 0.0; if (z <= 3e-186) tmp = t_1; elseif (z <= 1.45e-88) tmp = x * x; elseif (z <= 0.00088) tmp = t_1; elseif (z <= 8.5e+74) tmp = -4.0 * ((z * z) * y); elseif (z <= 1.4e+95) tmp = x * x; else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 3e-186], t$95$1, If[LessEqual[z, 1.45e-88], N[(x * x), $MachinePrecision], If[LessEqual[z, 0.00088], t$95$1, If[LessEqual[z, 8.5e+74], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+95], N[(x * x), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;z \leq 3 \cdot 10^{-186}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-88}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \leq 0.00088:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+74}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+95}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 3.0000000000000001e-186 or 1.4500000000000001e-88 < z < 8.80000000000000031e-4Initial program 97.0%
Taylor expanded in t around inf 42.0%
associate-*r*42.0%
Simplified42.0%
if 3.0000000000000001e-186 < z < 1.4500000000000001e-88 or 8.50000000000000028e74 < z < 1.3999999999999999e95Initial program 100.0%
Taylor expanded in x around inf 74.5%
unpow274.5%
Simplified74.5%
if 8.80000000000000031e-4 < z < 8.50000000000000028e74Initial program 99.9%
Taylor expanded in z around inf 49.3%
unpow249.3%
Simplified49.3%
if 1.3999999999999999e95 < z Initial program 82.0%
Taylor expanded in z around inf 78.0%
unpow278.0%
*-commutative78.0%
associate-*l*91.6%
Simplified91.6%
Final simplification54.7%
NOTE: z should be positive before calling this function
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x x) (* t (* y -4.0)))))
(if (<= z 440000.0)
t_1
(if (<= z 8.5e+72)
(* (- (* z z) t) (* y -4.0))
(if (<= z 4.9e+95) t_1 (* -4.0 (* z (* z y))))))))z = abs(z);
double code(double x, double y, double z, double t) {
double t_1 = (x * x) - (t * (y * -4.0));
double tmp;
if (z <= 440000.0) {
tmp = t_1;
} else if (z <= 8.5e+72) {
tmp = ((z * z) - t) * (y * -4.0);
} else if (z <= 4.9e+95) {
tmp = t_1;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
NOTE: z should be positive before calling this function
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 <= 440000.0d0) then
tmp = t_1
else if (z <= 8.5d+72) then
tmp = ((z * z) - t) * (y * (-4.0d0))
else if (z <= 4.9d+95) then
tmp = t_1
else
tmp = (-4.0d0) * (z * (z * y))
end if
code = tmp
end function
z = Math.abs(z);
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 <= 440000.0) {
tmp = t_1;
} else if (z <= 8.5e+72) {
tmp = ((z * z) - t) * (y * -4.0);
} else if (z <= 4.9e+95) {
tmp = t_1;
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
z = abs(z) def code(x, y, z, t): t_1 = (x * x) - (t * (y * -4.0)) tmp = 0 if z <= 440000.0: tmp = t_1 elif z <= 8.5e+72: tmp = ((z * z) - t) * (y * -4.0) elif z <= 4.9e+95: tmp = t_1 else: tmp = -4.0 * (z * (z * y)) return tmp
z = abs(z) function code(x, y, z, t) t_1 = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))) tmp = 0.0 if (z <= 440000.0) tmp = t_1; elseif (z <= 8.5e+72) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)); elseif (z <= 4.9e+95) tmp = t_1; else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z, t) t_1 = (x * x) - (t * (y * -4.0)); tmp = 0.0; if (z <= 440000.0) tmp = t_1; elseif (z <= 8.5e+72) tmp = ((z * z) - t) * (y * -4.0); elseif (z <= 4.9e+95) tmp = t_1; else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function
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[z, 440000.0], t$95$1, If[LessEqual[z, 8.5e+72], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.9e+95], t$95$1, N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
t_1 := x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{if}\;z \leq 440000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+72}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 4.4e5 or 8.5000000000000004e72 < z < 4.8999999999999999e95Initial program 97.4%
Taylor expanded in z around 0 81.6%
associate-*r*81.6%
Simplified81.6%
if 4.4e5 < z < 8.5000000000000004e72Initial program 99.8%
Taylor expanded in x around 0 69.8%
*-commutative69.8%
*-commutative69.8%
unpow269.8%
*-commutative69.8%
associate-*l*69.8%
Simplified69.8%
if 4.8999999999999999e95 < z Initial program 82.0%
Taylor expanded in z around inf 78.0%
unpow278.0%
*-commutative78.0%
associate-*l*91.6%
Simplified91.6%
Final simplification82.6%
NOTE: z should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= z 4.5e+173) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* -4.0 (* z (* z y)))))
z = abs(z);
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.5e+173) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
NOTE: z should be positive before calling this function
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 <= 4.5d+173) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (-4.0d0) * (z * (z * y))
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.5e+173) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = -4.0 * (z * (z * y));
}
return tmp;
}
z = abs(z) def code(x, y, z, t): tmp = 0 if z <= 4.5e+173: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = -4.0 * (z * (z * y)) return tmp
z = abs(z) function code(x, y, z, t) tmp = 0.0 if (z <= 4.5e+173) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(-4.0 * Float64(z * Float64(z * y))); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 4.5e+173) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = -4.0 * (z * (z * y)); end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[z, 4.5e+173], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.5 \cdot 10^{+173}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 4.5000000000000002e173Initial program 97.0%
if 4.5000000000000002e173 < z Initial program 78.1%
Taylor expanded in z around inf 81.5%
unpow281.5%
*-commutative81.5%
associate-*l*99.9%
Simplified99.9%
Final simplification97.3%
NOTE: z should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.9e+142) (* (- (* z z) t) (* y -4.0)) (* x x)))
z = abs(z);
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.9e+142) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = x * x;
}
return tmp;
}
NOTE: z should be positive before calling this function
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) <= 2.9d+142) then
tmp = ((z * z) - t) * (y * (-4.0d0))
else
tmp = x * x
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.9e+142) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = x * x;
}
return tmp;
}
z = abs(z) def code(x, y, z, t): tmp = 0 if (x * x) <= 2.9e+142: tmp = ((z * z) - t) * (y * -4.0) else: tmp = x * x return tmp
z = abs(z) function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 2.9e+142) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0)); else tmp = Float64(x * x); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 2.9e+142) tmp = ((z * z) - t) * (y * -4.0); else tmp = x * x; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2.9e+142], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.9 \cdot 10^{+142}:\\
\;\;\;\;\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) < 2.90000000000000013e142Initial program 93.8%
Taylor expanded in x around 0 80.4%
*-commutative80.4%
*-commutative80.4%
unpow280.4%
*-commutative80.4%
associate-*l*80.4%
Simplified80.4%
if 2.90000000000000013e142 < (*.f64 x x) Initial program 96.6%
Taylor expanded in x around inf 83.9%
unpow283.9%
Simplified83.9%
Final simplification81.6%
NOTE: z should be positive before calling this function (FPCore (x y z t) :precision binary64 (if (<= (* x x) 8e-74) (* t (* y 4.0)) (* x x)))
z = abs(z);
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e-74) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
NOTE: z should be positive before calling this function
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-74) then
tmp = t * (y * 4.0d0)
else
tmp = x * x
end if
code = tmp
end function
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 8e-74) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
z = abs(z) def code(x, y, z, t): tmp = 0 if (x * x) <= 8e-74: tmp = t * (y * 4.0) else: tmp = x * x return tmp
z = abs(z) function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 8e-74) tmp = Float64(t * Float64(y * 4.0)); else tmp = Float64(x * x); end return tmp end
z = abs(z) function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 8e-74) tmp = t * (y * 4.0); else tmp = x * x; end tmp_2 = tmp; end
NOTE: z should be positive before calling this function code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 8e-74], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
z = |z|\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 8 \cdot 10^{-74}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 7.99999999999999966e-74Initial program 91.9%
Taylor expanded in t around inf 54.4%
associate-*r*54.4%
Simplified54.4%
if 7.99999999999999966e-74 < (*.f64 x x) Initial program 97.2%
Taylor expanded in x around inf 66.8%
unpow266.8%
Simplified66.8%
Final simplification61.1%
NOTE: z should be positive before calling this function (FPCore (x y z t) :precision binary64 (* x x))
z = abs(z);
double code(double x, double y, double z, double t) {
return x * x;
}
NOTE: z should be positive before calling this function
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
z = Math.abs(z);
public static double code(double x, double y, double z, double t) {
return x * x;
}
z = abs(z) def code(x, y, z, t): return x * x
z = abs(z) function code(x, y, z, t) return Float64(x * x) end
z = abs(z) function tmp = code(x, y, z, t) tmp = x * x; end
NOTE: z should be positive before calling this function code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
z = |z|\\
\\
x \cdot x
\end{array}
Initial program 94.8%
Taylor expanded in x around inf 40.4%
unpow240.4%
Simplified40.4%
Final simplification40.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 2023224
(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))))