Mar. 14th, 2010
Lucky
Mar. 14th, 2010 02:22 pmI found myself wondering: when computing the volume of a sphere, do people always begin by dividing 4 by 3, then multiplying this by π, then the cube of the radius?
Or do they pre-compute 4/3*π as 4.1887902047863909846168578443727 and a bit and store this value to multiply against the cube of the radius?
4/3π = 4.1887902047863909846168578443727 and a bit
2π = 6.283185307179586476925286766559 and a bit
4π = 12.566370614359172953850573533118 and a bit
So when you next need to work out the circumference of a circle (2πr), the volume of a sphere (4/3πr3) or the surface of a sphere (4πr2), knowing these multiples of a constant (which must also be constants) in advance will cut down on your calculation times by up to sixty percent at a stroke.
It just makes sense to know your π times tables, is all. :)
Or do they pre-compute 4/3*π as 4.1887902047863909846168578443727 and a bit and store this value to multiply against the cube of the radius?
4/3π = 4.1887902047863909846168578443727 and a bit
2π = 6.283185307179586476925286766559 and a bit
4π = 12.566370614359172953850573533118 and a bit
So when you next need to work out the circumference of a circle (2πr), the volume of a sphere (4/3πr3) or the surface of a sphere (4πr2), knowing these multiples of a constant (which must also be constants) in advance will cut down on your calculation times by up to sixty percent at a stroke.
It just makes sense to know your π times tables, is all. :)