I would consider using a lookup table to find your sines. How precise an angle are you calculating for? This answer on stackoverflow This answer on stackoverflow has some interesting information on how to construct one and the benchmarks for using it to two decimal points. If you are using the full precision of a double, then your current method will be faster, but if you have a fixed precision, a lookup table will be benificial.
As long as the exception IS exceptional (and it looks to me like it is) it will add very little overhead to your run times. See: http://stackoverflow.com/q/52312/487663 https://stackoverflow.com/q/52312/487663.
I would consider using a lookup table to find your sines. How precise an angle are you calculating for? This answer on stackoverflow has some interesting information on how to construct one and the benchmarks for using it to two decimal points. If you are using the full precision of a double, then your current method will be faster, but if you have a fixed precision, a lookup table will be benificial.
As long as the exception IS exceptional (and it looks to me like it is) it will add very little overhead to your run times. See: http://stackoverflow.com/q/52312/487663.
I would consider using a lookup table to find your sines. How precise an angle are you calculating for? This answer on stackoverflow has some interesting information on how to construct one and the benchmarks for using it to two decimal points. If you are using the full precision of a double, then your current method will be faster, but if you have a fixed precision, a lookup table will be benificial.
As long as the exception IS exceptional (and it looks to me like it is) it will add very little overhead to your run times. See: https://stackoverflow.com/q/52312/487663.
I would consider using a lookup table to find your sines. How precise an angle are you calculating for? This answer on stackoverflow has some interesting information on how to construct one and the benchmarks for using it to two decimal points. If you are using the full precision of a double, then your current method will be faster, but if you have a fixed precision, a lookup table will be benificial.
As long as the exception IS exceptional (and it looks to me like it is) it will add very little overhead to your run times. See: http://stackoverflow.com/q/52312/487663.