Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38405
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Has Android different floats? |
| Date | Sun, 24 Jun 2018 17:28:58 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 37 |
| Message-ID | <pgp2es$ls9$1@dont-email.me> (permalink) |
| References | <pgool7$bru$1@news.albasani.net> <pgor09$19ak$1@gioia.aioe.org> <b4f7eefd-bde4-4b77-9dbf-b417091061ed@googlegroups.com> <90082b6a-1547-4825-83f5-34f0762daad4@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 24 Jun 2018 21:29:00 -0000 (UTC) |
| Injection-Info | reader02.eternal-september.org; posting-host="0b9b5c021bb5c2ed7fe9e82cce2d4cd0"; logging-data="22409"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/xYyhxVDGDukF+nJmRHiEb" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
| Cancel-Lock | sha1:Yg4KoY3G/n9Ddw6t/rFtQgizrSQ= |
| In-Reply-To | <90082b6a-1547-4825-83f5-34f0762daad4@googlegroups.com> |
| Content-Language | en-US |
| Xref | csiph.com comp.lang.java.programmer:38405 |
Show key headers only | View raw
On 6/24/2018 4:35 PM, bursejan@gmail.com wrote:
> The test code would be:
>
> for (int i=22; i<25; i++) {
> System.out.println("Math.pow(10,"+i+")="+Math.pow(10,i));
> }
>
> The result (without strictfp modifier to main()) is:
>
> Math.pow(10,22)=1.0E22
> Math.pow(10,23)=1.0000000000000001E23
> Math.pow(10,24)=1.0E24
>
> The result (with strictfp modifier to main()) is:
>
> Math.pow(10,22)=1.0E22
> Math.pow(10,23)=1.0000000000000001E23
> Math.pow(10,24)=1.0E24
>
> Because invoking Math.pow() is not a basic operator +, *, /, etc..
Have you tried using StrictMath.pow() instead of Math.pow()?
It is certainly possible that the Math implementations are different
on different platforms -- at least, the Javadoc seems to allow such
freedom:
"[...] Code generators are encouraged to use platform-specific
native libraries or microprocessor instructions, where
available, to provide higher-performance implementations of Math
methods. [...]"
It's my understanding, though, that StrictMath implementations on all
platforms are supposed to agree exactly.
--
esosman@comcast-dot-net.invalid
Nine hundred forty-one days to go.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Has Android different floats? j4n bur53 <janburse@fastmail.fm> - 2018-06-24 20:41 +0200
Re: Has Android different floats? Arne Vajhøj <arne@vajhoej.dk> - 2018-06-24 15:21 -0400
Re: Has Android different floats? bursejan@gmail.com - 2018-06-24 13:31 -0700
Re: Has Android different floats? bursejan@gmail.com - 2018-06-24 13:35 -0700
Re: Has Android different floats? bursejan@gmail.com - 2018-06-24 13:44 -0700
Re: Has Android different floats? Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-06-24 17:28 -0400
Re: Has Android different floats? bursejan@gmail.com - 2018-06-24 16:08 -0700
Re: Has Android different floats? bursejan@gmail.com - 2018-06-26 10:29 -0700
csiph-web