1 개요[ | ]
- floor
- "Round fractions down"
- 버림 함수
2 C[ | ]
![](https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/24px-Crystal_Clear_app_xmag.svg.png 1.5x, https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/32px-Crystal_Clear_app_xmag.svg.png 2x)
C
Copy
#include<stdio.h>
#include<math.h>
int main() {
printf("%f", floor(3.14159)); // 3.000000
printf("%f", floor(-3.14159)); // -4.000000
printf("%f", floor(9.98)); // 9.000000
}
3 C++[ | ]
![](https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/24px-Crystal_Clear_app_xmag.svg.png 1.5x, https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/32px-Crystal_Clear_app_xmag.svg.png 2x)
C++
Copy
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << floor(3.14159) << endl; // 3
cout << floor(-3.14159) << endl; // -4
cout << floor(9.98) << endl; // 9
}
C++
Copy
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
cout << floor(3.14159) << endl; // 3
cout << floor(-3.14159) << endl; // -4
cout << floor(9.98) << endl; // 9
}
C++
Copy
#include <iostream>
int main() {
float f = 123.456;
float res = (int)(f*100.0)/100.0;
std::cout << res << std::endl;
// 123.45
}
4 EXCEL[ | ]
PHP
Copy
=INT(3.14159)
// returns 3
=INT(-3.14159)
// returns -4
=INT(9.98)
// returns 9
PHP
Copy
=FLOOR(3.14159, 1)
// returns 3
=FLOOR(-3.14159, -1)
// returns -3
=FLOOR(9.98, 1)
// returns 9
5 JavaScript[ | ]
JavaScript
Copy
console.log( Math.floor(10.6) ); // 10
6 PHP[ | ]
![](https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/24px-Crystal_Clear_app_xmag.svg.png 1.5x, https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/32px-Crystal_Clear_app_xmag.svg.png 2x)
PHP
Copy
echo floor(3.14159); // 3
echo floor(-3.14159); // -4
echo floor(9.98); // 9
7 Python[ | ]
![](https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/24px-Crystal_Clear_app_xmag.svg.png 1.5x, https://z-images.s3.amazonaws.com/thumb/e/ec/Crystal_Clear_app_xmag.svg/32px-Crystal_Clear_app_xmag.svg.png 2x)
Python
Copy
import math
print( math.floor(3.14) ) # 3
print( math.floor(2.72) ) # 2
print( math.floor(-3.14) ) # -4
print( math.floor(-2.72) ) # -3
8 Perl[ | ]
Perl
Copy
use POSIX;
print floor(9.98);
# 9
9 SQL[ | ]
9.1 Oracle[ | ]
sql
Copy
SELECT FLOOR(12.3456) FROM DUAL;
-- returns 12
SELECT FLOOR(-12.3456) FROM DUAL;
-- returns -13
sql
Copy
SELECT TRUNC(12.3456) FROM DUAL;
-- returns 12
SELECT TRUNC(-12.3456) FROM DUAL;
-- retruns -12
10 같이 보기[ | ]
로그인하시면 댓글을 쓸 수 있습니다.
리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― …리눅스 Python 2.7 컴파일 설치 ― Jmnote리눅스 Python 2.7 컴파일 설치 ― ㅇㅇㅇ미운코딩새끼 ― 승호 도령미운코딩새끼 ― 불탄고등어미운코딩새끼 ― 김레이미운코딩새끼 ― 호박이미운코딩새끼 ― Junhg0211미운코딩새끼 ― 김왼손미운코딩새끼 ― 용딘이미운코딩새끼 ―Pinkcrimson
유기농냠냠파이썬 ― 호박유기농냠냠파이썬 ― 이에스유기농냠냠파이썬 ― 이승현파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― John Jeong파이썬 global ― Jmnote파이썬 global ― John Jeong