Fdiv()

From TinyMUX
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

FUNCTION: fdiv(number1, number2)

Returns the floating-point quotient from dividing number1 by number2. number may be a floating-point number, and a floating-point result is returned.

Related Topics: add(), fmod(), mod(), mul(), round(), sub(), trunc().

Examples

> say fdiv(15,3)
You say "5"
> say fdiv(16,3)
You say "5.333333"
> say fdiv(17,3)
You say "5.666667"
> say fdiv(18,3)
You say "6"
> say fdiv(-17,3)
You say "-5.666667"
> say fdiv(10,3.5)
You say "2.857143"

Server Differences

The basic behavior of fdiv() is the same across PennMUSH, TinyMUSH, and TinyMUX, however, the usual floating-point differences apply. For example:

On PennMUSH, fdiv(1,1e-9) ==> '1000000000' while fdiv(1,1e-10) ==> '#-1 DIVISION BY ZERO'.
On TinyMUSH, fdiv(1,1e-10) ==> '10000000000' while fdiv(1,1e-130) ==> '9999999999999999366518088823188676468029287122850159299994507296276799832366962053631754981778769796749861527090709766158759755776'
On TinyMUX, fdiv(0,0) ==> 'Ind', fdiv(1,0) ==> '+Inf', fdiv(-1,0) ==> '-Inf', and fdiv(1,1e-130) ==> '9.999999999999999E129'.
RhostMUSH's fdiv() behavior equals that of TinyMUSH.