Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

iPad speeds

dave1707dave1707 Mod
edited September 25 in General Posts: 7,860

I had the opportunity to try my Pi program on 4 different iPads to see what the speed differences were. I ran the program which is set to calculate 25,000 digits of Pi. I commented out the line that prints the digits. This was on an iPad 1, an iPad Air 1, an iPad Pro 1, and an iPad Air 3. I ran it several times on each iPad and selected the lowest time. Here are the results. You can try this on your iPad and post your time.

iPad 1      178 seconds
iPad Air 1  14.03 seconds
iPad Pro 1  7.19 seconds    (12.9”)
iPad Air 3   4.93 seconds
function setup()
   s=require("socket")
   local digits=25000 -- number of digits of Pi
   print("Calculating "..digits.." digits of pi.")
   local pi,tab={},{}
   local size=math.ceil(digits/7)+1
   local size1=math.ceil(size*7)
   local sum,carry,b,z2
   local d1,d2=10000000,9999999 
   local str=""
   start=s.gettime()
   for z=0,size1 do
       tab[z]=5*z+3
   end   
   for t=1,size do
       carry=0
       for z=size1,0,-1 do
           z2=z*z
           sum=tab[z]*d1+carry
           b=27*(z2+z)+6
           tab[z]=sum%b
           carry=(sum//b)*(2*z2-z)
       end       
       tab[0]=sum%d1
       table.insert(pi,sum//d1)
   end    
   carry=0
   for z=size,1,-1 do
       b=pi[z]+carry
       if b>d2 then
           b=b-d1
           carry=1
       else
           carry=0
       end
       pi[z]=string.format("%07d",b)
   end    
   pi[1]="3.\n"
   str=table.concat(pi)
   --print(string.sub(str,1,digits+2))
   print(digits.."  digits of Pi in "..s.gettime()-start,"seconds")
end

Comments

  • Posts: 122
    iPhone 6+
    25000 digits of Pi in 13.592967033386 seconds
  • SimeonSimeon Admin Mod
    Posts: 5,054

    iPhone X: 5.5s
    iPad Pro (3rd gen): 4.95s

  • Posts: 742
    iPhone SE 8.8s
  • edited September 28 Posts: 1,360

    iPad Pro 9.7” - 7.1996 rounded to 4 dec places, now using iOS 13.1 (or iPadOS) which is supposed to be a little faster than iOS 12.

  • edited September 28 Posts: 5

    Ipad pro 3rd
    4.92 seconds

Sign In or Register to comment.