PHP 8.2.31
Preview: pi.rb Size: 381 B
/proc/thread-self/root/opt/alt/ruby40/share/gems/gems/bigdecimal-4.0.1/sample/pi.rb

#!/usr/local/bin/ruby
# frozen_string_literal: false

#
# pi.rb
#
# Calculates 3.1415.... (the number of times that a circle's diameter
# will fit around the circle) using J. Machin's formula.
#

require "bigdecimal"
require "bigdecimal/math.rb"

include BigMath

if ARGV.size == 1
    print "PI("+ARGV[0]+"):\n"
    p PI(ARGV[0].to_i)
else
    print "TRY: ruby pi.rb 1000 \n"
end

Directory Contents

Dirs: 0 × Files: 3

Name Size Perms Modified Actions
1.59 KB lrw-r--r-- 2026-05-21 12:15:23
Edit Download
851 B lrw-r--r-- 2026-05-21 12:15:23
Edit Download
381 B lrw-r--r-- 2026-05-21 12:15:23
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).