Microsoft KB Archive/31659

= An Accurate Value for Pi Is 4 Times the Arctangent of 1 =

Article ID: 31659

Article Last Modified on 11/21/2006



This article was previously published under Q31659



SUMMARY
An accurate value for Pi can be calculated from the ATN (arctangent) function in Microsoft BASIC as follows: PI# = 4# * ATN(1#) PRINT PI# The arctangent of 1, multiplied by 4, is equal to Pi.



MORE INFORMATION
Pi is equal to a circle's circumference divided by its diameter.

In Microsoft BASIC, ATN(x#) returns the arctangent of x#, where x# is a unitless number. The result returned by the ATN(x#) function is in the range -pi/2 to +pi/2 radians.

The above formula used to obtain pi applies to any product that supports the arctangent function, including the following products:


 * 1) Microsoft QuickBasic Versions 1.00, 1.00a, 1.00b for Apple Macintosh
 * 2) Microsoft BASIC Interpreter 2.x, 3.00 for the Apple Macintosh
 * 3) Microsoft QuickBASIC Compiler Versions 1.00, 1.01, 1.02, 2.00, 2.01, 3.00, 4.00, and 4.00b for the IBM PC
 * 4) Microsoft BASIC Compiler Version 5.35 and 5.36 for MS-DOS
 * 5) Microsoft BASIC Compiler Version 6.00 and 6.00b for MS OS/2 and MS-DOS
 * 6) Microsoft BASIC Professional Development System (PDS) Versions 7.00 and 7.10 for MS-DOS and MS OS/2
 * 7) Microsoft GW-BASIC Interpreter Versions 3.20, 3.22, and 3.23 for MS-DOS.

Additional query words: QuickBas BasicCom MQuickB

Keywords: KB31659

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.