line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
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
|
|
|
|
|
|
|
=over |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=item B |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Log to the base of 10 |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=item B |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
With 1 parameter, +1 if $y >= 0, -1 otherwise. With 2 parameters +abs($x) if $y >= 0, -abs($x) otherwise. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=back |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 BUGS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
I welcome other entries for this module and bug reports. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 AUTHOR |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
John A.R. Williams B |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
John M. Gamble B (current maintainer) |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
require Exporter; |
43
|
|
|
|
|
|
|
package Math::Fortran; |
44
|
|
|
|
|
|
|
@ISA=qw(Exporter); |
45
|
|
|
|
|
|
|
@EXPORT_OK=qw(sign log10); |
46
|
1
|
|
|
1
|
|
24037
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
159
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
our $VERSION = 0.02; |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
1
|
|
sub log10 { log($_[0])/log(10); } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub sign { |
53
|
0
|
|
|
0
|
1
|
|
my ($a1,$a2)=@_; |
54
|
0
|
0
|
|
|
|
|
if (defined $a2) { |
55
|
0
|
0
|
|
|
|
|
return $a2>=0 ? abs($a1):-abs($a1); |
56
|
|
|
|
|
|
|
} |
57
|
0
|
0
|
|
|
|
|
return $a1>=0 ? +1 : -1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |