c語言中π這個數字要怎麼定義出來 匿名使用者 1級 2016-11-24 回答

C語言中在函式庫中已定義了PI

#include “math。h”

M_PI pi //!!!!!!!!!!!!!!!!!這就是PI常數 M_PI

M_PI_2 One-half pi

M_PI_4 One-fourth pi

M_1_PI One divided by pi

M_2_PI Two divided by pi

M_1_SQRTPI One divided by the square root of pi

M_2_SQRTPI Two divided by the square root of pi

c語言中π這個數字要怎麼定義出來 今生相愛 1級 2016-11-24 回答

c語言沒有定義pi。 這不屬於c語言標準。

有的數學庫中定義了pi。 如:

# define m_pi 3。14159265358979323846 /* pi */

# define m_pi_2 1。57079632679489661923 /* pi/2 */

# define m_pi_4 0。78539816339744830962 /* pi/4 */

# define m_1_pi 0。31830988618379067154 /* 1/pi */

# define m_2_pi 0。63661977236758134308 /* 2/pi */