On Mon, Nov 2, 2009 at 9:05 AM, Jake Mannix <jake.mannix@gmail.com> wrote:
> > Also, why the special case for
>> > ArithmeticExcption here, for the zero norm case? Why not just let
>> > java just
>> > try to divide, and if it divides by zero, well, it'll throw an
>> > ArithmeticException itself... seems like the whole method should just
>> > be
>> > implemented as " return mapDivide(norm()); "
>>
>> No. A division by zero does not lead to ArithmeticException when dealing
>> with double variables, it leads to a NaN being produced. ArithmeticException
>> is triggered when an integer division by zero occurs.
>>
>
> Duh of course, right.
>
So about this, actually... it seems that this is not done consistently
throughout the vector classes  mapDivide could divide by zero, but does not
explicitly throw ArithmeticException, so why does unitVector() ?
Similarly, projection doesn't bother to check if you're projecting onto the
zero vector, and would end up with a vector of NaN which is just what
unitVector() is avoiding.
It actually looks like the isNaN() and isInfinite() methods aren't used
anywhere except in unit tests. Does this mean that they are not checked in
any of the solvers?
jake
