line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Math::BigInt::Named; |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
216748
|
use 5.006001; |
|
5
|
|
|
|
|
54
|
|
6
|
5
|
|
|
5
|
|
28
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
137
|
|
7
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
191
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
29
|
use Carp qw( carp croak ); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
377
|
|
10
|
|
|
|
|
|
|
|
11
|
5
|
|
|
5
|
|
6150
|
use Math::BigInt 1.97; |
|
5
|
|
|
|
|
147575
|
|
|
5
|
|
|
|
|
34
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Math::BigInt); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.06'; |
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
|
60
|
|
|
60
|
1
|
39536
|
my $x = shift; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# make Math::BigInt::Name -> name(123) work |
44
|
60
|
100
|
|
|
|
180
|
$x = $x -> new(shift) unless ref($x); |
45
|
|
|
|
|
|
|
|
46
|
60
|
100
|
|
|
|
219
|
return 'NaN' if $x -> is_nan(); |
47
|
|
|
|
|
|
|
|
48
|
59
|
|
|
|
|
397
|
my @args = (); |
49
|
59
|
100
|
|
|
|
135
|
if (@_) { |
50
|
57
|
50
|
|
|
|
130
|
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
|
57
|
|
|
|
|
129
|
@args = @_; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
59
|
|
|
|
|
87
|
my $lang; |
60
|
59
|
|
|
|
|
133
|
while (@args) { |
61
|
57
|
|
|
|
|
110
|
my $param = shift @args; |
62
|
57
|
50
|
|
|
|
140
|
croak "Parameter name can not be undefined" unless defined $param; |
63
|
57
|
50
|
|
|
|
119
|
croak "Parameter name can not be an empty string" unless length $param; |
64
|
|
|
|
|
|
|
|
65
|
57
|
50
|
|
|
|
248
|
if ($param =~ /^lang(uage)?$/) { |
66
|
57
|
|
|
|
|
103
|
$lang = shift @args; |
67
|
57
|
50
|
|
|
|
105
|
croak "Language can not be undefined" unless defined $lang; |
68
|
57
|
50
|
|
|
|
111
|
croak "Language can not be an empty string" unless length $lang; |
69
|
57
|
|
|
|
|
138
|
next; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
0
|
croak "Invalid parameter '$param'"; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
59
|
100
|
|
|
|
127
|
$lang = 'english' unless defined $lang; |
76
|
59
|
100
|
|
|
|
169
|
$lang = $LANGUAGE -> {$lang} if exists $LANGUAGE -> {$lang}; # en => english |
77
|
|
|
|
|
|
|
|
78
|
59
|
|
|
|
|
165
|
$lang = 'Math::BigInt::Named::' . ucfirst($lang); |
79
|
|
|
|
|
|
|
|
80
|
59
|
100
|
|
|
|
128
|
if (!defined $LOADED -> {$lang}) { |
81
|
3
|
|
|
|
|
223
|
eval "require $lang;"; |
82
|
3
|
50
|
|
|
|
15
|
croak "Can't load module '$lang'" if $@; |
83
|
3
|
|
|
|
|
10
|
$LOADED -> {$lang} = 1; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
59
|
|
|
|
|
174
|
my $y = $lang -> new($x); |
87
|
59
|
|
|
|
|
11748
|
$y -> name(); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub from_name { |
91
|
|
|
|
|
|
|
# Create a Math::BigInt::Name from a name string. Not implemented. |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
1
|
|
my $x = Math::BigInt -> bnan(); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |