Skip to content

Refuse the arc- spellings of the inverse hyperbolic functions - #687

Merged
Happypig375 merged 1 commit into
ASC-Community:masterfrom
Rafael-SOWNet:fix/arc-hyperbolic-names
Aug 4, 2026
Merged

Happypig375 merged 1 commit into
ASC-Community:masterfrom
Rafael-SOWNet:fix/arc-hyperbolic-names

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Aug 4, 2026 •

Copy link
Copy Markdown
Member
"arcsinh(x)".ToEntity()     // master: arcsinh * x
"arctanh(x)".ToEntity()     // master: arctanh * x

A product of an undeclared variable and x, with nothing said about it. Same for arccosh, arccotanh, arcsech and arccosech.

Rewritten after review

The first version of this took those spellings as synonyms. @Happypig375 pointed out that is wrong — the inverse hyperbolic functions are area functions, not arc functions — and suggested erroring instead. That is right, and it is what this now does. arcsinh is not another name for arsinh; it is not a name for anything.

UnrecognizedFunctionParseException: there is no function arcsinh: the inverse hyperbolic
functions are area functions, not arc functions, so the inverse hyperbolic sine is
arsinh, asinh or arsh

Each of the six names its own correct spellings.

Nothing else changes

  • The twenty-one spellings the grammar already accepted still parse: asinh, arsinh, arsh, acosh, arcosh, arch, atanh, artanh, arth, acoth, arcoth, acotanh, arcotanh, arcth, asech, arsech, arsch, acosech, arcosech, arcsch, acsch.
  • arcsin, arccos, arctan, arccotan, arcsec and arccosec are correct names and are untouched.
  • A name that merely begins the same way is still the product it was: arcs(x), arcsinhh(x), arc * x.

How

By changing AngouriMath.g and regenerating, following Docs/Contributing/ImproveParser.md — the repository's own antlr-4.13.1-complete.jar, then AntlrPostProcessorReplacePublicWithInternal. The churn in the generated files is ANTLR renumbering its tokens; the only hand-written change is six alternatives in the .g, plus one new exception type.

UnrecognizedFunctionParseException is new, next to UnrecognizedDomainException. If you would rather not add a type I can throw an existing one instead — say which.

Verification

23 tests: the six refusals each naming the right spelling, and seventeen expressions that must parse exactly as before. Four spellings that already parsed but were never exercised (acotanh, arcotanh, acosech, arcosech) are added to TestHyperbolic while passing.

4036 unit tests and 127 F# tests on both target frameworks, none failing.

@Happypig375

Copy link
Copy Markdown
Member

It doesn't seem correct to call inverse hyberbolic functions "arc" when they actually mean "area". Maybe these should be errors instead?

@codecov-commenter

codecov-commenter commented Aug 4, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 99.28775% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.88%. Comparing base (90c00a8) to head (593aaae).
⚠️ Report is 57 commits behind head on master.

Files with missing lines Patch % Lines
...ources/AngouriMath/Core/Antlr/AngouriMathParser.cs 98.57% 3 Missing and 2 partials ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #687      +/-   ##
==========================================
- Coverage   80.99%   80.88%   -0.11%     
==========================================
  Files         155      156       +1     
  Lines       13687    13012     -675     
  Branches     1957     2122     +165     
==========================================
- Hits        11086    10525     -561     
+ Misses       1990     1878     -112     
+ Partials      611      609       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

arcsinh(x) parsed as arcsinh * x -- a product of an undeclared variable and x --
and said nothing about it. The same for arccosh, arctanh, arccotanh, arcsech and
arccosech.

Rewritten from taking those spellings as synonyms to refusing them, following
Happypig375 on the pull request: the inverse hyperbolic functions are area
functions, not arc functions, so arcsinh is not another name for arsinh, it is
not a name for anything. Each is now an UnrecognizedFunctionParseException that
says so and names the spellings that do work:

    there is no function arcsinh: the inverse hyperbolic functions are area
    functions, not arc functions, so the inverse hyperbolic sine is arsinh,
    asinh or arsh

Nothing else changes. The twenty-one spellings the grammar already accepted
still parse, arcsin and its five relatives are correct and untouched, and a name
that merely begins the same way -- arcs(x), arcsinhh(x) -- is still the product
it was.

Done by changing AngouriMath.g and regenerating with the repository's own
antlr-4.13.1-complete.jar and post-processor, as Docs/Contributing/ImproveParser.md
sets out. Four spellings that already parsed but were untested are added to
TestHyperbolic while passing. 4036 tests, 127 F#.
@Rafael-SOWNet
Rafael-SOWNet force-pushed the fix/arc-hyperbolic-names branch from 45cf99b to 593aaae Compare August 4, 2026 11:00
@Rafael-SOWNet Rafael-SOWNet changed the title Accept the arc- spellings of the inverse hyperbolic functions Refuse the arc- spellings of the inverse hyperbolic functions Aug 4, 2026
@Rafael-SOWNet

Copy link
Copy Markdown
Member Author

You're right, and thank you — I had it backwards. Rewritten to refuse them rather than accept them, with a message that says why and names the spellings that do work:

there is no function arcsinh: the inverse hyperbolic functions are area functions,
not arc functions, so the inverse hyperbolic sine is arsinh, asinh or arsh

The twenty-one spellings that already parsed are untouched, arcsin and its five relatives are correct names and untouched, and something that merely begins the same way — arcs(x), arcsinhh(x) — is still the product it was.

One thing worth your call: this adds UnrecognizedFunctionParseException next to UnrecognizedDomainException, since none of the existing parse exceptions fit "that name is not a function". If you would rather not grow the exception surface, say so and I will throw an existing one.

@Rafael-SOWNet

Copy link
Copy Markdown
Member Author

Noted on the issue references, thanks — full URLs in comments from here.

I have opened #689 for the seven that were already merged, and fixed the two remaining ones in my open branches. The six that predate my work I have left alone; happy to convert those too if you want them.

@Happypig375
Happypig375 merged commit 9444691 into ASC-Community:master Aug 4, 2026
24 checks passed
@Rafael-SOWNet Rafael-SOWNet mentioned this pull request Aug 4, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the fix/arc-hyperbolic-names branch August 4, 2026 20:49
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.

3 participants