Repository navigation
Refuse the arc- spellings of the inverse hyperbolic functions - #687
Conversation
|
It doesn't seem correct to call inverse hyberbolic functions "arc" when they actually mean "area". Maybe these should be errors instead? |
|
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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#.
45cf99b to
593aaae
Compare
|
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: The twenty-one spellings that already parsed are untouched, One thing worth your call: this adds |
|
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. |
A product of an undeclared variable and
x, with nothing said about it. Same forarccosh,arccotanh,arcsechandarccosech.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.
arcsinhis not another name forarsinh; it is not a name for anything.Each of the six names its own correct spellings.
Nothing else changes
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,arcsecandarccosecare correct names and are untouched.arcs(x),arcsinhh(x),arc * x.How
By changing
AngouriMath.gand regenerating, followingDocs/Contributing/ImproveParser.md— the repository's ownantlr-4.13.1-complete.jar, thenAntlrPostProcessorReplacePublicWithInternal. 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.UnrecognizedFunctionParseExceptionis new, next toUnrecognizedDomainException. 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 toTestHyperbolicwhile passing.4036 unit tests and 127 F# tests on both target frameworks, none failing.