On 11/12/2014 11:23 PM, [email protected] wrote: > For what it's worth, Matlab produces 72057594037927936.
A power of 2 is not divisible by 5 and hence not by 10 so it cannot end in a zero. So any answer with a trailing zero is wrong. > > In general, 64-bit math is limited in accuracy to between 16 and 17 decimal > digits, depending how well that number "fits" into a floating point > representation. > > ----- Original Message ----- > > From: "Gordon Smith" <[email protected]> > To: "users, apache" <[email protected]> > Sent: Tuesday, November 11, 2014 2:37:08 PM > Subject: RE: Math.pow in ActionScript > > NO NO NO. > > 16 to the power 14 is indeed 72057594037927936. Calculator is absolutely > correct. It is presumably doing high-precision integer arithmetic. > > ActionScript is using floating point arithmetic, since you can ask for things > like Math.pow(16.1, 14.2). It doesn't special case on integers, and even if > it did it doesn't do high-precision integer arithmetic. It gets the wrong > answer because floating-point numbers don't have a sufficient number of > significant digits to produce a 17-digit result exactly. It simply computes > powers by taking the log() of the first argument, multiplying it by the > second argument, and then taking the exp() of the result, because a^b = > e^(ln(a^b)) = e^(b ln(a)). These are all floating-point operations. > > - Gordon > >> From: [email protected] >> Date: Tue, 11 Nov 2014 19:48:38 +0100 >> Subject: Re: Math.pow in ActionScript >> To: [email protected] >> >> Don't worry at all about the Calculator result :) >> >> http://www.askvg.com/microsoft-windows-calculator-bug/ >> >> The math engine of the calculator is well known as quite buggy :) Once >> again, ActionScript is right :) >> >> On Tue, Nov 11, 2014 at 7:39 PM, OmPrakash Muppirala <[email protected]> >> wrote: >> >>> Doing a Math.pow(16,14) in JavaScript results in 72057594037927940 as well. >>> Google's calculator gives the same answer as well: >>> http://lmgtfy.com/?q=16+to+the+power+of+14 >>> >>> Majority wins, I guess ;-) >>> >>> On Tue, Nov 11, 2014 at 10:25 AM, Harbs <[email protected]> wrote: >>> >>>> I’m not sure why you think it’s not using floats. >>>> >>>> Take a look here: >>>> >>>> >>> http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Math.html >>> >>>> Specifically: >>>> Note: The Math functions acos, asin, atan, atan2, cos, exp, log, pow, >>> sin, >>>> and sqrt may result in slightly different values depending on the >>>> algorithms used by the CPU or operating system. Flash runtimes call on >>> the >>>> CPU (or operating system if the CPU doesn't support floating point >>>> calculations) when performing the calculations for the listed functions, >>>> and results have shown slight variations depending upon the CPU or >>>> operating system in use. >>>> >>>> Harbs >>>> >>>> On Nov 11, 2014, at 7:50 PM, Devesh Mishra(NABFS00) < >>>> [email protected]> wrote: >>>> >>>>> It's not floating point number. So I don't think so. >>>>> >>>>> -- >>>>> Thanks & Regards, >>>>> Devesh Mishra >>>>> >>>>> -----Original Message----- >>>>> From: Subscriptions [mailto:[email protected]] >>>>> Sent: Tuesday, November 11, 2014 10:44 PM >>>>> To: [email protected] >>>>> Subject: Re: Math.pow in ActionScript >>>>> >>>>> presumably due to precision issues with large numbers (ie not your >>>>> fault) eg: >>> http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems >>>>> Lee Burrows >>>>> ActionScripter >>>>> >>>>> On 11/11/2014 16:38, Devesh Mishra(NABFS00) wrote: >>>>>> Hi, >>>>>> >>>>>> I am using Math.pow(x,y) method in action script. But I am very >>>> surprised with the results. >>>>>> For example, Math.pow(16,14). >>>>>> >>>>>> In Action Script, it gives: 72057594037927940 >>>>>> In Calculator, it gives: 72057594037927936 >>>>>> >>>>>> What may be the reason for this difference , Any idea ! >>>>>> >>>>>> >>>>>> -- >>>>>> Thanks & Regards, >>>>>> Devesh Mishra >>>>>> >>>>>> >>>>>> >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>>>>> Information contained and transmitted by this e-mail is confidential >>>> and proprietary to IGATE and its affiliates and is intended for use only >>> by >>>> the recipient. If you are not the intended recipient, you are hereby >>>> notified that any dissemination, distribution, copying or use of this >>>> e-mail is strictly prohibited and you are requested to delete this e-mail >>>> immediately and notify the originator or [email protected] <mailto: >>>> [email protected]>. IGATE does not enter into any agreement with any >>>> party by e-mail. Any views expressed by an individual do not necessarily >>>> reflect the view of IGATE. IGATE is not responsible for the consequences >>> of >>>> any actions taken on the basis of information provided, through this >>> email. >>>> The contents of an attachment to this e-mail may contain software >>> viruses, >>>> which could damage your own computer system. While IGATE has taken every >>>> reasonable precaution to minimise this risk, we cannot accept liability >>> for >>>> any damage which you sustain as a result of software viruses. You should >>>> carry out your own virus checks before opening an attachment. To know >>> more >>>> about IGATE please visit www.igate.com <http://www.igate.com>. >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>>>> >>>>> >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Disclaimer~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>>>> Information contained and transmitted by this e-mail is confidential >>> and >>>> proprietary to IGATE and its affiliates and is intended for use only by >>> the >>>> recipient. If you are not the intended recipient, you are hereby notified >>>> that any dissemination, distribution, copying or use of this e-mail is >>>> strictly prohibited and you are requested to delete this e-mail >>> immediately >>>> and notify the originator or [email protected] <mailto: >>>> [email protected]>. IGATE does not enter into any agreement with any >>>> party by e-mail. Any views expressed by an individual do not necessarily >>>> reflect the view of IGATE. IGATE is not responsible for the consequences >>> of >>>> any actions taken on the basis of information provided, through this >>> email. >>>> The contents of an attachment to this e-mail may contain software >>> viruses, >>>> which could damage your own computer system. While IGATE has taken every >>>> reasonable precaution to minimise this risk, we cannot accept liability >>> for >>>> any damage which you sustain as a result of software viruses. You should >>>> carry out your own virus checks before opening an attachment. To know >>> more >>>> about IGATE please visit www.igate.com <http://www.igate.com>. >>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>>> >
