in reply to Granular padding peaks in graphs

If you want to round up to one less than the magnitude like this:
$ perl -Mstrict -MPOSIX=ceil,floor -wE' for my $peak (0.1,0.9,2.1,9.9,11,22.22,35,111,265,999,1020,120010) { my $base = 10**( floor(log($peak)/log(10)) - 1 ); my $h = ceil($peak/$base) * $base; $h += $base if $h == $peak; # avoid peak = max printf "%s\t%s\n", $peak, $h; } ' 0.1 0.11 0.9 0.91 2.1 2.2 9.9 10 11 12 22.22 23 35 36 111 120 265 270 999 1000 1020 1100 120010 130000