Results 1 to 4 of 4

Thread: Trigonometric values to 30 DP?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    2

    Trigonometric values to 30 DP?

    I need to calculate cos of very small angles (~10^-10 radians) very accurately (30 decimal places).

    I obviously need some way to implement the trigonometric expansion of cos to many decimal places. How can this be done using a computer algorithm if the computer is only accurate to 7 significant figures?

    I suppose it's like working out pi to millions of digits.

  2. #2
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Trigonometric values to 30 DP?

    Welcome to the forums!

    One way is to have numbers represented by strings and write special routines. The Foxes group (Italy) has an incredible Excel add-in called Xnumbers that performs variable precision calculations up to 200 digits. Their documentation is outstanding. They recently added a DLL version that allows you to call the routines from VB/VBA. Best part - freeware!

    http://digilander.libero.it/foxes/SoftwareDownload.htm
    Last edited by VBAhack; Mar 17th, 2006 at 03:57 PM.

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    2

    Re: Trigonometric values to 30 DP?

    Thanks VBA, I'll take a look.

  4. #4
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Trigonometric values to 30 DP?

    Here's an example using the DLL:

    VB Code:
    1. Sub TestXnumbers()
    2.     Dim x1 As Xnumbers, x As Double
    3.     Set x1 = New Xnumbers
    4.    
    5.     x = 0.0000000001
    6.     Debug.Print Cos(x)
    7.     Debug.Print x1.xCos(x, 30)
    8.     Debug.Print x1.xCos(x, 45)
    9.     Debug.Print x1.xCos(x, 55)
    10.     Debug.Print x1.xCos(x, 65)
    11.     '1
    12.     '0.999999999999999999995
    13.     '0.999999999999999999995000000000000000000004166
    14.     '0.9999999999999999999950000000000000000000041666666666666
    15.     '0.99999999999999999999500000000000000000000416666666666666666666527
    16. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width