Home Invalid floating point operation Delphi
Reply: 1

Invalid floating point operation Delphi

Luca Ciancaglione
1#
Luca Ciancaglione Published in 2017-11-14 15:22:11Z

I have a problem in a Delphi program that i'm writing. The problem is this piece of code:

type
  TRobot = class(TObject)
  private
  public
    fAcceso: Boolean;
    fOra: TTime;
    fCode: Integer;
    mex: string;
    constructor Create;
  end;

// ...

myrobot.mex:= ('Acceso: '+  BoolToStr(myrobot.fAcceso) + 
               ',Tempo:' +  TimeToStr(myrobot.fOra) + 
               ',Codice:' + IntToStr(myrobot.fCode));  
memo.Lines.add(myrobot.mex);

precisely with TimeToStr(myrobot.fOra).
The problem occurs is

"Invalid floating point operation".

Can someone help me??

Sanders the Softwarer
2#
Sanders the Softwarer Reply to 2017-11-14 15:47:14Z

This error message means division by zero, square root of negative value and similar issues. It looks like something wrong either with myrobot.fOra or with format settings.

Set breakpoint at this line and check fOra value. If it looks good, use F7 to step into TimeToStr (yes, you can debug system library routines... maybe you'll need to install VCL sources and/or set up 'use debug dcu(s)' option of your project). Using it you'll be able to reach exact place of error and check what's wrong.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.327281 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO