NAME

Math::SlideRule - slide rule support for Perl

SYNOPSIS

Simulate an analog computer (without much nuance).

*** BETA interface, may change without warning ***

use Math::SlideRule;

my $sr = Math::SlideRule->new();

$sr->round(1.234); # 1.23 via sprintf()

# scientific notation breakdown
$sr->standard_form(1234); # [ 1.234, 3 ]

$sr->divide(75, 92);
$sr->multiply(1.5, 3.7);
$sr->multiply(-1.1, 2.2, -3.3, 4.4);

DESCRIPTION

Slide rule support for Perl. More rounding than perhaps is necessary is the main feature of this module. Math::SlideRule::PickettPocket approximates a N 3P-ES pocket slide rule.

METHODS

Calls will croak or die if something goes awry.

round rounds the input number via sprintf. It should be overridden in any subclasses to suit the particulars of the slide rule being implemented. Otherwise is mostly used internally.

standard_form returns a number as a list consisting of the characteristic and exponent of that number. Mostly used internally by various other routines.

multiply requires two (or more) numbers, multiples them, returns result. There's a divide as well. (There is no support for the combined multiplication and division tricks possible on a slide rule.)

BUGS

Reporting Bugs

If the bug is in the latest version, send a report to the author. Patches that fix problems or add new features are welcome.

http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Math-SlideRule

http://github.com/thrig/Math-SlideRule

Known Issues

round will need to be modified to specify what sort of rounding need be done, as the various scales have various resolutions possible (and may vary by the number under consideration, as square roots divide the scale into two, and cube roots that same space into three).

A more realistic implementation might use XS, and malloc a large amount of contiguous memory, and then "slide" pointers around therein to represent where the slider and hairline are. The scales would be mapped into this region of memory, so that address 0x0 would be 1 of the D scale, and the highest memory address 10 of that scale, and the other values laid out as appropriate between those posts. With a large amount of memory, suitable resolution might be gained, though rounding would be necessary for the many results that would fall into memory addresses not associated with some tick mark of the scale in question. (That the slider needs be movable and therefore the mapping of any scales on it might be tricky?)

AUTHOR

thrig - Jeremy Mates (cpan:JMATES) <jmates at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2014,2015 Jeremy Mates.

This module is free software; you can redistribute it and/or modify it under the Artistic License (2.0).