Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22551

Re: My code find negative squares buggy?

From Tim Streater <timstreater@greenbee.net>
Newsgroups comp.lang.javascript
Subject Re: My code find negative squares buggy?
Date 2014-01-10 15:52 +0000
Message-ID <100120141552439734%timstreater@greenbee.net> (permalink)
References <ed1316d2-3b87-4a4a-901a-05f6131e3e4f@googlegroups.com>

Show all headers | View raw


In article <ed1316d2-3b87-4a4a-901a-05f6131e3e4f@googlegroups.com>,
<jonas.thornvall@gmail.com> wrote:

> This works fine
> square=Math.sqrt(number,2);
>   if(square-Math.floor(square)== 0){ctx.fillStyle = 'red';}
> 
> This does not?
> 
> negsquare=Math.sqrt(-number,2);

What does negsquare get set to?

> if(number<0 && negsquare-Math.floor(negsquare)== 0) {ctx.fillStyle =
> 'orange';}

And what does Math.floor do with whatever negsquare got set to above?

-- 
"The idea that Bill Gates has appeared like a knight in shining armour to
 lead all customers out of a mire of technological chaos neatly ignores 
 the fact that it was he who, by peddling second-rate technology, led them
 into it in the first place."                             - Douglas Adams

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

My code find negative squares buggy? jonas.thornvall@gmail.com - 2014-01-10 07:40 -0800
  Re: My code find negative squares buggy? jonas.thornvall@gmail.com - 2014-01-10 07:44 -0800
  Re: My code find negative squares buggy? Tim Streater <timstreater@greenbee.net> - 2014-01-10 15:52 +0000
    Re: My code find negative squares buggy? jonas.thornvall@gmail.com - 2014-01-10 08:09 -0800
      Re: My code find negative squares buggy? Tim Streater <timstreater@greenbee.net> - 2014-01-10 16:19 +0000
        Re: My code find negative squares buggy? jonas.thornvall@gmail.com - 2014-01-10 08:32 -0800
      Re: My code find negative squares buggy? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-10 17:58 +0100

csiph-web