--- id: cpp-math title: "C++ Math" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["max min functions", "cmath library", "C++ μˆ˜ν•™ ν•¨μˆ˜"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.83 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["cpp", "programming-language", "w3schools", "math", "cmath"] raw_sources: ["https://www.w3schools.com/cpp/cpp_math.asp"] applied_in: [] github_commit: "" --- # [[CPP Math]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `max()` and `min()` are used with NO header include shown in the source's own examples, while `sqrt()`, `round()`, and `log()` explicitly require `#include ` β€” a distinction the source draws implicitly through its section structure (max/min presented first, standalone; `` functions grouped separately under their own header requirement), suggesting C++ split basic comparison-style math from the broader mathematical function library across different availability boundaries. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`max(x, y)`** β€” returns the higher of two values. [S1] - **`min(x, y)`** β€” returns the lower of two values. [S1] - **`` header** β€” required for broader math functions: `sqrt()` (square root), `round()` (rounds a number), `log()` (natural logarithm), and more. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic max/min: `cout << max(5, 10); cout << min(5, 10);`. [S1] - cmath-based functions: `#include cout << sqrt(64); cout << round(2.6); cout << log(2);`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - ν˜„μž¬κΉŒμ§€ 발견된 λͺ¨μˆœ 사항 μ—†μŒ (No contradictions found in available sources). ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” sqrt/round/log λ“± cmath ν•¨μˆ˜λ“€μ΄ 이후 μ±•ν„°μ˜ λ‹€μ–‘ν•œ 계산 λ‘œμ§μ—μ„œ μž¬μ‚¬μš©λ  수 μžˆλŠ” κΈ°λ³Έ 도ꡬ닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Using cmath library functions for square root, rounding, and logarithm (C++): ```cpp #include cout << sqrt(64); // 8 cout << round(2.6); // 3 cout << log(2); // 0.693147... ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.83 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C++ Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CPP Strings Numbers]], [[CPP Booleans]], [[C Math]] - **μ°Έμ‘° λ§₯락:** μˆ˜ν•™ μ„Ήμ…˜ 유일 챕터 β€” λΆˆλ¦¬μ–Έ(Booleans) μ„Ήμ…˜μœΌλ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C++ Math β€” https://www.w3schools.com/cpp/cpp_math.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C++ Math" page (Astra wiki-curation, P-Reinforce v3.1 format).