PCE version 4C man_modulenamespaceid_tablemodified current_idOIxN class/numberN referenceC hash_tablerefersizeOIxaIsNM.number.S.plusCman_method_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherit diagnosticsdefaultsbugsOIxNM.number.S.plusRICdateOIx,}ÊNplusnnnCchainsizeOIxIENM.number.S.divideXnnnsNV.number.valueCman_variable_card identifiermodule last_modifiednamesummary descriptionsee_alsoinheritdefaultsOIxNV.number.valueRIOIx,}ÅíNvaluenCstringOIxqRepresented value. This is an `int' and thus limited to the range `@pce <-min_integer' .. `@pce <-min_integer'nnnsNM.number.G.compareOI xNM.number.G.compareRIOI x,}ÇÂNcomparenOI xéCompare to the argument. The result `smaller' implies the receiver is smaller than the argument. Intended to support `chain ->sort' and friends. To sort a chain of integers by value: send(Chain, sort, ?(@arg1, compare, @arg2)).nnnnnsNC.numberCman_class_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherituser_interfacebugsOI xNC.numberRIOI x.ðHýNnumbernOIx×A number object represents an integer just like the primitive type `int'. Numbers are more costly, but allow for some operations such as comparison or addition. Instances of class number are commonly used to implement counters: count_instances(Device, Class, Instances) :- new(I, number(0)), send(Device, for_all, @default, if(message(@arg1, instance_of, Class), message(I, plus, 1))), get(I, value, Instances), send(I, done). See also class real.OIxIeN,$class/binary_expression$C.binary_expressioneN$class/pce$M.pce.G.max_integerEN $examples$8XnnnsNM.number.S.divideOIxNM.number.S.divideRIOIx0µœ·NdividenOIxïBasic arithmetic operations. Note that arithmetic may also be performed by the function classes /, +, - and *. Numbers are useful as `accumulators' (see the various examples in this class). Functions are more convenient in expressions.nnnnnsNM.number.S.less_equalOIxNM.number.S.less_equalRIOIx,}ÈtN less_equalnnnOIxIENM.number.S.largerXnnnsNM.number.G.catch_allOIxNM.number.G.catch_allRIOIx,}ÆíN catch_allnOIxmMakes all `send' operations available as get operations so that the receiving number is not modified: ?- new(N, number(2)), get(N, plus, 3, N2), get(N2, value, V2). V2 = 5 N2 = @1687003/number N = @1686999/number First creates a new number object with the same <-value, invokes the method as a send method and, if the send succeeds, returns the copy.nnnnnsNM.number.S.equalOIxNM.number.S.equalRIOIx,}ÈCNequalnOIx6Succeeds if the argument represents the same value. Note that PCE type conversion converts real objects, number objects and text to ints and thus all the following succeed: ?- send(number(1), equal, 1). ?- send(number(1), equal, 1.0). ?- send(number(1), equal, number(1)). ?- send(number(1), equal, '1').nnnnnsNM.number.S.minimumOIxNM.number.S.minimumRIOIx,}É NminimumnnnOIxIENM.number.S.maximumXnnnsNM.number.S.largerOIxNM.number.S.largerRIOI x,}ÈÖNlargernOI!xzCompare the receiver to the argument by value. The receiver is tested to be {->larger, ->smaller, ...} than the argument.nnnnnsNM.number.S.minusOI"xNM.number.S.minusRIOI#x,}ÊNminusnnnOI$xIENM.number.S.divideXnnnsNM.number.S.not_equalOI%xNM.number.S.not_equalRIOI&x,}ÈyN not_equalnnnOI'xIENM.number.S.largerXnnnsNM.number.S.larger_equalOI(xNM.number.S.larger_equalRIOI)x,}ÈqN larger_equalnnnOI*xIENM.number.S.largerXnnnsNM.number.S.smallerOI+xNM.number.S.smallerRIOI,x,}È~NsmallernnnOI-xIENM.number.S.largerXnnnsNM.number.S.timesOI.xNM.number.S.timesRIOI/x,}ÊNtimesnnnOI0xIENM.number.S.divideXnnnsNM.number.S.maximumOI1xNM.number.S.maximumRIOI2x,}ÉîNmaximumnOI3xˆSet <-value to the {->maximum, ->minimum} of the current <-value and the argument. Useful in may computations. Suppose `Chain' is a chain holding string and we which to know the widest string given the font `Font': width_of_strings(Chain, Font, Width) :- new(W, number(0)), send(Chain, for_all, message(W, maximum, ?(Font, width, @arg1))), get(W, value, Width), send(W, done).nnnnnXuCnumber O I4xx