> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dart Truncating Division

The `~/` operator in Dart performs truncating division. It divides the left operand by the right operand and returns the integer portion of the quotient, discarding any fractional remainder by truncating towards zero.

```dart theme={"dark"}
int result = operand1 ~/ operand2;
```

## Technical Characteristics

* **Operands:** Both operands must be subtypes of `num` (`int` or `double`).
* **Return Type:** The operation strictly evaluates to an `int`, regardless of the input operand types.
* **Precision:** When both operands are `int`, `~/` performs true 64-bit integer division on the Dart VM. It is fundamentally different from `(a / b).toInt()`, which forces an intermediate conversion to `double`. The intermediate `double` conversion loses precision for integers requiring more than 53 bits, whereas `~/` maintains full 64-bit precision.

## Evaluation Behavior

When evaluating the expression, Dart performs the division and strips the decimal value. It does not round to the nearest integer; it strictly truncates towards zero.

```dart theme={"dark"}
// Standard integer truncation
int a = 10 ~/ 3;     // Evaluates to 3
int b = -10 ~/ 3;    // Evaluates to -3 (truncates towards zero)

// Mixed and double operand truncation
int c = 10.5 ~/ 2;   // Evaluates to 5
int d = 9.9 ~/ 2.2;  // Evaluates to 4

// High-precision integer division (Dart VM)
// Maintains precision unlike (9000000000000000001 / 1).toInt()
int e = 9000000000000000001 ~/ 1; // Evaluates to 9000000000000000001
```

## Exceptional States

Because the return type is strictly bound to `int`, the operator cannot return `Infinity` or `NaN`. Consequently, specific operand values will trigger runtime exceptions:

* **Division by Zero:** Evaluating `a ~/ 0` or `a ~/ 0.0` strictly throws an `UnsupportedError`.
* **Non-finite Values:** The operation throws an `UnsupportedError` if the left operand is `double.infinity` or `double.negativeInfinity`, or if *either* operand is `double.nan`. However, if the left operand is a finite number and the right operand is infinite (e.g., `5 ~/ double.infinity`), the intermediate division evaluates to `0.0`. Truncating `0.0` results in `0`, so the operation successfully returns `0` without throwing an exception.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Dart Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
