Jerome Quelin > Language-Befunge > Language::Befunge::lib::MODU

Download:
Language-Befunge-4.13.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

Language::Befunge::IP::lib::MODU - Modulo Arithmetic extension

DESCRIPTION ^

The MODU fingerprint (0x4d4f4455) implements some of the finer, less-well- agreed-upon points of modulo arithmetic. With positive arguments, these instructions work exactly the same as % does. However, when negative values are involved, they all work differently.

FUNCTIONS ^

new

Create a new MODU instance.

Modulo implementations

$mod = M( $x, $y )

Signed-result modulo: x MOD y = x - FLOOR(x / y) * y

$mod = U( $x, $y )

Sam Holden's unsigned-result modulo... No idea who this Sam Holden is or if he has a special algorithm for this, therefore always returning absolute value of standard modulo.

$mod = R( $x, $y )

C-language integer remainder: old C leaves negative modulo undefined but C99 defines it as the same sign as the dividend so that's what we're going with.

SEE ALSO ^

Language::Befunge, http://catseye.tc/projects/funge98/library/MODU.html.

AUTHOR ^

Jerome Quelin, <jquelin@cpan.org>

COPYRIGHT & LICENSE ^

Copyright (c) 2001-2009 Jerome Quelin, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: