Instantiating objects with an exact rotation

I am really struggling to get instantiated objects to behave, I have a script for random road generation that places road parts at 90 degree angles from existing road parts. It looks like this:
Instantiate(road, transform.position, Quaternion.Euler(0,0,transform.parent.rotation.z + 90*i));
(i being a random number between 1 and 4)

The problem I have is that instead of rotating the instantiated object by 90 degrees, it rotates by 90.00034 or something, this results in road patterns that look like this:


if anybody knows how to fix this problem that would be fantastic!

This is due to floating point precision and the nature of the float struct type.
You can enforce your desired rotation by rounding to the nearest integer multiple of 90.
Or really any number of ways, but this springs to mind as a valuable concept to learn.