Perl Cd Bookshelf [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Perl Cd Bookshelf [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید



8.145. Math::BigRat


Allows you to use arbitrarily big
rationals. Math::BigRat is shipped with the Perl 5.8 source kit.

For example:

#!/usr/local/bin/perl -w
use Math::BigRat;
my $rat = Math::BigRat->new('2/7');
print $rat->bstr(), "\n";

Math::BigRat implements the following methods.

new


new(value)

Creates a new Math::BigRat object. You can use all types of input for
new(): '3/5',
'2/33', '6/9', etc.

denominator


denominator()

Returns a copy of the denominator as a positive BigInt:

my $rat = Math::BigRat->new('2/7')
print $rat->denominator(), "\n"; # Prints 7

numerator


numerator()

Returns a copy of the numerator as a signed BigInt:

my $rat = Math::BigRat->new('2/7');
print $rat->numerator(), "\n"; # Prints 2

parts


parts()

Returns a list consisting of a signed numerator and unsigned
denominator. Both are BigInts.

my($n, $d) = $rat->parts(); ### Ewwww, rat parts!
print "numerator: $n\n";
print "denominator: $d\n";



8.144. Math::BigInt::Calc8.146. Math::Complex




Copyright © 2002 O'Reilly & Associates. All rights reserved.

/ 875