Square root by hand: Difference between revisions

m
→‎{{header|Raku}}: not handling zero & stop unnecessary increments
(added Raku programming solution)
m (→‎{{header|Raku}}: not handling zero & stop unnecessary increments)
Line 545:
my $d = 9; # unit digit part of divisors & running answer
my $D = ''; # tens+ digit part of divisors
my $dot_printed = False;
my $once = 0; # for printing '.' only once
my $dividend; my $quotient = ''; my $remainder;
 
return "Sorry, minimum charge is $0⁺" if $in < 0;
 
if $in.narrow ~~ Int { # integer
Line 569:
unless @dividends.Bool {
last if ( $remainder == 0 and $quotient != 0 and !@fractional.Bool );
unless $dot_printed { print '.' unlessand $once++ ; #dot_printed happen= onlyTrue once}
if @fractional.Bool { # happen only once
@dividends.append: @fractional;
351

edits