![]() |
Forum Index : Microcontroller and PC projects : Problem with MM+ matematics
![]() ![]() |
|||||
Author | Message | ||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
It doesn't fit in a 64-bit integer, whose max is around 18,446,744,073,709,551,615 (2^64-1, using unsigned) i.e. about 1E19 At a guess the value you posted is the bottom 64 or 63 bits of the correct number (i.e. mod 64-bits). John |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
(7^7)^7 = 2.5692357752105887808861147722424e+41 7^(7^7) = 823543 7^7^7 without brackets causes as much discussion as the Paris Climate Change meeting without any consensus. Most calculators work from left to right so will give the first answer. A lot of programming languages will resolve power from right to left resulting in the second answer. Jim VK7JH MMedit |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Jim, Something wrong with your calculation of that 2nd one!! 7^7 = 823543 I can post the correct value if anyone wants a BIG post (695975 digits)... E.g. it's the output from echo '7^(7^7)' | bc its length is echo '7^(7^7)' | bc | tr -c -d '[0-9]' | wc -c (which grabs just the digits and counts them) John |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
You are right. Excel correctly gives an error for 7^(7^7) but MS calculator gave 823543. Excel and VB also differ in the order they treat Power operators. Negative numbers also suffer from the lack of a clear order. -2^2 can be treated as (-2)^2 = 4 or -(2^2) = -4 Jim VK7JH MMedit |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
BTW, what is a "matematic"? (see title of thread) ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Each programming language should (as far as I know: always does) define the order. But it's wise to use parentheses :) John |
||||
kiiid Guru ![]() Joined: 11/05/2013 Location: United KingdomPosts: 671 |
Hey, that was uncalled for ![]() A small typo on top of my secondary English... But still goes well as "science for mates" http://rittle.org -------------- |
||||
WhiteWizzard Guru ![]() Joined: 05/04/2013 Location: United KingdomPosts: 2944 |
'Floating' spelling! Just out of interest; PRINT 7^(7^7) generates -3,568,518,334,133,427,593 Don't think we've seen that number mentioned here yet! ![]() |
||||
isochronic Guru ![]() Joined: 21/01/2012 Location: AustraliaPosts: 689 |
I tried the equivalent in electride, eg a = 7.0 ** ( 7.0 ** 7.0 ) or a = 7 ** ( 7 ** 7 ) etc floating point ( single and double ) return "+Inf" which is microchips positive-infinite symbol. integer (32 bit) returns a large integer which I guess is the remainder 32 bits. ed - that should be "mithimetecs" which is used for counting sheep in NZ ![]() |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
![]() Hey, that was uncalled for ![]() A small typo on top of my secondary English... But still goes well as "science for mates" No offence, kiiid. I was just poking fun at the typo is all. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |