Jan-21-2024, 11:54 PM
I am trying to calculate minute angles, and would like precision of at least 15 digits:
But I fail to understand how Python is rounding.
As I vary the value of asin by factors of 10 (from .001 to .00001), the output adds these zeros between the leading numeral 1 and the next numeral 1 (and some sixes after). See the image below.
And this is happening whether I use the gimpy2 or math modules:
Does the Sin-1 actually do this on radians?
Degrees acts similarly: When the input is very small and changes by a factor of ten (eg., .001 - .00001), the output of asin only changes by a factor of ten — the decimal point just moves one place while leaving the significant figures virtually unchanged.
Thank you!!
A version of the test code being used is shown below:
But I fail to understand how Python is rounding.
As I vary the value of asin by factors of 10 (from .001 to .00001), the output adds these zeros between the leading numeral 1 and the next numeral 1 (and some sixes after). See the image below.
And this is happening whether I use the gimpy2 or math modules:
Does the Sin-1 actually do this on radians?
Degrees acts similarly: When the input is very small and changes by a factor of ten (eg., .001 - .00001), the output of asin only changes by a factor of ten — the decimal point just moves one place while leaving the significant figures virtually unchanged.
Thank you!!
A version of the test code being used is shown below:
import gmpy2 import math from gmpy2 import * from gmpy2 import get_context as ctx ctx().precision = 100 # L = mpfr('1000.0') F = 0.00001 N = 10.0 B = 0.5 C = gmpy2.div(F, N) c = F / N D = 2 * C d = 2 * c E = B * gmpy2.asin(D) e = B * math.asin(d) g = .000002 e2 = B * math.asin(g) # F = gmpy2.mul(B, E) # sin(2 * theta) = 2 * sin(theta)cos(theta) # print("L: ", L, type(L)) print("F: ", F, type(F)) print("N: ", N, type(N)) print("B: ", B, type(B)) print("C: ", C, type(C)) print("c: ", c, type(c)) print("D: ", D, type(D)) print("d: ", d, type(d)) print("E: ", E, type(E)) print("e: ", e, type(e)) print("e2: ", e2, type(e2)) print(ctx())