Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Degrees for trigonometric functions? #193

Open
soshimee opened this issue Jan 18, 2022 · 2 comments
Open

Degrees for trigonometric functions? #193

soshimee opened this issue Jan 18, 2022 · 2 comments

Comments

@soshimee
Copy link

I need degrees for what I am doing, and radians won't work. Converting from radians to degrees with high accuracy doesn't seem to possible.

@jrus
Copy link

jrus commented May 17, 2022

I’m not sure if PI is exposed in the API,† but you can get one from e.g. Decimal.atan(1).times(4). Once you have a representation of π you can convert to/from degrees by multiplying/dividing by π/180

†: If not, it probably should be, https://github.com/MikeMcl/decimal.js/blob/master/decimal.js#L32 defines it to 1025 digits and https://github.com/MikeMcl/decimal.js/blob/master/decimal.js#L3168 is a helper function that makes a Decimal out of it.

@MikeMcl
Copy link
Owner

MikeMcl commented May 17, 2022

@soshimee

What makes you think it is not possible?

It is straightforward but I am not inclined to do the work for you.

Decimal.set({ precision: 100 });
pi = Decimal.acos(-1);

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

No branches or pull requests

3 participants