line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Math::BigInt::Named; |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
218909
|
use 5.006001; |
|
5
|
|
|
|
|
50
|
|
6
|
5
|
|
|
5
|
|
30
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
126
|
|
7
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
207
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
30
|
use Carp qw( carp croak ); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
368
|
|
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
6128
|
use Math::BigInt 1.97; |
|
5
|
|
|
|
|
145335
|
|
|
5
|
|
|
|
|
33
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Math::BigInt); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Globals. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our ($accuracy, $precision, $round_mode, $div_scale); |
19
|
|
|
|
|
|
|
$accuracy = undef; |
20
|
|
|
|
|
|
|
$precision = undef; |
21
|
|
|
|
|
|
|
$round_mode = 'even'; |
22
|
|
|
|
|
|
|
$div_scale = 40; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Not all of them exist yet. |
25
|
|
|
|
|
|
|
my $LANGUAGE = { |
26
|
|
|
|
|
|
|
en => 'english', |
27
|
|
|
|
|
|
|
de => 'german', |
28
|
|
|
|
|
|
|
sp => 'spanish', |
29
|
|
|
|
|
|
|
fr => 'french', |
30
|
|
|
|
|
|
|
ro => 'romana', |
31
|
|
|
|
|
|
|
it => 'italian', |
32
|
|
|
|
|
|
|
no => 'norwegian', |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Index of languages that have been loaded. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $LOADED = { }; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub name { |
40
|
|
|
|
|
|
|
# output the name of the number |
41
|
61
|
|
|
61
|
1
|
37911
|
my $x = shift; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# make Math::BigInt::Name -> name(123) work |
44
|
61
|
100
|
|
|
|
183
|
$x = $x -> new(shift) unless ref($x); |
45
|
|
|
|
|
|
|
|
46
|
61
|
100
|
|
|
|
208
|
return 'NaN' if $x -> is_nan(); |
47
|
|
|
|
|
|
|
|
48
|
60
|
|
|
|
|
402
|
my @args = (); |
49
|
60
|
100
|
|
|
|
152
|
if (@_) { |
50
|
58
|
50
|
|
|
|
127
|
if (ref($_[0]) eq 'HASH') { |
51
|
0
|
0
|
|
|
|
0
|
carp "When the options are given as a hash ref, additional", |
52
|
|
|
|
|
|
|
" arguments are ignored" if @_ > 1; |
53
|
0
|
|
|
|
|
0
|
@args = %{ $_[0] }; |
|
0
|
|
|
|
|
0
|
|
54
|
|
|
|
|
|
|
} else { |
55
|
58
|
|
|
|
|
139
|
@args = @_; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
60
|
|
|
|
|
87
|
my $lang; |
60
|
60
|
|
|
|
|
136
|
while (@args) { |
61
|
58
|
|
|
|
|
106
|
my $param = shift @args; |
62
|
58
|
50
|
|
|
|
123
|
croak "Parameter name can not be undefined" unless defined $param; |
63
|
58
|
50
|
|
|
|
122
|
croak "Parameter name can not be an empty string" unless length $param; |
64
|
|
|
|
|
|
|
|
65
|
58
|
50
|
|
|
|
249
|
if ($param =~ /^lang(uage)?$/) { |
66
|
58
|
|
|
|
|
107
|
$lang = shift @args; |
67
|
58
|
50
|
|
|
|
117
|
croak "Language can not be undefined" unless defined $lang; |
68
|
58
|
50
|
|
|
|
118
|
croak "Language can not be an empty string" unless length $lang; |
69
|
58
|
|
|
|
|
139
|
next; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
croak "Invalid parameter '$param'"; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
60
|
100
|
|
|
|
112
|
$lang = 'english' unless defined $lang; |
76
|
60
|
100
|
|
|
|
164
|
$lang = $LANGUAGE -> {$lang} if exists $LANGUAGE -> {$lang}; # en => english |
77
|
|
|
|
|
|
|
|
78
|
60
|
|
|
|
|
154
|
$lang = 'Math::BigInt::Named::' . ucfirst($lang); |
79
|
|
|
|
|
|
|
|
80
|
60
|
100
|
|
|
|
136
|
if (!defined $LOADED -> {$lang}) { |
81
|
4
|
|
|
|
|
9
|
my $file = $lang; |
82
|
4
|
|
|
|
|
24
|
$file =~ s|::|/|g; |
83
|
4
|
|
|
|
|
11
|
$file .= ".pm"; |
84
|
4
|
|
|
|
|
7
|
eval { require $file; }; |
|
4
|
|
|
|
|
2038
|
|
85
|
4
|
50
|
|
|
|
17
|
croak $@ if $@; |
86
|
4
|
|
|
|
|
13
|
$LOADED -> {$lang} = 1; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
60
|
|
|
|
|
188
|
my $y = $lang -> new($x); |
90
|
60
|
|
|
|
|
12137
|
$y -> name(); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub from_name { |
94
|
|
|
|
|
|
|
# Create a Math::BigInt::Name from a name string. Not implemented. |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
0
|
1
|
|
my $x = Math::BigInt -> bnan(); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |