我试图调用简单的余弦计算。这是我的代码:
import pygame
from pygame.locals import *
import math
pygame.init()
screen = pygame.display.set_mode((480, 480))
myfont = pygame.font.SysFont("monospace", 15)
angle = 90*(math.pi/180)
while True:
adj = math.cos(angle)
display = myfont.render("opposite side: " + str(adj), 1, (255, 255, 0))
screen.blit(display, (100,40))
pygame.display.flip()
for event in pygame.event.get():
if event.type==pygame.QUIT:
pygame.quit()
exit(0)
由于cos(90)* 5 = 0,我希望代码显示该值。相反,我收到以下内容:
6.12323399574e-17