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;
|
||||
if( not remainder ) continue;
|
||||
std::string next;
|
||||
if( remainder >= 100 ) next+= names.at( remainder / 100 ) + " hundred ";
|
||||
if( remainder >= 100 ) next+= names.at( remainder / 100 ) + " hundred";
|
||||
remainder%= 100;
|
||||
if( remainder >= 20 )
|
||||
if( remainder )
|
||||
{
|
||||
next+= tens.at( remainder - remainder % 10 );
|
||||
if( remainder % 10 ) next+= " " + names.at( remainder % 10 );
|
||||
}
|
||||
else if( remainder )
|
||||
{
|
||||
next+= names.at( remainder );
|
||||
next+= " ";
|
||||
if( remainder >= 20 )
|
||||
{
|
||||
next+= tens.at( remainder - remainder % 10 );
|
||||
if( remainder % 10 ) next+= " " + names.at( remainder % 10 );
|
||||
}
|
||||
else
|
||||
{
|
||||
next+= names.at( remainder );
|
||||
}
|
||||
}
|
||||
next+= " " + powers.at( millennium );
|
||||
parts.push_back( std::move( next ) );
|
||||
|
@ -24,6 +24,10 @@ static auto init= Alepha::Utility::enroll <=[]
|
||||
|
||||
{ "1000283000000", { 1'000'283'000'000 },
|
||||
"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 <=[]
|
||||
|
Reference in New Issue
Block a user