#!/usr/bin/perl
# Given some frequencies (in MHz) for your scanner radio,
# what steps they are on, or between?
# Usage example: validstep 216.047 [451.045 ...]
# Author: Dan Jacobson https://www.jidanni.org/
# Copyright: https://www.gnu.org/licenses/gpl.html
# Created: Fri May  2 02:43:01 2003
# Last-Updated: 2023-02-26T02:51:40+0000
#     Update #: 267
use strict;
use warnings q(all);
use constant S     => 10000000;
for my $freq (@ARGV) {
    print "\n-- $freq:\n";
    $freq *= S;
    for (
        1000000, 500000, 300000, 250000,       200000, 150000,
        125000,  100000, 90000,  1000000 / 12, 62500,  50000
      )
    {
        printf "%.5f:", $_ / S;
        my $mod = $freq % $_;
        unless ($mod) { print "exact\n"; next; }
        my $ratio = int( $freq / $_ );
        printf "%.5f%-10s%.5f\n", $ratio * $_ / S,
##Dots to show the distance between the two edges:
          "." x ( sprintf "%.0f", 10 * $mod / $_ ), ( $ratio + 1 ) * $_ / S;
    }
}
