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


Groups > comp.lang.javascript > #30658

Re: Impact of implicit arrays...

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Impact of implicit arrays...
Followup-To poster
Date 2016-06-15 06:55 +0200
Organization PointedEars Software (PES)
Message-ID <2043638.uQNA3CLBAW@PointedEars.de> (permalink)
References <njhj52$hl3$1@gioia.aioe.org> <4a1c28ea-447b-4e9b-9c75-68ef85c379e7@googlegroups.com> <njq6qn$qc3$1@gioia.aioe.org>

Followups directed to: poster

Show all headers | View raw


Chris M. Thomasson wrote:

> Also, we can do this another way that involves an explicit
> output parameter to the function. Something like:
> _______________________________________
> function ct_complex_mul(c0, c1, out)
                                  ^^^
> {
>      out[0] = c0[0] * c1[0] - c0[1] * c1[1];
>      out[1] = c0[0] * c1[1] + c0[1] * c1[0];
> 
>      return out;
> }
> _______________________________________
> 
> 
> To call it in a loop could look like:
> _______________________________________
> function foo_with_out()
> {
>     var out = [0, 0];
>     var z = [1, 1];
>     var c = [2, 2];
> 
>     for (var i = 0; i < 10; ++i)
>     {
>         out = ct_complex_mul(z, c);
                                   ^^
>         z[0] = out[0];
>         z[1] = out[1];
>     }
> }
> _______________________________________

No, that would be pointless.  In fact, the function SHOULD NOT *return* the 
changed value then.

But this non-idempotent, non-reentrant code is not thread-safe – it is not 
suited for animations.
 
>> Another thought is to switch to polar coordinates
>> instead of Cartesian coordinates as it would simplify
>> multiplication and division at least. With fractal based
>> work this might be more intuitive anyway, yes?
> 
> Right. However, I think that converting Polar into Cartesian
> in order to add/subtract is the simplest route correct?

Yes.  UTSL.


The “From” and “Reply-To” header fields of your postings are borked, see

<http://www.interhack.net/pubs/munging-harmful/>
<http://tools.ietf.org/html/rfc5536#section-3.1.2>
<http://tools.ietf.org/html/rfc5536#section-3.2>

You should also avoid the troll server, aioe.org.

Pseudo-address added to killfile.

F'up2 poster

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

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


Thread

Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.com> - 2016-06-11 10:52 -0700
  Re: Impact of implicit arrays... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-12 12:16 +0200
    Re: Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.com> - 2016-06-13 12:23 -0700
  Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-13 22:00 -0700
    Re: Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.com> - 2016-06-14 17:17 -0700
      Re: Impact of implicit arrays... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-06-15 06:55 +0200
      Re: Impact of implicit arrays... "Chris M. Thomasson" <nospam@nospam.invalid> - 2016-06-14 22:19 -0700
      Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-18 12:47 -0700
        Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 14:43 -0700
          Re: Impact of implicit arrays... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-22 00:10 +0200
            Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 15:28 -0700
              Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 15:31 -0700
                Re: Impact of implicit arrays... "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-06-22 11:55 +0200
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 12:23 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 14:14 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 14:16 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 18:14 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 18:46 -0700
          Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-21 17:35 -0700
            Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-21 21:08 -0700
              Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-21 23:09 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-23 14:38 -0700
                Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-24 07:16 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-06-25 18:03 -0700
                Re: Impact of implicit arrays... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-06-25 18:24 -0700
                Re: Impact of implicit arrays... "Chris M. Thomasson" <invalid@invalid.invalid> - 2016-07-01 13:52 -0700

csiph-web