c code에서 600이 아니라 599가 찍히는 이유좀...
글쓴이: gouhc46 / 작성시간: 월, 2011/04/18 - 1:52오전
첨부 파일에서 값을 출력해보면
rrate 변수에 600이 들어가게 됩니다
toption(int num_transaction) 함수 호출시
num_transaction은 1000이구요
rrate = num_transaction * 0.6 + 1; 실행시 rrate에 600이 들어갑니다
원래 +1을 하지 않은 값이 600이어야 하는데, +1을 하지 않으면 599가 출력되네요
왜 그런지 이유좀 알려주세요!
File attachments:
첨부 | 파일 크기 |
---|---|
code.jpg | 41.43 KB |
Forums:
http://floating-point-gui.de/
http://floating-point-gui.de/
비록 영어이지만 좋은 자료입니다.
floating연산후 형변환시 생겨날 수 있는
floating연산후 형변환시 생겨날 수 있는 버그(?)에요
댓글 달기