NAME

Math::SlideRule - slide rule support for Perl

SYNOPSIS

Simulate an analog computer.

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

use Math::SlideRule;

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

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

# these use the "C/D" scales, or values from 1..10 with some
# degree of precision
$sr->divide(75, 92);
$sr->multiply(1.5, 3.7);
$sr->multiply(-1.1, 2.2, -3.3, 4.4);

# this uses an A/B to C/D scale conversion
$sr->sqrt(42);

DESCRIPTION

Slide rule support for Perl. Or, a complicated way to perform basic mathematical operations on a digital computer. Math::SlideRule::PickettPocket approximates a N 3P-ES pocket slide rule. Useful uses of this code might be to investiage how much error calculations on a slide rule can rack up, I guess?

METHODS

Calls will throw an exception if something goes awry.

divide n1, n2, ...

Divide the given numbers.

multiply n1, n2, ...

Multiply the given numbers.

$sr->multiply(2, 3);    # 6 (or so)
$sr->multiply(2..5);    # 120 (ish)
sqrt num

Take the square root of the given number.

standard_form num, [ min, max ]

This method returns a number as a list consisting of the characteristic, exponent, and whether the number is negative or not. Used internally by various methods.

$sr->standard_form(5550)    # 5.55, 3, 0
$sr->standard_form(-640)    # 6.4,  2, 1

The optional min and max values allow for a normal form between values besides the defaults of 1 and 10, though using a minimum value below 1 may result in unexpected or undefined results, elsewhere.

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

Incomplete implementation, e.g. missing log, trig scales.

SEE ALSO

Math::Round for various rounding methods (and the usual disclaimers about floating point numbers that this module does use).

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).