--- id: csharp-math title: "C# Math" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["Math.Max Math.Min Math.Sqrt", "C# μˆ˜ν•™"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.82 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["csharp", "programming-language", "w3schools", "math"] raw_sources: ["https://www.w3schools.com/cs/cs_math.php"] applied_in: [] github_commit: "" --- # [[CSharp Math]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Where C provides math functions as free-standing functions from `` (`sqrt()`, `fabs()`) and C++ inherits that same free-function model (optionally namespaced as `std::sqrt`), C# packages every math operation as a STATIC METHOD of a `Math` CLASS (`Math.Sqrt()`, `Math.Max()`) β€” a direct, small-scale demonstration of the Syntax chapter's earlier rule that everything in C# must live inside a class, extended here to even the standard library's most basic utility functions. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`Math.Max(x, y)`** β€” returns the higher of two values. [S1] - **`Math.Min(x, y)`** β€” returns the lower of two values. [S1] - **`Math.Sqrt(x)`** β€” returns the square root of `x`. [S1] - **`Math.Abs(x)`** β€” returns the absolute (positive) value of `x`. [S1] - **`Math.Round()`** β€” rounds a number to the nearest whole number. [S1] - All are static methods called through the `Math` class name β€” no instance of `Math` is ever created. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - `Math.Max(5, 10);` β†’ 10. [S1] - `Math.Min(5, 10);` β†’ 5. [S1] - `Math.Sqrt(64);` β†’ 8. [S1] - `Math.Abs(-4.7);` β†’ 4.7. [S1] - `Math.Round(9.99);` β†’ 10. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **자유 ν•¨μˆ˜(free function)κ°€ μ•„λ‹ˆλΌ 클래슀 정적 λ©”μ„œλ“œλ‘œ 제곡됨**: CλŠ” ``의 `sqrt()`/`fabs()`λ₯Ό 자유 ν•¨μˆ˜λ‘œ ν˜ΈμΆœν–ˆκ³  C++도 이 λͺ¨λΈμ„ κ·ΈλŒ€λ‘œ κ³„μŠΉν–ˆμ§€λ§Œ, C#은 이λ₯Ό λͺ¨λ‘ `Math` 클래슀의 정적 λ©”μ„œλ“œ(`Math.Sqrt()`, `Math.Abs()`)둜 κ°μŒŒλ‹€λŠ” 점이 확인됨 β€” Syntax μ±•ν„°μ—μ„œ ν™•λ¦½λœ "λͺ¨λ“  μ½”λ“œλŠ” 클래슀 μ•ˆμ—" 원칙이 ν‘œμ€€ 라이브러리 ν•¨μˆ˜μ—λ„ κ·ΈλŒ€λ‘œ 적용된 사둀. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” Max/Min/Sqrt/Abs/Round 각각의 μ΅œμ†Œ 호좜 μ˜ˆμ œκ°€ μ›λ¬Έμ—μ„œ κ°œλ³„μ μœΌλ‘œ μ œμ‹œλ¨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Math operations as static methods of the Math class (C#): ```csharp Math.Max(5, 10); // 10 Math.Min(5, 10); // 5 Math.Sqrt(64); // 8 Math.Abs(-4.7); // 4.7 Math.Round(9.99); // 10 ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.82 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C# Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSharp Operators]], [[CSharp Strings]], [[CPP Math]], [[C Math Random]] - **μ°Έμ‘° λ§₯락:** Math μ„Ήμ…˜μ˜ 유일 챕터 β€” Strings μ„Ήμ…˜μœΌλ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C# Math β€” https://www.w3schools.com/cs/cs_math.php ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C# Math" page (Astra wiki-curation, P-Reinforce v3.1 format).