开发者

FloatToStr Delphi Conversion EInvalidOp

开发者 https://www.devze.com 2023-03-04 01:52 出处:网络
once again conversion problem in Delphi. I\'ve been through some other topics, that refer to similar problem, but nothing seems to work..

once again conversion problem in Delphi. I've been through some other topics, that refer to similar problem, but nothing seems to work.. What I want to do is to simple convert computetd solution ( in Extended format ) to String and then display it in TMemo. I tried these :

FloatToStrF( value, ffExponent, 15, 2 );

and I also tried to set these :

procedure TfrmMain.FormCreate(Sender: TObject);
begin
DecimalSeparator := '.';
Application.UpdateFormatSettings := false;
end;

and then use the simpliest one :

FloatToStr  

but I still can't get it working. I've no idea why it works here : http://delphi.about.com/library/rtl/blrtlFloatToStrF.htm

and doesn't in my program. I know that there is also 2nd version of FloatToStr with second parameter, but I haven't used it before and I am rather not a Delphi expert, so could someone give me an example code of the 2nd version of FloatToStr 开发者_运维知识库?

best regards

FloatToStr Delphi Conversion EInvalidOp

FloatToStr Delphi Conversion EInvalidOp


Not sure if it is the case but this error can arise if you have not initialized the value of the variable you are passing to FloatToStrF.

From the images you post it seems to be the case since you are trying to show the value of x0 and the compiler is issuing an initialization warning about that variable.

HTH

0

精彩评论

暂无评论...
验证码 换一张
取 消