forked from Alepha/Alepha
Fix bug in number printing.
This commit is contained in:
@ -78,16 +78,20 @@ namespace Alepha::Hydrogen::Utility ::detail:: print_number_m
|
|||||||
value/= 1000;
|
value/= 1000;
|
||||||
if( not remainder ) continue;
|
if( not remainder ) continue;
|
||||||
std::string next;
|
std::string next;
|
||||||
if( remainder >= 100 ) next+= names.at( remainder / 100 ) + " hundred ";
|
if( remainder >= 100 ) next+= names.at( remainder / 100 ) + " hundred";
|
||||||
remainder%= 100;
|
remainder%= 100;
|
||||||
if( remainder >= 20 )
|
if( remainder )
|
||||||
{
|
{
|
||||||
next+= tens.at( remainder - remainder % 10 );
|
next+= " ";
|
||||||
if( remainder % 10 ) next+= " " + names.at( remainder % 10 );
|
if( remainder >= 20 )
|
||||||
}
|
{
|
||||||
else if( remainder )
|
next+= tens.at( remainder - remainder % 10 );
|
||||||
{
|
if( remainder % 10 ) next+= " " + names.at( remainder % 10 );
|
||||||
next+= names.at( remainder );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next+= names.at( remainder );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
next+= " " + powers.at( millennium );
|
next+= " " + powers.at( millennium );
|
||||||
parts.push_back( std::move( next ) );
|
parts.push_back( std::move( next ) );
|
||||||
|
@ -24,6 +24,10 @@ static auto init= Alepha::Utility::enroll <=[]
|
|||||||
|
|
||||||
{ "1000283000000", { 1'000'283'000'000 },
|
{ "1000283000000", { 1'000'283'000'000 },
|
||||||
"one trillion two hundred eighty three million" },
|
"one trillion two hundred eighty three million" },
|
||||||
|
|
||||||
|
// I just detected this weird case:
|
||||||
|
{ "1000100006000500", { 1000100006000500 },
|
||||||
|
"one quadrillion one hundred billion six million five hundred" },
|
||||||
};
|
};
|
||||||
|
|
||||||
-"repl"_test <=[]
|
-"repl"_test <=[]
|
||||||
|
Reference in New Issue
Block a user