Search:

Type: Posts; User: Zula

Search: Search took 0.06 seconds.

  1. Replies
    4
    Views
    2,020

    Re: Vector Addition with small numbers giving NaN

    Actually, that was NOT the problem. I put a println to show the value of v.mag was non-zero, and still not working, so I made a tester class, run this:


    public class mVectorTester {

    /**
    ...
  2. Replies
    4
    Views
    2,020

    Re: Vector Addition with small numbers giving NaN

    Hah, okay, the problem was hat I was passing a 0 for magnitude of new vector...rather than .735 as predicted...uncaught loss of precision due to multiplying by a long perhaps..
  3. Replies
    4
    Views
    2,020

    Re: Vector Addition with small numbers giving NaN

    public class mVector {
    public double mag;
    public double dir;
    public mVector(double mag, double dir) {
    this.mag = mag;
    this.dir = dir;
    }

    public void addVector(mVector v) {
    double...
  4. Replies
    4
    Views
    2,020

    Vector Addition with small numbers giving NaN

    public void addVector(mVector v) {
    double rx = v.getXComponent()+getXComponent();
    double ry = v.getYComponent()+getYComponent();
    mag = Math.sqrt((rx*rx)+(ry*ry));
    dir =...
Results 1 to 4 of 4