Casting the double to a long:
Note that casting a double to a long can result in a loss of precision if the double value has a fractional component that is not zero. In such cases, you may want to consider rounding the double value before casting it to a long.