WeBWorKdocs

sq_webwork:


Home
Current UR courses
Visitor page
Intro to WeBWorK
WeBWorK 2 Twiki
WW Community
Grant Support & awards
Discussion group
Problem library
Write/modify problems
Create & manage course
Tutorial on running a course
HowTos
FAQ
WeBWorK2 FAQ
Software Download
How to Install WW server
Feedback
Site Map
Change preferences
Change password





Prev | Next | pod


Fraction

    This object is designed to ease the use of fractions

Variables and Methods

    Variables
        numerator   #numerator of fraction
        denominator #denominator of fraction
    Arithmetic Methods  #these will all accept a scalar value or
                #another fraction as an argument
        plus        #returns the sum of the fraction and argument
        minus       #returns fraction minus argument
        subtractFrom    #returns argument minus fraction
        divBy       #returns fraction divided by argument
        divInto     #returns argument divided by fraction
        times       #returns fraction times argument
        compare     #returns <, =, or > for the relation of fraction to argument
            pow     #returns fraction raised to argument, a given integer power
    Other methods

        reduce      #reduces to lowest terms, and makes sure denominator is positive
        scalar      #returns the scalar value numerator/denominator
        print       #prints the fraction
        print_mixed #prints the fractionas a mixed number
        print_inline    #prints the fraction like this 2/3

Synopsis

    The fraction object stores two variables, numerator and denominator.    The basic
arithmatic methods listed above can be performed on a fraction, and it can return 
 its own
scalar value for use with functions expecting a scalar (ie, sqrt($frac->scalar) ).

File path = /ww/webwork/pg/lib/Fraction.pm

<| Post or View Comments |>


Prev | Next | pod

Last update: Wednesday, May 15, 2002 at 8:49:00 PM.
This site maintained using Manila and Frontier software.