Merge pull request #3910 from w3iBStime/patch-1

Conversions: Increases threshold before exponent notation
master
Rob Emery 2017-02-04 00:18:29 +00:00 committed by GitHub
commit e42aef2e28
2 changed files with 23 additions and 11 deletions

View File

@ -153,7 +153,7 @@ handle query_lc => sub {
# We only display it in exponent form if it's above a certain number.
# We also want to display numbers from 0 to 1 in exponent form.
if($result->{'result'} > 1_000_000 || abs($result->{'result'}) < 1) {
if($result->{'result'} > 9_999_999 || abs($result->{'result'}) < 1) {
$formatted_result = (sprintf "%.${precision}g", $result->{'result'});
}
}

View File

@ -780,14 +780,14 @@ ddg_goodie_test(
physical_quantity => 'power'
})
),
'1 gigawatt in horsepower' => test_zci(
'1 gigawatt = 1.34 * 10^6 horsepower',
'10 gigawatts in horsepower' => test_zci(
'10 gigawatts = 1.34 * 10^7 horsepower',
structured_answer => make_answer({
markup_input => '1',
raw_input => '1',
from_unit => 'gigawatt',
styled_output => '1.34 * 10<sup>6</sup>',
raw_answer => '1.34*10^6',
markup_input => '10',
raw_input => '10',
from_unit => 'gigawatts',
styled_output => '1.34 * 10<sup>7</sup>',
raw_answer => '1.34*10^7',
to_unit => 'horsepower',
physical_quantity => 'power'
})
@ -2769,13 +2769,13 @@ ddg_goodie_test(
})
),
'3000 km to m' => test_zci(
'3,000 kilometers = 3 * 10^6 meters',
'3,000 kilometers = 3,000,000 meters',
structured_answer => make_answer({
markup_input => '3,000',
raw_input => '3000',
from_unit => 'kilometers',
styled_output => '3 * 10<sup>6</sup>',
raw_answer => '3*10^6',
styled_output => '3,000,000',
raw_answer => '3000000',
to_unit => 'meters',
physical_quantity => 'length'
})
@ -2804,6 +2804,18 @@ ddg_goodie_test(
physical_quantity => 'length'
})
),
'how many bytes in a mebibyte?' => test_zci(
'1 mebibyte = 1,048,576 bytes',
structured_answer => make_answer({
markup_input => '1',
raw_input => '1',
from_unit => 'mebibyte',
styled_output => '1,048,576',
raw_answer => '1048576',
to_unit => 'bytes',
physical_quantity => 'digital'
})
),
'how many megabytes in a gigabyte?' => test_zci(
'1 gigabyte = 1,000 megabytes',
structured_answer => make_answer({