Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28762
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Comparisson operators |
| Date | 2015-09-29 19:39 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2785430.nENm2z7bcr@PointedEars.de> (permalink) |
| References | <807dd61a-97ec-48cb-ad49-c6292a448a73@googlegroups.com> <87twqdcvt1.fsf@bsb.me.uk> |
Ben Bacarisse wrote: > jonas.thornvall@gmail.com writes: >> And what happen if you try to compare elements that is bigger than the >> scope of javascript integers? > > A normal floating-point comparison is done, just as it always is. What > matters is the range of integer values that can be represented exactly. > That range is -(2**53 - 1) to 2**53 - 1. The latest ECMAScript defines > property, Number.MAX_SAFE_INTEGER with the value 9007199254740991, but > you can always calculate Math.pow(2, 53) - 1. This description is so imprecise as to be misleading. Several integers smaller and greater than these boundaries can be stored exactly, but the integers *between* the boundaries and the stored integers cannot be, because the achievable precision is insufficient. Insofar Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER only give the minimum/maximum integer down/up to which proper arithmetic is possible (hence “SAFE”). The minimum/maximum integer than can be represented exactly with IEEE 754 doubles is approximately ±1.8 × 10³⁰⁸; it is exactly given by -Number.MAX_VALUE and Number.MAX_VALUE, respectively. (Note that Number.MIN_VALUE gives the smallest floating-point value greater than 0 instead.) -- 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 | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Comparisson operators jonas.thornvall@gmail.com - 2015-09-28 23:24 -0700
Re: Comparisson operators "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-29 12:16 +0200
Re: Comparisson operators Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-09-29 12:24 +0100
Re: Comparisson operators Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-09-29 19:39 +0200
Re: Comparisson operators Silvio <silvio@internet.com> - 2015-09-30 13:28 +0200
csiph-web