Incorrect calculation of 100! - but why
HI,
I just tried to calculate 100! (using the FACT function) in Numbers, and it gave me an answer that is:
93326215443944200000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000
While the actual answer should be:
93326215443944152681699238856266700490715968264381621468592963895217599993229915 608941463976156518286253697920827223758251185 210916864000000000000000000000000
Numbers seems to be rounding up the answer after 15 digits. But can someone explain why is this happening?
I suppose I might need to change the default settings somewhere, Can someone please guide!
Thanks
Hello
Spreadsheet is not the right tool for arbitrary precision calculation. As far as Numbers is concerned, it uses double precision binary floating point arithmetic whose mantissa can hold only 52-bit binary digits. In other words, 2 ^ 53 is the maximum exact integer it can represent.
I don't know what your goal is, and also I guess you already know what alternatives are, but here you may use bc(1) in shell, such as -
#!/bin/bash
bc -l <<EOF
define fact (n)
m = 1
for (i = 1; i <= n; i++) { m *= i }
return m
print fact(100)
EOF
or ruby, such as -
#!/usr/bin/ruby -w
def fact (n)
m = 1
for i in (1 .. n)
m *= i
end
return m
end
print fact(100)
Regards,
H
Similar Messages
-
i just brought Macbook pro(without retina display) on 15 june 2013 and when i switched it on the battery was 72 % charged and now the battery is charged to 62%, i used the charger that came with it and kept it for 6-7 hours on charging but it is not charged to 100% but why? also the green light is always on when i plug the charger with my mac book pro.Please tell me the meaning of Green light on power cord lid (mac book pro not charging or charging?) and also the other light if there like amber or any other colour.
Hello Shailendras33,
Congratulations on your new MacBook Pro! Thank you for providing all the information about what is going on with the charging issue.
Firstly, I found some information on page 11 of the MacBook Pro User Guide about what each color of the LED means on the Power Adapter:
When you first connect your power adapter to your MacBook Pro, an indicator light on the
MagSafe connector starts to glow. An amber light indicates the battery is charging. A green light indicates that the battery is fully charged.
You can find the MacBook Pro User Guide here (this is not for the latest MacBook Pro, but the information about the MagSafe adapter is true for the newest model):
MacBook Pro User Guide
http://manuals.info.apple.com/en_US/macbook_pro_15inch_late_2011.pdf
It sounds like you are not getting the amber light indicating your computer is charging, and you are noticing that the battery level is depleting. I recommend resetting your System Management Controller when something like this is occurring:
Resetting the SMC on portables with a battery you should not remove on your own
Note: Portable computers that have a battery you should not remove on your own include MacBook Pro (Early 2009) and later, all models of MacBook Air, and MacBook (Late 2009).
Shut down the computer.
Plug in the MagSafe power adapter to a power source, connecting it to the Mac if its not already connected.
On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
Release all the keys and the power button at the same time.
Press the power button to turn on the computer.
Note: The LED on the MagSafe power adapter may change states or temporarily turn off when you reset the SMC.
You can find the full article here:
Intel-based Macs: Resetting the System Management Controller (SMC)
http://support.apple.com/kb/ht3964
Thank you for posting in the Apple Support Communities.
Best,
Sheila M. -
Why my iphone 5 still cannot install this update? I've clicked the download and install button but it do nothing, im using wifi and the baterry is 100% but still, it do nothing when i've clicked! Help!
Reset the phone (no data loss): Press both the home and power buttons for at least 10 seconds, releasing when the Apple logo appears. After the phone restarts, try updating again.
-
I have just purchased an Apple Magic Trackpad. I connected it to my Macbook to test it. Fine. But I want to use it with my IMac - and my IMac cannot discover it - even though it is turned on and the batteries are 100%. Why? Can I reconfigure it to the IMac?
Remove it from the Macbook first. BT devices may only be connected to one thing at a time.
Barry -
i just had a new phone today,,i have setup my phone and charged it 100% but the battery is running out very fast.any idea why it is happening ? would really appreciate your help thanks
Here are the iPhone battery conservation tips.
iPhone
Watch some of the things you may have set up as the article suggests. Check email fetch frequency, push notifications, location services, etc. -
The battery when charged it will only reach 93%. When i reboot the phone the battery percentage will indicate 97-98% but the battery usage timer has been reset since the battery did not reach 100%. Why is that?
I have the same problem with less than 1 mo old iphone 5 ios 6.1. I charged over night which is over 7 hrs and still not 100%
-
how can i fix my iphone i can't update or download apps, when i try it tells me toput my credit card info and i do but when i push done it tells me my payment has been declined, but why do i have to pay to update or download free apps. How can i fix this?
You must contact iTunes support to get the problem resolved.
http://www.apple.com/support/itunes/contact/
If there is a problem with your account or payment info, you cannot
download anything (including free apps or updates) until the matter
is resolved.
In countries where the iTunes Store only sells apps, the accepted payment methods are Visa, MasterCard, and American Express. Other payment types such as gift cards, store credit, monthly allowances, ClickandBuy, and PayPal are not accepted. Depending on your App Store country, prices may be listed in your local currency, US Dollars, or Euros. http://support.apple.com/kb/HT5552 -
my ipod touch is stuck on the apple logo and after a while a white screen comes up and it restarts and the same thing all over agan. this happened to me before and after a while it turns on but why does it keep on doing this?
Try connecting the iPod Touch to your computer and restore it. http://support.apple.com/kb/HT1414
-
keynote and pages are now free, but why do i need to pay for them still when there now free?!?
Users can obtain the iWorks and iLife applications free, if they purchased a Mac after the beginning of October 2013.
Older Mac purchases require a paid purchase of these applications. -
I am from Bangladesh. I can't log in with my gmail Apple ID. When I put in the mail and password, and press sign in, it says it has to review on iTunes. Then I am directed to opening a new account. But why should I , since I have one. Plz help
Hi Ishrak,
I apologize, I'm a bit unclear on exactly what you are trying to log into with your Apple ID, or what exactly you are seeing (alert message, directions, etc) when you try to do so. If you continue to have issues with your Apple ID, you may find one or more of the articles linked from the following page helpful:
Apple ID - Apple Support
Regards,
- Brenden -
Hey everyone I can no longer down load or up date my games videos so on on iTunes
It's telling me I need a new payment method but why would my bank card no longer work how can I fix it so my bank card works againhow do i fix this
-
Export in Premiere CS6 is very slow, but why?
Hello,
I work with a
Intel i7 3770k @ 3.5 GHz
16GB RAM
GeForce GTX 560 TI
2TB RAID-0
In this project I did the color correction via After Effects and replaced the clips in the Premiere Pro timeline with AE Compositions after I edited them.
Now when exporting it takes about 2,5 hours for a 12 minute video. The cpu only works on 22% and the ram on 35-40%
That never happened before. A 12 min video took about 30 minutes to export and the cpu was at 100%. Why not now? Is that because of the links to the AE Compositions as it's the first time I work with these?
How can I provide more cpu power to the exporting process?
Thanks for any help.by the way... I am exporting h.264 1920x1080 with 13 Mbits/s
-
I can see my previously purchase music, it says downloaded but why can't i download the music? The were accidentally deleted from the itune folder?
Do I have to have icloud to download previously purchased music?
-
Full screen is great but why take out my links bar?
Full screen is great but why take out my links bar?
Is there an option or customisation to show it in full screen mode.. I can understand taking out the file menu but that second delay is unpreciated to access links also.Hi Atomic AI
can I achieve the opposite - I would like to start my full screen safari without the title bar, links bar or similar. just nothing except the content of the page - is this possible? I cant figure it out -
Goodnight gracie, I know this is trivial but why?
I know this is trivial but in System profiler in the syncservices log i find this, or variantys thereof:
2011-06-13 20:45:44:432|SyncServer|1994|110fd0|Server|Info| Goodnight, Gracie.
I think it a message when the mac goes into sleep mode. But why 'Goodnight Gracie' Apparently it was a catchprase used by George Burns at the end of his radio show, but does anyone know who or why it was included in this log message?
mikeSomeone may, but it was put in there by one of the programmers as a joke.
Maybe you are looking for
-
Xml report to print AR invoices to multiple companies
Hi, can anyone help me to work on this issue, I need to Develop one XMLP report that prints AR invoices for multiple companies, and multiple invoices for each company. It will be thankful, if anyone help me to come out of this issue. I need it urgent
-
How to use my time capsule on my new macbook pro retina (time machine error)
Hello all, I've been using my old mac for a while with my time capsule, but recently I bought the new macbook pro retina and I wanted to use the time capsule as the backup disk on the new one. However, whenever I try to run the backup, a message appe
-
Ineligible songs in itunes 10.6.1.7
I have browsed a number of threads on this suggesting converting to AAC, but they seem to apply to old itunes. I have a number of songs which are ineligble, most seeminlgy becuase of low bit rate. I remember the AAC option from previous versions of i
-
Unable to load flash-based website in any browser
I'm on Windows XP SP2 with the latest flashplayer installed (9,0,47,0). For some reason I can no longer get beatport.com to load in any web browser on my computer, i.e. Firefox, IE, or even Netscape. The website partially loads, leaving me with just
-
[Solved] Pulseaudio problem after update
So, here is the deal. I have been watching movies, playing HoN and listening to music on Sunday, Everything worked fine. On monday, I updated the system remotely - from work: packer -Syu Here is the pacman log: [2012-07-09 11:36] Running 'pacman -S s