Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/cmd/4th/examples/demo/squares.4th

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


( SQRT -- Integer square root with estimation of decimal )

[needs lib/math.4th]
[needs lib/fixeddot.4th]

: example  ( -- )  ( table of square roots from 500 to 1000 )
   ."  X      Square root X " cr
   100001 50000 do
     i dup 100 / 4 .r sqrt 2 spaces 4 1 .fr cr
   2500 +loop
;

example


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.