반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- junit
- math
- javascript
- string
- 인텔리제이
- json
- Java
- 배열
- 단위테스트
- java테스트
- junit5
- Eclipse
- 이클립스
- ArrayList
- 자바스크립트
- list
- 자바
- Array
- vscode
- html
- 자바문법
- 정규식
- HashMap
- 문자열
- CSS
- Visual Studio Code
- input
- 테스트자동화
- IntelliJ
- js
Archives
- Today
- Total
목록hypot (1)
어제 오늘 내일
[Java Math] hypot() 메소드 – 직각삼각형의 빗변 계산
Math.hypot(x, y)는 피타고라스의 정리를 이용해 √(x² + y²) 값을 계산해 줍니다.직각삼각형에서 두 변의 길이가 주어졌을 때 빗변 길이를 바로 구할 수 있습니다. 1. 기본 사용법public class MathHypotBasic { public static void main(String[] args) { System.out.println(Math.hypot(3, 4)); // 5.0 System.out.println(Math.hypot(5, 12)); // 13.0 }}Math.sqrt(x*x + y*y)와 동일한 결과를 주지만, hypot()은 오버플로우나 언더플로우에 더 안전합니다. 2. 음수 입력public class MathHypotNegativ..
IT/Java
2025. 12. 14. 07:13
