Skip to content

Write out numbers#327

Open
Aras14HD wants to merge 5 commits intotolik518:masterfrom
Aras14HD:write-out
Open

Write out numbers#327
Aras14HD wants to merge 5 commits intotolik518:masterfrom
Aras14HD:write-out

Conversation

@Aras14HD
Copy link
Collaborator

DEPENDS ON #326

This adds the ability to write out numbers up to 9.9999999...*10^3000000.

It only writes out the most significant parts.

This is a breaking change in the library as the arguments for format change. To combat this in the future and make the signature less cluttered, I added a FormatOptions struct.

This is also only in english, as of this point. There would be a lot to add to locale, otherwise.

Resolves #150

@tolik518
Copy link
Owner

This is hilarious!
Could you write a test please how it behaves with other languages like russian and/or german?

From what I have seen so far the pr looks good, but now calculation_results.rs feels like it has more than I would expect from it, maybe move the logic for writing out to a dedicated file? What do you think?

Also I don't think I can remotely verify if

Factorial of one hundred seventy six thousand nine hundred two is seventy five quintriginoctingentrilloctogintillducentillillion five hundred fourty five quattuortriginoctingentrilloctogintillducentillillion seven hundred sixty six tretriginoctingentrilloctogintillducentillillion three hundred five duotriginoctingentrilloctogintillducentillillion fourty seven untriginoctingentrilloctogintillducentillillion one hundred fourty three triginoctingentrilloctogintillducentillillion

is correct, but I'll take it :D

@Aras14HD
Copy link
Collaborator Author

It would still write the number in english with everything around it localized. (if it's breaking anyway, I might add localization to it now)

Maybe a format for basic formatting functions like round truncate fromat_float get_factorial_level_string and write_out_number. With calculation_results just implementing methods of/traits for the types Calculation and CalculationResult.

And for the correctness, while I doubt anyone would unironically say centillillion, https://bignumbers.fandom.com/wiki/Millillion shows, that this is somewhat used/recognized. And for more normal numbers, it matches the Wikipedia list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for formatting factorial results as words

2 participants