SamiKalliomaki / eppabasic

A new web based basic language inspired by CoolBasic.
Other
11 stars 3 forks source link

added arc trigonometry functions #61

Open fergusq opened 1 year ago

henkkuli commented 1 year ago

There's also some bikeshedding to be done: Should the names of the functions be

In addition, I don't entirely like having separate Atan and Atan2. Maybe having only Atan2 and instructing to call it with Atan2(a, 1) to get Atan(a) is enough?

fergusq commented 1 year ago

Atan(a) is more familiar from math lessons, so I think it's better to have them both so children don't have to think how to calculate it using Atan2.

fergusq commented 1 year ago

The names I chose are the ones used in Visual Basic .NET: https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/functions/math-functions

Other Basics may have different names. For example, QBasic has ATN for arcus tangent.

henkkuli commented 1 year ago

Ok, I guess Atan it is. Looking at the documentation of Coolbasic, one way would be to have Asin, Acos and Atan as those are functions known from math lessons, but then have something like GetAngle which takes in parameters x1, y1, x2, y2 and then computes atan2(y2-y1, x2-x1) internally. This would address the most common use of atan2 which is to compute the angle between two points.