PlanePath/VogelFloret.pm

filter: Statementstmt 62.2% 79 / 127 Branchbran 29.4% 10 / 34 Conditioncond 53.8% 14 / 26 MC/DCmcdc 18.7% 3 / 16 Subroutinesub 71.4% 20 / 28 Podpod 100% 11 / 11 totaltotal 56.6% 137 / 242 CC 27 SCAR 25.2
CC
27
Cov
55%
n_to_xy
42.0
xy_to_n
42.0
rect_to_n_range
10.6
CRAP 12.5
« PlanePath/RationalsTree.pm ↑ Summary PlanePath/KochSnowflakes.pm »
1 # Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Kevin Ryde
2  
3 # This file is part of Math-PlanePath.
4 #
5 # Math-PlanePath is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any later
8 # version.
9 #
10 # Math-PlanePath is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>.
17  
18  
19 # n_start=>0 to include N=0 at the origin, but that not a documented feature
20 # yet.
21  
22 # http://algorithmicbotany.org/papers/#abop
23 #
24 # http://www.sciencedirect.com/science/article/pii/0025556479900804
25 # http://dx.doi.org/10.1016/0025-5564(79)90080-4 Helmut Vogel, "A Better Way
26 # to Construct the Sunflower Head", Volume 44, Issues 3-4, June 1979, Pages
27 # 179-189
28  
29 # http://artemis.wszib.edu.pl/~sloot/2_1.html
30 #
31 # http://www.csse.monash.edu.au/publications/2003/tr-2003-149-full.pdf
32 # on 3D surfaces of revolution or some such maybe
33 # 14 Mbytes (or preview with google)
34  
35 # Count of Zeckendorf bits plotted on Vogel floret.
36 # Zeckendorf/Fibbinary with N bits makes radial spokes. cf FibbinaryBitCount
37 # http://www.ms.unimelb.edu.au/~segerman/papers/sunflower_spiral_fibonacci_metric.pdf
38 # private copy ?
39  
40 # closest two for phi are 1 and 4
41 # n=1 r=sqrt(1) = 1
42 # t=1/phi^2 = 0.381 around
43 # x=-.72 y=.68
44 # n=4 r=sqrt(4) = 2
45 # t=4/phi^2 = 1.527 = .527 around
46 # x=-1.97 y=-.337
47 # diff angle=4/phi^2 - 1/phi^2 = 3/phi^2 = 3*(2-phi) = 1.14 = .14
48 # diff dx=1.25 dy=1.017 hypot=1.61
49 # dang = 2*PI()*(5-3*phi)
50 # y = sin()
51 # x = sin(2*PI()*(5-3*phi))
52  
53 # Continued fraction
54 # 1
55 # x = k + ------
56 # k + 1
57 # ------
58 # k + 1
59 # ---
60 # k + ...
61 #
62 # x = k + 1/x
63 # (x-k/2)^2 = 1 + (k^2)/4
64 #
65 # k + sqrt(4+k^2)
66 # x = ---------------
67 # 2
68 #
69 # k x
70 # 1 (1+sqrt(5)) / 2
71 # 2 1 + sqrt(2)
72 # 3 (3+sqrt(13)) / 2
73 # 4 2 + sqrt(5)
74 # 5 (5 + sqrt(29)) / 2
75 # 6 3 + sqrt(10)
76 # 2e e + sqrt(1+e^2) even
77  
78  
79  
80 package Math::PlanePath::VogelFloret;
81 2 ▶use 5.004;
Subroutine BEGIN: called CC=1 SCAR=0.0
82 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
83 2 ▶use Carp 'croak';
Subroutine BEGIN: called CC=1 SCAR=0.0
84 2 ▶use Math::Libm 'hypot';
Subroutine BEGIN: called CC=1 SCAR=0.0
85  
86 2 ▶use vars '$VERSION', '@ISA';
Subroutine BEGIN: called CC=1 SCAR=0.0
87 2 $VERSION = 128;
88 2 ▶use Math::PlanePath;
Subroutine BEGIN: called CC=1 SCAR=0.0
89 2 @ISA = ('Math::PlanePath');
90  
91 use Math::PlanePath::Base::Generic
92 2 ▶ 'is_infinite';
Subroutine BEGIN: called CC=1 SCAR=0.0
93 2 ▶use Math::PlanePath::SacksSpiral;
Subroutine BEGIN: called CC=1 SCAR=0.0
94  
95 # uncomment this to run the ### lines
96 #use Smart::Comments '###';
97  
98 2 ▶use constant figure => 'circle';
Subroutine BEGIN: called CC=1 SCAR=0.0
99  
100 2 ▶use constant 1.02; # for leading underscore
Subroutine BEGIN: called CC=1 SCAR=0.0
101 2 ▶use constant _PHI => (1 + sqrt(5)) / 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
102 2 ▶use constant _TWO_PI => 4*atan2(1,0);
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 # not documented yet ...
105 2 use constant rotation_types =>
106 { phi => { rotation_factor => 2 - _PHI(),
107 radius_factor => 0.624239116809924,
108 # closest_Ns => [ 1,4 ],
109 # continued_frac => [ 1,1,1,1,1,... ],
110 },
111 sqrt2 => { rotation_factor => sqrt(2)-1,
112 radius_factor => 0.679984167849259,
113 # closest_Ns => [ 3,8 ],
114 # continued_frac => [ 2,2,2,2,2,... ],
115 },
116 sqrt3 => { rotation_factor => sqrt(3)-1,
117 radius_factor => 0.755560810248419,
118 # closest_Ns => [ 3,7 ],
119 # continued_frac => [ 1,2,1,2,1,2,1,2,... ],
120 },
121 sqrt5 => { rotation_factor => sqrt(5)-2,
122 radius_factor => 0.853488207169303,
123 # closest_Ns => [ 4,8 ],
124 # continued_frac => [ 4,4,4,4,4,4,... ],
125 },
126 2 ▶ };
Subroutine BEGIN: called CC=1 SCAR=0.0
127  
128 2 use constant parameter_info_array =>
129 [
130 {
131 name => 'rotation_type',
132 type => 'enum',
133 display => 'Rotation Type',
134 share_key => 'vogel_rotation_type',
135 choices => ['phi', 'sqrt2', 'sqrt3', 'sqrt5', 'custom'],
136 default => 'phi',
137 },
138 {
139 name => 'rotation_factor',
140 type => 'float',
141 type_hint => 'expression',
142 display => 'Rotation Factor',
143 description => 'Rotation factor. If you have Math::Symbolic then this can be an expression like pi+2*e-phi (constants phi,e,gam,pi), otherwise it should be a plain number.',
144 default => - (1 + sqrt(5)) / 2,
145 default_expression => '-phi',
146 width => 10,
147 when_name => 'rotation_type',
148 when_value => 'custom',
149 },
150 { name => 'radius_factor',
151 display => 'Radius Factor',
152 description => 'Radius factor, spreading points out to make them non-overlapping. 0 means the default factor.',
153 type => 'float',
154 minimum => 0,
155 maximum => 999,
156 page_increment => 1,
157 step_increment => .1,
158 decimals => 2,
159 default => 1,
160 when_name => 'rotation_type',
161 when_value => 'custom',
162 },
163 2 ▶ ];
Subroutine BEGIN: called CC=1 SCAR=0.0
164  
165 sub x_negative_at_n {
166 0 ▶ my ($self) = @_;
Subroutine x_negative_at_n: not called CC=1 SCAR=6.9
Pod documented
167 0 return int(.25 / $self->{'rotation_factor'}) + 1;
168 }
169 sub y_negative_at_n {
170 0 ▶ my ($self) = @_;
Subroutine y_negative_at_n: not called CC=1 SCAR=6.9
Pod documented
171 0 return int(.5 / $self->{'rotation_factor'}) + 1;
172 }
173 sub sumabsxy_minimum {
174 0 ▶ my ($self) = @_;
Subroutine sumabsxy_minimum: not called CC=1 SCAR=6.9
Pod documented
175 0 my ($x,$y) = $self->n_to_xy($self->n_start);
176 0 return abs($x)+abs($y);
177 }
178 sub rsquared_minimum {
179 0 ▶ my ($self) = @_;
Subroutine rsquared_minimum: not called CC=1 SCAR=6.9
Pod documented
180 # starting N=1 at R=radius_factor*sqrt(1), theta=something
181 0 return $self->{'radius_factor'} ** 2;
182 }
183 2 ▶use constant gcdxy_maximum => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
184  
185 sub turn_any_left { # always left if rot<=0.5
186 0 ▶ my ($self) = @_;
Subroutine turn_any_left: not called CC=1 SCAR=6.9
Pod documented
187 0 return ($self->{'rotation_factor'} <= 0.5);
188 }
189 sub turn_any_right { # always left if rot<=0.5
190 0 ▶ my ($self) = @_;
Subroutine turn_any_right: not called CC=1 SCAR=6.9
Pod documented
191 0 return ($self->{'rotation_factor'} > 0.5);
192 }
193 2 ▶use constant turn_any_straight => 0; # never straight
Subroutine BEGIN: called CC=1 SCAR=0.0
194  
195  
196 #------------------------------------------------------------------------------
197  
198 sub new {
199 11 ▶ my $self = shift->SUPER::new (@_);
Subroutine new: called CC=6 SCAR=18.5
Pod documented
200 ### $self
201  
202 11 ▶ my $rotation_type = ($self->{'rotation_type'} ||= 'phi');
Condition100%2/2
$self->{"rotation_type"} ||= "phi"
l!l
29
MC/DC100%1/1
$self->{"rotation_type"} ||= "phi"
$self->{"rotation_type"}
Truth table100%2/2
A
A= $self->{"rotation_type"}
Aresult
11
00
203 11 ▶ my $defaults = rotation_types()->{$rotation_type}
Condition33%1/3
{phi => {radius_factor => 0.624239116809924, rotation_factor => 0.38196601125010509747}, sqrt2 => {radius_factor => 0.679984167849259, rotation_factor => 0.41421356237309514547}, sqrt3 => {radius_factor => 0.755560810248419, rotation_factor => 0.73205080756887719318}, sqrt5 => {radius_factor => 0.853488207169303, rotation_factor => 0.23606797749978980505}}->{$rotation_type} || croak('Unrecognised rotation_type: "', $rotation_type, '"')
l!l&&r!l&&!r
1100
MC/DC0%0/2
{phi => {radius_factor => 0.624239116809924, rotation_factor => 0.38196601125010509747}, sqrt2 => {radius_factor => 0.679984167849259, rotation_factor => 0.41421356237309514547}, sqrt3 => {radius_factor => 0.755560810248419, rotation_factor => 0.73205080756887719318}, sqrt5 => {radius_factor => 0.853488207169303, rotation_factor => 0.23606797749978980505}}->{$rotation_type} || croak('Unrecognised rotation_type: "', $rotation_type, '"')
{phi => {radius_factor => 0.624239116809924, rotation_factor => 0.38196601125010509747}, sqrt2 => {radius_factor => 0.679984167849259, rotation_factor => 0.41421356237309514547}, sqrt3 => {radius_factor => 0.755560810248419, rotation_factor => 0.73205080756887719318}, sqrt5 => {radius_factor => 0.853488207169303, rotation_factor => 0.23606797749978980505}}->{$rotation_type} croak('Unrecognised rotation_type: "', $rotation_type, '"')
Truth table33%1/3
A || B
A= {phi => {radius_factor => 0.624239116809924, rotation_factor => 0.38196601125010509747}, sqrt2 => {radius_factor => 0.679984167849259, rotation_factor => 0.41421356237309514547}, sqrt3 => {radius_factor => 0.755560810248419, rotation_factor => 0.73205080756887719318}, sqrt5 => {radius_factor => 0.853488207169303, rotation_factor => 0.23606797749978980505}}->{$rotation_type}B= croak('Unrecognised rotation_type: "', $rotation_type, '"')
ABresult
1X1
011
000
204 || croak 'Unrecognised rotation_type: "',$rotation_type,'"';
205  
206 $self->{'radius_factor'} ||= ($self->{'rotation_factor'}
207 ? 1.0
208 11 ▶ : $defaults->{'radius_factor'});
Branch: 1 branch
BranchTrueFalseTotal
$self->{'rotation_factor'} ? : 1 5 6
Condition66%2/3
$self->{"radius_factor"} ||= $self->{"rotation_factor"} ? 1 : $defaults->{"radius_factor"}
l!l&&r!l&&!r
560
MC/DC0%0/2
$self->{"radius_factor"} ||= $self->{"rotation_factor"} ? 1 : $defaults->{"radius_factor"}
$self->{"radius_factor"} $self->{"rotation_factor"} ? 1 : $defaults->{"radius_factor"}
Truth table66%2/3
A ||= B
A= $self->{"radius_factor"}B= $self->{"rotation_factor"} ? 1 : $defaults->{"radius_factor"}
ABresult
1X1
011
000
209 11 ▶ $self->{'rotation_factor'} ||= $defaults->{'rotation_factor'};
Condition66%2/3
$self->{"rotation_factor"} ||= $defaults->{"rotation_factor"}
l!l&&r!l&&!r
1100
MC/DC0%0/2
$self->{"rotation_factor"} ||= $defaults->{"rotation_factor"}
$self->{"rotation_factor"} $defaults->{"rotation_factor"}
Truth table66%2/3
A ||= B
A= $self->{"rotation_factor"}B= $defaults->{"rotation_factor"}
ABresult
1X1
011
000
210 11 return $self;
211 }
212  
213 # R=radius_factor*sqrt($n)
214 # R^2 = radius_factor^2 * $n
215 # avoids sqrt and sin/cos in the main n_to_xy()
216 #
217 sub n_to_rsquared {
218 8 ▶ my ($self, $n) = @_;
Subroutine n_to_rsquared: called CC=5 SCAR=16.3
Pod documented
219 ### VogelFloret RSquared: $i, $seq->{'planepath_object'}
220  
221 8 ▶ if ($n < 0) { return undef; }
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) 0 8 8
222 8 my $rf = $self->{'radius_factor'};
223 8 $rf *= $rf; # squared
224  
225 # don't round BigInt*flonum if radius_factor is not an integer, promote to
226 # BigFloat instead
227 8 ▶ if (ref $n && $n->isa('Math::BigInt') && $rf != int($rf)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n and $n->isa("Math::BigInt") and $rf != int $rf) 1 7 8
Condition83%5/6
ref $n and $n->isa("Math::BigInt") and $rf != int $rf
!ll&&!rl&&r
611
ref $n and $n->isa("Math::BigInt")
!ll&&!rl&&r
602
MC/DC66%2/3
ref $n and $n->isa("Math::BigInt") and $rf != int $rf
ref $n $n->isa("Math::BigInt") $rf != int $rf
Truth table75%3/4
A and B and C
A= ref $nB= $n->isa("Math::BigInt")C= $rf != int $rf
ABCresult
0XX0
10X0
1100
1111
228 1 require Math::BigFloat;
229 1 $n = Math::BigFloat->new($n);
230 }
231 8 return $n * $rf;
232 }
233  
234  
235 sub n_to_xy {
236 0 ▶ my ($self, $n) = @_;
Subroutine n_to_xy: not called CC=6 SCAR=37.4
Pod documented
237 0 ▶ if ($n < 0) { return; }
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) 0 0 0
238  
239 0 my $two_pi = _TWO_PI();
240  
241 0 ▶ if (ref $n) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n) 0 0 0
242 0 ▶ if ($n->isa('Math::BigInt')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n->isa("Math::BigInt")) 0 0 0
243 0 $n = Math::PlanePath::SacksSpiral::_bigfloat()->new($n);
244 }
245 0 ▶ if ($n->isa('Math::BigRat')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n->isa("Math::BigRat")) 0 0 0
246 0 $n = $n->as_float;
247 }
248 0 ▶ if ($n->isa('Math::BigFloat')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n->isa("Math::BigFloat")) 0 0 0
249 0 $two_pi = 2 * Math::BigFloat->bpi;
250 }
251 }
252  
253 0 my $r = sqrt($n) * $self->{'radius_factor'};
254  
255 # take the frac part of 1==circle and then convert to radians, so as not
256 # to lose precision in an fmod(...,2*pi)
257 #
258 0 my $theta = $n * $self->{'rotation_factor'}; # 1==full circle
259 0 $theta = $two_pi * ($theta - int($theta)); # radians 0 to 2*pi
260 0 return ($r * cos($theta),
261 $r * sin($theta));
262  
263 # cylindrical_to_cartesian() is only perl code, so may as well sin/cos
264 # here directly
265 # return (Math::Trig::cylindrical_to_cartesian($r, $theta, 0))[0,1];
266 }
267  
268 sub xy_to_n {
269 0 ▶ my ($self, $x, $y) = @_;
Subroutine xy_to_n: not called CC=6 SCAR=37.4
Pod documented
270  
271 # Slack approach just trying all the N values between r-.5 and r+.5.
272 #
273 # r = sqrt(n)*FACTOR
274 # n = (r/FACTOR)^2
275 #
276 # The target N satisfies N = K * phi + epsilon for integer K. What's an
277 # easy way to find the first integer N >= (r-.5)**2 satisfying -small <= N
278 # mod .318 <= +small ?
279 #
280 0 my $r = sqrt($x*$x + $y*$y); # hypot
281 0 my $factor = $self->{'radius_factor'};
282 0 my $n_lo = int( (($r-.6)/$factor)**2 );
283 0 ▶ if ($n_lo < 0) { $n_lo = 0; }
Branch: 1 branch
BranchTrueFalseTotal
if ($n_lo < 0) 0 0 0
284 0 my $n_hi = int( (($r+.6)/$factor)**2 + 1 );
285 #### $r
286 #### xy: "$x,$y"
287 #### $n_lo
288 #### $n_hi
289  
290 0 ▶ if (is_infinite($n_lo) || is_infinite($n_hi)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_infinite($n_lo) or is_infinite($n_hi)) 0 0 0
Condition0%0/3
is_infinite($n_lo) or is_infinite($n_hi)
l!l&&r!l&&!r
000
MC/DC0%0/2
is_infinite($n_lo) or is_infinite($n_hi)
is_infinite($n_lo) is_infinite($n_hi)
Truth table0%0/3
A or B
A= is_infinite($n_lo)B= is_infinite($n_hi)
ABresult
1X1
011
000
291 ### infinite range, r inf or too big
292 0 return undef;
293 }
294  
295 # for(;;) loop since "reverse $n_lo..$n_hi" limited to IV range
296 0 ▶ for (my $n = $n_hi; $n >= $n_lo; $n--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n >= $n_lo) 0 0 0
297 0 my ($nx, $ny) = $self->n_to_xy($n);
298 ### hypot: "$n ".hypot($nx-$x,$ny-$y)
299 0 ▶ if (hypot($nx-$x,$ny-$y) <= 0.5) {
Branch: 1 branch
BranchTrueFalseTotal
if (&hypot($nx - $x, $ny - $y) <= "0.5") 0 0 0
300 #### found: $n
301 0 return $n;
302 }
303 }
304 0 return undef;
305  
306 # my $theta_frac = Math::PlanePath::MultipleRings::_xy_to_angle_frac($x,$y);
307 # ### assert: 0 <= $frac && $frac < 1
308 #
309 # # seeking integer k where (k+theta)*PHIPHI == $r*$r == $n or nearby
310 # my $k = $r*$r / (PHI*PHI) - $theta;
311 #
312 # ### $x
313 # ### $y
314 # ### $r
315 # ### $theta
316 # ### $k
317 #
318 # foreach my $ki (POSIX::floor($k), POSIX::ceil($k)) {
319 # my $n = int (($ki+$theta)*PHI*PHI + 0.5);
320 #
321 # # look for within 0.5 radius
322 # my ($nx, $ny) = $self->n_to_xy($n);
323 # ### $ki
324 # ### n frac: ($ki+$theta)*PHI*PHI
325 # ### $n
326 # ### hypot: hypot($nx-$x,$ny-$y)
327 # if (hypot($nx-$x,$ny-$y) <= 0.5) {
328 # return $n;
329 # }
330 # }
331 # return;
332 }
333  
334 # max corner at R
335 # R+0.5 = sqrt(N) * radius_factor
336 # sqrt(N) = (R+0.5)/rfactor
337 # N = (R+0.5)^2 / rfactor^2
338 # = (R^2 + R + 1/4) / rfactor^2
339 # <= (X^2+Y^2 + X+Y + 1/4) / rfactor^2
340 # <= (X(X+1) + Y(Y+1) + 1) / rfactor^2
341 #
342 # min corner at R
343 # R-0.5 = sqrt(N) * radius_factor
344 # sqrt(N) = (R-0.5)/rfactor
345 # N = (R-0.5)^2 / rfactor^2
346 # = (R^2 - R + 1/4) / rfactor^2
347 # >= (X^2+Y^2 - (X+Y)) / rfactor^2 because x+y >= r
348 # = (X(X-1) + Y(Y-1)) / rfactor^2
349  
350 # not exact
351 sub rect_to_n_range {
352 1 ▶ my $self = shift;
Subroutine rect_to_n_range: called CC=7 SCAR=23.6
Pod documented
353 ### VogelFloret rect_to_n_range(): @_
354 1 my ($n_lo, $n_hi) = Math::PlanePath::SacksSpiral->rect_to_n_range(@_);
355  
356 1 my $rf = $self->{'radius_factor'};
357 1 $rf *= $rf; # squared
358  
359 # avoid BigInt/flonum if radius_factor is not an integer, promote to
360 # BigFloat instead
361 1 ▶ if ($rf == int($rf)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rf == int $rf) { } 0 1 1
362 0 $n_hi += $rf-1; # division round upwards
363 } else {
364 1 ▶ if (ref $n_lo && $n_lo->isa('Math::BigInt')) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n_lo and $n_lo->isa("Math::BigInt")) 0 1 1
Condition33%1/3
ref $n_lo and $n_lo->isa("Math::BigInt")
!ll&&!rl&&r
100
MC/DC0%0/2
ref $n_lo and $n_lo->isa("Math::BigInt")
ref $n_lo $n_lo->isa("Math::BigInt")
Truth table33%1/3
A and B
A= ref $n_loB= $n_lo->isa("Math::BigInt")
ABresult
0X0
100
111
365 0 require Math::BigFloat;
366 0 $n_lo = Math::BigFloat->new($n_lo);
367 }
368 1 ▶ if (ref $n_hi && $n_lo->isa('Math::BigInt')) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n_hi and $n_lo->isa("Math::BigInt")) 0 1 1
Condition33%1/3
ref $n_hi and $n_lo->isa("Math::BigInt")
!ll&&!rl&&r
100
MC/DC0%0/2
ref $n_hi and $n_lo->isa("Math::BigInt")
ref $n_hi $n_lo->isa("Math::BigInt")
Truth table33%1/3
A and B
A= ref $n_hiB= $n_lo->isa("Math::BigInt")
ABresult
0X0
100
111
369 0 require Math::BigFloat;
370 0 $n_hi = Math::BigFloat->new($n_hi);
371 }
372 }
373  
374 1 $n_lo = int($n_lo / $rf);
375 1 ▶ if ($n_lo < 1) { $n_lo = 1; }
Branch: 1 branch
BranchTrueFalseTotal
if ($n_lo < 1) 1 0 1
376  
377 1 $n_hi = _ceil($n_hi / $rf);
378  
379 1 return ($n_lo, $n_hi);
380 }
381  
382 sub _ceil {
383 1 ▶ my ($x) = @_;
Subroutine _ceil: called CC=2 SCAR=7.1
384 1 my $int = int($x);
385 1 ▶ return ($x > $int ? $int+1 : $int);
Branch: 1 branch
BranchTrueFalseTotal
$x > $int ? : 1 0 1
386 }
387  
388 2 1;
389 __END__
« PlanePath/RationalsTree.pm ↑ Summary PlanePath/KochSnowflakes.pm »