# Value NaN of a variable

**URL:** <https://discourse.processing.org/t/value-nan-of-a-variable/14220>\
**Category:** Beginners\
**Created:** [September 26, 2019, 4:01pm UTC](https://discourse.processing.org/t/value-nan-of-a-variable/14220 "2019-09-26T16:01:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Ignaki](https://avatars.discourse-cdn.com/v4/letter/i/e19adc/32.png) [@Ignaki](https://discourse.processing.org/u/Ignaki)\
**Post date:** [September 30, 2019, 6:57pm UTC](https://discourse.processing.org/t/value-nan-of-a-variable/14220/4 "2019-09-30T18:57:05Z")

</div>

Hi, this is the code that produces NaN:

```auto
void setup()
{
size(1000,1000);
background(255);
}
void draw()
{
  float x,y,xm,xM,ym,yM,A,B,inc,Zx,Zy;
  xm = -10; xM = 10; ym = -10; yM = 10;
  inc = (xM-xm)/1000;
  x = xm; y = ym;
  A = (x - xm)/(xM-xm)*1000;
  B = (y-ym)/(yM-ym)*1000;
  println(x,y,inc);
       for (int i = 0; i < 1000; i=i+1)
         {
            for (int k = 0; k < 1000; k++)
              {                    
               for (int l = 0; l < 20 ; l++)
                { println(x,y);
                  Zx = x*x-y*y;
                 Zy = 2*x*y;
           
                 if( Zx*Zx + Zy*Zy < 10)
                  {A = (x - xm)/(xM-xm)*1000;
                   B = (y-ym)/(yM-ym)*1000;  
                   stroke(l);
                   point(A,B);
                  }
                 x = Zx;
                 y = Zy;

               }
            y = ym + k*inc;
           
          }
           x = xm + i*inc;
          }
          exit();
}

```

---

_[View the full topic](https://discourse.processing.org/t/value-nan-of-a-variable/14220)._
