Implement a function to calculate the cosine similarity of two high-dimensional vectors efficiently.
The function receives two equal-length lists of real numbers and returns their cosine similarity as a floating-point number. Handle either zero vector by returning 0.0. Use a single traversal and avoid constructing normalized copies.
cosine_similarity(vector_a, vector_b) returns a float in [-1.0, 1.0].
def cosine_similarity(vector_a, vector_b):