Precompute c², d², and c²/d² for further speedup.