Delphi / Object Pascal · Exception

EInvalidOp Exception

What does EInvalidOp Exception mean in Delphi / Object Pascal?

Raised for an undefined floating-point instruction or a mathematically invalid operation - Sqrt of a negative number, an ArcTan domain error, 0/0, or a partial-loss-of-precision condition the FPU flags as invalid.

EInvalidOp ExceptionDelphi (VCL) · Delphi (FireMonkey)

Condition

Raised for an undefined floating-point instruction or a mathematically invalid operation - Sqrt of a negative number, an ArcTan domain error, 0/0, or a partial-loss-of-precision condition the FPU flags as invalid.

Fix

Validate inputs to math functions before calling them, checking for negative arguments to Sqrt/Ln and domain bounds for inverse trig functions, and use the safer System.Math variants where available instead of the raw FPU-backed routines.

Related exception