[완료]정말 쉬운 fmod에 대한 질문입니다
fmod에 대한 질문이 있습니다
에러가 나지 않아야 할 곳에서 에러가 나서 그러는데
고칠 방법이 있을까요?
#include
#include
using namespace std;
int main()
{
cout
return 0;
}
이런 프로그램을 g++ 로 컴파일 하면
1.cpp:6: error: integer constant is too large for 'long' type
이런 에러가 뜨고요
g++ --version 으로 버젼 확인 결과
g++ (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
이렇게 떴습니다. 문제가 뭐고 해결책은 어떻게 해야하나요?
fmod에 대한 설명은
http://www.cplusplus.com/reference/clibrary/cmath/fmod.html
여기에 있습니다. 여기에
double fmod ( double numerator, double denominator );
float fmod ( float numerator, float denominator );
long double fmod ( long double numerator, long double denominator );
이렇게 나와있는데 ;;
cout<<"fmod(1310000000000,1.0
cout<<"fmod(1310000000000,1.0)"lt;lt;(double)(fmod((double)(1310000000000.0),(double)1.0))lt;lt;endl;
으로 바꿔주니까 되네요 ;;;;