Division by zero examples and using the Assign operator to divide |
Smart pascal source code
// ---- division by zero using float ---- // var a := 0.0; a := 1 / a; WriteLn(a); // Infinity // ---- division by zero using Integer ---- // var b := 0; b := 1 div b; WriteLn(b); // Infinity // ---- division with Assign operator ---- // var f := 150.0; f /= 1.5; // 150/1.5 WriteLn(f); // 100 f /= f; WriteLn(f); // 1 f /= 1 + f; WriteLn(f); // 0.5