Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
include "NSLog.incl"
|
||||
|
||||
local fn IntSqrt( x as SInt64 ) as SInt64
|
||||
SInt64 q = 1, z = x, r = 0, t
|
||||
do
|
||||
q = q * 4
|
||||
until ( q > x )
|
||||
while( q > 1 )
|
||||
q = q / 4 : t = z - r - q : r = r / 2
|
||||
if ( t > -1 ) then z = t : r = r + q
|
||||
wend
|
||||
end fn = r
|
||||
|
||||
SInt64 p
|
||||
NSInteger n
|
||||
CFNumberRef tempNum
|
||||
CFStringRef tempStr
|
||||
|
||||
NSLog( @"Integer square root for numbers 0 to 65:" )
|
||||
|
||||
for n = 0 to 65
|
||||
NSLog( @"%lld \b", fn IntSqrt( n ) )
|
||||
next
|
||||
NSLog( @"\n" )
|
||||
|
||||
NSLog( @"Integer square roots of odd powers of 7 from 1 to 21:" )
|
||||
NSLog( @" n | 7 ^ n | fn IntSqrt(7 ^ n)" )
|
||||
p = 7
|
||||
for n = 1 to 21 step 2
|
||||
tempNum = fn NumberWithLongLong( fn IntSqrt(p) )
|
||||
tempStr = fn NumberDescriptionWithLocale( tempNum, fn LocaleCurrent )
|
||||
NSLog( @"%2d | %18lld | %12s", n, p, fn StringUTF8String( tempStr ) )
|
||||
p = p * 49
|
||||
next
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue