All pastes #715763 Raw Edit

Unnamed

public text v1 · immutable
#715763 ·published 2007-09-26 13:32 UTC
rendered paste body
$grp = 4;
$mod = 8;

while(<>) {
    /(-?\d*)\.(\d*)F/;
    push @ints, $1;
    push @fracs, $2;
}

$ilen = (sort {$b <=> $a} map {length} @ints )[0];
$flen = (sort {$b <=> $a} map {length} @fracs)[0];

for($t = 0; $t <= $#fracs; $t++){
    if(!($t%$grp)) {
        printf "{";
    }
    printf "%${ilen}s.%-${flen}s", $ints[$t], $fracs[$t];
    if($t!=0 && !(($t+1)%$grp)) {
        printf "}";
    }
    if(!(($t+1)%$mod)) {
        printf ",\n";
    }else {
        printf ", ";
    }
}