blib/lib/Math/Fortran.pm untested

filter: Statementstmt 0.0% 0 / 13 Branchbran 0.0% 0 / 6 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 25 CC 4 SCAR 25.1
CC
4
Cov
0%
sign
20.0
log10
2.0
BEGIN
2.0
CRAP 12.3
1 # $Id: Fortran.pm,v 1.1 1995/12/26 09:43:01 willijar Exp $
2 =head1 NAME
3  
4 Math::Fortran - Perl implimentations of Fortrans sign and log10
5  
6 =head1 SYNOPSIS
7  
8 use Math::Fortran qw(log10 sign);
9 $v=log10($x);
10 $v=sign($y);
11 $v=sign($x,$y);
12  
13 =head1 DESCRIPTION
14  
15 This module provides and exports some mathematical functions which are
16 built in in Fortran but not in Perl. Currently there are only 2 included.
17  
18 =item B<log10> log to the base of 10
19 =item B<sign> with 1 parameter, +1 if $y>=0, -1 otherwise, with 2 parameters +abs($x) if $y>=0, -abs($x) otherwise.
20  
21 =head1 HISTORY
22  
23 $Log: Fortran.pm,v $
24 Revision 1.1 1995/12/26 09:43:01 willijar
25 Initial revision
26  
27  
28 =head1 BUGS
29  
30 I welcome other entries for this module and bug reports.
31  
32 =head1 AUTHOR
33  
34 John A.R. Williams <J.A.R.Williams@aston.ac.uk>
35  
36 =cut
37  
38 require Exporter;
39 package Math::Fortran;
40 @ISA=qw(Exporter);
41 @EXPORT_OK=qw(sign log10);
42 use strict;
43  
44 sub log10 { log($_[0])/log(10); }
45  
46 sub sign {
47 my ($a1,$a2)=@_;
48 if (defined $a2) {
49 return $a2>=0 ? abs($a1):-abs($a1);
50 }
51 return $a1>=0 ? +1 : -1;
52 }
53  
54 1;