in reply to Fuzzy How-Many

Here's my variant. It serves the same purpose, but gives rounder numbers for large inputs.

sub fuzz { my $x = int($_[0]); 0 == $x and return 0; my $sgn = $x < 0 ? ($x = - $x, -1) : 1; my $ten = 0; while (10 <= $x) { $x = $x/10; $ten++; } my $y = $x <= 1.25 ? 1 : $x <= 2 ? 1.6 : $x <= 3.1 ? 2.5 : $x <= 5 ? 4 : $x <= 8 ? 6.3 : 10; $sgn * int(0.6 + $y * 10 ** $ten); }