@mintsoft - agreed.

--
sent by a bradDroid - please expect bradVity!
On Mar 6, 2014 5:35 PM, "Rob Emery" <notifications@github.com> wrote:

> In lib/DDG/Goodie/Conversions.pm:
>
> >      # run the conversion:
> > -    return "$factor $matches[0] is " . sprintf("%.3f", $factor * ($units{$matches[1]} / $units{$matches[0]})) . " $matches[1]";
> > +    # temperatures don't have 1:1 conversions, so they get special treatment:
> > +    if ($match_types[0] eq 'temperature') {
> > +        return "$factor degrees $units[0] is " . sprintf("%.3f", convert_temperatures($matches[0], $matches[1], $factor)) . " degrees $units[1]";
> > +    }
> > +
> > +    # handle plurals:
> > +    my $result = $factor * ($factors[1] / $factors[0]);
> > +    # if $result = 1.00000 .. 000n, where n <> 0 then $result > 1 and throws off pluralization, so:
> > +    $result = nearest(.001, $result);   # .001 to match sprintf "%.3f" below
> > +	
> > +	my ($source_unit, $target_unit) = ($units[0], $units[1]);
> > +	
> > +    if ($factor > 1) {
> > +        $source_unit = $units[0].'s';
>
> Maybe wrap this in a sub to eliminate the duplication with below
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/duckduckgo/zeroclickinfo-goodies/pull/356/files#r10364812>
> .
>