PI
A function returning 3.14159265.
X=PIYou can use PI to calculate the circumference and area of a circle. The example below calculates the circumference and area of a circle of a given radius.
10 CLS
20 INPUT "What is the radius of the circle ",rad
30 PRINT "The circumference is: ";2*PI*rad
40 PRINT "The area is: ";PI*rad*rad
50 ENDPI can also be used to convert degrees to radians and radians to degrees.
radians=PI/180*degrees
degrees=180/PI*radiansHowever, BBC BASIC(Z80) has two functions (RAD and DEG) which perform these conversions to a higher accuracy.
Syntax
<n-var>=PIAssociated Keywords
RAD, DEG
Last updated on