Sorry but I really don't like this piece of code from skaa.

The problem for me is that double precision numbers have floating point error, so you really don't know [most of the time] if they are going to be equal e.g. is 1e-76 equal to 1.1e-76. This kind of thing occurs all the time when doing arithmatic with double precision numbers and is often refered to as round off error.

For a 3d vector space, the one way to compare is by the Euclidian distance between two vector points. This can be readily found by calculating the inner product [often called the dot product] of the difference vector and then comparing the result, either to a fraction of the magnatude of the original vectors or to a fixed tolerance. e.g.

bool Point3D::operator==(const Point3D& A) const
{
const double Tol(1e-8*1e-8); // Squared tolerance
if (this!=&A)
{
const double D=(A.x-x)*(A.x-x)+
(A.y-y)*(A.y-y)+
(A.z-z)*(A.z-z);
if (fabs(D)>Tol) return 0;
}
return 1;
}

Not the best code (as normally Point3D would provide its own dot product method and you would use that.

Note that a dot product would normal have a square root e.g. sqrt(D), but since it is only a comparison, we can avoid that extra computation.

However, that is not the only comparison that you might like to make. You might be interested in direction, e.g. are the point vector parallel regardless of size: e.g. a.b / |a| |b|
[which is is dot product of a with b divided by the magnitude of a and b] and that equation will give you cosine of the angle between the vectors [ if it is nearly +/-1.0 then they are parallel].

If you give us an application example we can provide a bit more help

I am having a trouble not knowing how to do a java code that will take user string then encrypt it using Elgamal algorithm as following
Elgamal algorithm Pseudo code: ...

A few weeks ago my laptop browsing and windows apps error. When i am on my facebook account i can watch youtube videos posted on feeds but other videos pos ...