Jump to content
Kryvich

Int, Frac functions and NaN value

Recommended Posts

Something went wrong with system functions Int and Frac in Delphi 12, Win32 platform.

 

At runtime, the result of the expression Frac(1.9) can be either 0.9 (as expected) or 0 or 0.89. I couldn't determine what affects this.

 

Interestingly, in the Evaluate/Modify window, the expressions Frac(1.9) and Int(1.9) always return -NAN, whatever that means.

 

FracEvaluate.thumb.jpg.f9862e72c41b5d80f62289a4a5dd60dc.jpg

 

Has anyone encountered these issues?

 

As a temporary workaround, I used x-Trunc(x) instead of Frac(x).

Edited by Kryvich

Share this post


Link to post

@David Heffernan This is evident not only in the debugger, but also at runtime. That's the question. Processor - AMD Ryzen 5 3600.

@DelphiUdIT That's good! I have the community edition, its version is 29.0.51961.7529, Delphi 12 Update 1.

 

Share this post


Link to post
3 hours ago, Kryvich said:

@David Heffernan This is evident not only in the debugger, but also at runtime. That's the question. Processor - AMD Ryzen 5 3600.

@DelphiUdIT That's good! I have the community edition, its version is 29.0.51961.7529, Delphi 12 Update 1.

 

Then please provide a complete but minimal reproduction. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×