Delphi Error – E2118 Division by zero

Delphi Compiler Error

E2118 Division by zero

Reason for the Error & Solution

The inline assembler has encountered an expression which results in a division by zero.

program Produce;

  procedure AssemblerExample;
  asm
    dw  1000 / 0
  end;

begin
end.

If you are using program constants instead of constant literals, this error might not be quite so obvious.

program Solve;

  procedure AssemblerExample;
  asm
    dw  1000 / 10
  end;

begin
end.

The solution, as when programming in high-level languages, is to make sure that you don’t divide by zero.

Share:

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...