Skip to content

Conversation

@Aras14HD
Copy link
Collaborator

This adds parsing for Towers, Tetration and more intuitive numbers with exponent like 5.4 ⨉ 10^6.

This is a breaking change for the library, as we add a new constant to control, how deep towers should be displayed for inputs.

Two questions:

  • Should Tetration and the new exponents only be accepted in parens? (no post op, and neither post nor pre op) (maybe also something for towers)
  • Should we keep in the max tower depth or just give them as large as possible? (maybe keep only for value, not result)

@tolik518
Copy link
Owner

  • Should Tetration and the new exponents only be accepted in parens? (no post op, and neither post nor pre op) (maybe also something for towers)
  • Should we keep in the max tower depth or just give them as large as possible? (maybe keep only for value, not result)

I don't have a hard opinion on those topics as I feel like I can't really picture the consequences right now to be honest

@Aras14HD
Copy link
Collaborator Author

So as it currently stands, it would interpret

  • ^(50)10! rendered ⁵⁰10! as (^(50)10)!
  • 5.2 ⨉ 10^(50)! rendered 5.2 ⨉ 10⁵⁰! as (5.2 ⨉ 10^(50))!
  • 10^50! rendered 10⁵⁰ꜝ as (10^50)!
  • !10^50 rendered !10⁵⁰ as !(10^50)

Instead it should probably reject (some of) these examples (skipping just enough) and see this instead

  • ^(50)10! as 10! (ignoring the later tetration)
  • 5.2 ⨉ 10^(50)! as 10^(50)! (ignoring the later multiplication)
  • 10^50! as 50! (ignoring the later exponentiation)
  • !10^50 as !10 (ignoring the later power)

The second and third ones seem clear to me, that they should change, as factorial comes before multiplication and in the second one it is rendered (on at least some platforms) with the factorial in the exponent.

The first and fourth I feel should also be changed, as I think (sub-)factorial comes before power/tetration/etc.

fix pre op on tower
fix pre op on fancy exp
fix post op on tower (no paren)
fix post op on tetration
fix post op on fancy exp (paren and no paren differently)
@Aras14HD
Copy link
Collaborator Author

As I was pretty much completely sure, I should fix that, I did.

Now just max tower depth to figure out. It looks a lot better with, but we technically lose some info. (Maybe check for 1 in top exponent?)

@tolik518
Copy link
Owner

Yeah I think i'm too far away from math at the time to have a strong opinion tbh :D

Maybe check for 1 in top exponent?

This sounds a bit hacky, but I think that would suffice

While from semver-checks perspective, it really is just fix,
it adds a whole class of inputs through the parser, which as not breaking should be minor.
@Aras14HD
Copy link
Collaborator Author

Just adds one check to formatting towers and is by definition of tetration equal. And for that, we don't have a major version change in the lib now. (Kept minor version change as it is a new minor feature)

@Aras14HD
Copy link
Collaborator Author

Also added parsing of complex infinity (like a constant) as I just saw somebody try to use it again.

tolik518
tolik518 previously approved these changes Dec 21, 2025
Copy link
Owner

@tolik518 tolik518 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only one small suggestion, but I can also merge it as it is :)

@tolik518
Copy link
Owner

Thank you, I'll merge that soon

@tolik518 tolik518 merged commit 510186f into tolik518:master Dec 21, 2025
6 checks passed
@Aras14HD Aras14HD deleted the parse-tower branch December 21, 2025 14:08
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.

2 participants