Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37586
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Weather App - one more round? |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | (1 earlier) <406e6538-430e-4a3e-ad1f-bd2dd81aa873@googlegroups.com> <abc5921f-655c-4378-84ad-f639b8fc0681@googlegroups.com> <fff1fff6-e24d-4ef5-8273-edff1ea14e00@googlegroups.com> <XnsAAEC88345AB3Deejj99@194.109.6.166> <40c38b68-1d61-48a2-a55c-ed67c05b30f5@googlegroups.com> |
| Date | 2019-10-18 23:42 +0200 |
| Message-ID | <XnsAAECF12BCD106eejj99@194.109.6.166> (permalink) |
luserdroog <luser.droog@gmail.com> wrote on 18 Oct 2019 in
comp.lang.javascript:
> return [ 'N','NNE',
> 'NE','ENE','E','ESE',
> 'SE','SSE','S','SSW',
> 'SW','WSW','W','WNW',
> 'NW','NNW'
> ][ Math.floor( (this.deg+11.25) / 22.5 ) % 16 ];
You could use XOR 0 to force the integer part.
With positive small values this is the same as Math.floor(),
but probably[!] faster.
return [
'N','NNE',
'NE','ENE','E','ESE',
'SE','SSE','S','SSW',
'SW','WSW','W','WNW',
'NW','NNW'
][ (this.deg + 11.25) / 22.5 % 16 ^ 0 ];
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-16 21:15 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-17 21:05 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-17 21:31 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-18 12:42 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-18 00:16 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-18 00:44 -0700
Re: Weather App - one more round? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-10-18 13:23 +0200
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-18 13:43 -0700
Re: Weather App - one more round? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-10-18 23:42 +0200
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-18 12:36 -0700
Re: Weather App - one more round? dr.j.r.stockton@gmail.com - 2019-10-18 02:25 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-18 13:14 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-18 13:35 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-20 21:10 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-20 21:20 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-21 04:21 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-21 15:21 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-21 16:36 -0700
Re: Weather App - one more round? Julio Di Egidio <julio@diegidio.name> - 2019-10-26 04:20 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-26 07:45 -0700
Re: Weather App - one more round? luserdroog <luser.droog@gmail.com> - 2019-10-26 11:06 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-26 16:23 -0700
Re: Weather App - one more round? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-10-27 11:05 +0100
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-27 10:12 -0700
Re: Weather App - one more round? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-10-28 00:44 +0100
Re: Weather App - one more round? Julio Di Egidio <julio@diegidio.name> - 2019-10-28 05:50 -0700
Re: Weather App - one more round? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-10-28 06:40 -0700
Re: Weather App - one more round? Julio Di Egidio <julio@diegidio.name> - 2019-10-28 07:00 -0700
csiph-web