line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2011-2015 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.01. |
5
|
3
|
|
|
3
|
|
13117
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
67
|
|
6
|
3
|
|
|
3
|
|
8
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
71
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package POSIX::1003::Math; |
9
|
3
|
|
|
3
|
|
9
|
use vars '$VERSION'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
106
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.99_07'; |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
9
|
use base 'POSIX::1003::Module'; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
489
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my @constants; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Only from math.h. The first block are defined in POSIX.xs, the |
17
|
|
|
|
|
|
|
# second block present in Core. The last is from string.h |
18
|
|
|
|
|
|
|
our @IN_CORE = qw/abs exp log sqrt sin cos atan2 rand srand int/; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my @functions = qw/ |
21
|
|
|
|
|
|
|
acos asin atan ceil cosh floor fmod frexp |
22
|
|
|
|
|
|
|
ldexp log10 modf sinh tan tanh |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
div rint pow |
25
|
|
|
|
|
|
|
strtod strtol strtoul |
26
|
|
|
|
|
|
|
/; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
push @functions, @IN_CORE; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our %EXPORT_TAGS = |
31
|
|
|
|
|
|
|
( constants => \@constants |
32
|
|
|
|
|
|
|
, functions => \@functions |
33
|
|
|
|
|
|
|
, tables => [ '%math' ] |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $math; |
37
|
|
|
|
|
|
|
our %math; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
BEGIN { |
40
|
3
|
|
|
3
|
|
125
|
$math = math_table; |
41
|
3
|
|
|
|
|
31
|
push @constants, keys %$math; |
42
|
3
|
|
|
|
|
16
|
tie %math, 'POSIX::1003::ReadOnlyTable', $math; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# the argument to be optional is important for expression priority! |
47
|
0
|
|
|
0
|
1
|
0
|
sub acos(_) { goto &POSIX::acos } |
48
|
0
|
|
|
0
|
1
|
0
|
sub asin(_) { goto &POSIX::asin } |
49
|
0
|
|
|
0
|
1
|
0
|
sub atan(_) { goto &POSIX::atan } |
50
|
0
|
|
|
0
|
1
|
0
|
sub ceil(_) { goto &POSIX::ceil } |
51
|
0
|
|
|
0
|
1
|
0
|
sub cosh(_) { goto &POSIX::cosh } |
52
|
2
|
|
|
2
|
1
|
1474
|
sub floor(_) { goto &POSIX::floor } |
53
|
0
|
|
|
0
|
1
|
0
|
sub frexp(_) { goto &POSIX::frexp } |
54
|
0
|
|
|
0
|
1
|
0
|
sub ldexp(_) { goto &POSIX::ldexp } |
55
|
0
|
|
|
0
|
1
|
0
|
sub log10(_) { goto &POSIX::log10 } |
56
|
0
|
|
|
0
|
1
|
0
|
sub sinh(_) { goto &POSIX::sinh } |
57
|
0
|
|
|
0
|
1
|
0
|
sub tan(_) { goto &POSIX::tan } |
58
|
0
|
|
|
0
|
1
|
0
|
sub tanh(_) { goto &POSIX::tanh } |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
0
|
1
|
0
|
sub modf($$) { goto &POSIX::modf } |
61
|
0
|
|
|
0
|
1
|
0
|
sub fmod($$) { goto &POSIX::fmod } |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# All provided by POSIX.xs |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
0
|
1
|
0
|
sub div($$) { ( int($_[0]/$_[1]), ($_[0] % $_[1]) ) } |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
0
|
1
|
0
|
sub rint(;$) { my $v = @_ ? shift : $_; int($v + 0.5) } |
|
0
|
|
|
|
|
0
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
0
|
1
|
0
|
sub pow($$) { $_[0] ** $_[1] } |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
#------------------------------ |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub _create_constant($) |
79
|
92
|
|
|
92
|
|
70
|
{ my ($class, $name) = @_; |
80
|
92
|
|
|
|
|
72
|
my $val = $math->{$name}; |
81
|
92
|
|
|
0
|
|
320
|
sub () {$val}; |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |