Skip to content

builtin: Add maths functions#108

Merged
juliaogris merged 1 commit intomasterfrom
maths
Mar 17, 2023
Merged

builtin: Add maths functions#108
juliaogris merged 1 commit intomasterfrom
maths

Conversation

@juliaogris
Copy link
Member

Add some essential maths functions. This has been again added on request
to allow for more interesting graphics, especially sin, cos, atan2.

Thanks @fcostin for the suggestion.

@github-actions
Copy link

github-actions bot commented Mar 17, 2023

firebase-deployment: https://evy-lang--108-bf9hzyck.web.app (3f728ca)

Copy link
Member

@camh- camh- left a comment

Choose a reason for hiding this comment

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

🍀

print "sqrt 2:" (sqrt 2)
print "sin pi:" (sin pi)
print "cos pi:" (cos pi)
print "atan2 x y:" (atan2 0 0)
Copy link
Member

Choose a reason for hiding this comment

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

should be atan2 0 0 not atan2 x y

@@ -0,0 +1,14 @@
pi := 3.141593
Copy link
Member

Choose a reason for hiding this comment

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

FYI: through experimentation I found that these values:

pi := 3.14159265
e := 2.718281828459045

Make log e print 1 and cos pi print -1. sin pi is still not quite zero though, even when I add a bunch more precision.

Add some essential maths functions. This has been again added on request
to allow for more interesting graphics, especially sin, cos, atan2.
@juliaogris juliaogris merged commit 256652c into master Mar 17, 2023
@juliaogris juliaogris deleted the maths branch March 17, 2023 21:55
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