Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6340997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:56:33+00:00 2026-05-24T19:56:33+00:00

i want to test some code to make sure it handles NAN , INF

  • 0

i want to test some code to make sure it handles NAN, INF and -INF inputs properly.

i know there exists functions that return NAN, INF and -INF, but as a Double:

unit IEEE754;
...
function NAN: Double;
function PositiveInfinity:  Double;
function NegativeInfinity:  Double;

Except in my case i need to test when a Currency is one of these three edge-case values. Unfortunatly you cannot convert any of these to a Double:

Test(NAN);

procedure Test(const Value: Currency);
  ...

There’s an EInvalidOp Invalid floating point operation exception when converting a Double NAN to a Currency.

Is it possible to assign a NAN to a Currency?

Perhaps, rather than it being possible to assign a NAN to a Currency, it is instead not possible – and i can just ignore this edge case.

Can i ignore this edge case?

Is it possible to “Set a Currency value to NAN, INF or -INF?”


{   David Heffernan says it's impossible for a currency to contain INF,-INF or NAN.
    So there's no need to test for it.
    http://stackoverflow.com/questions/7096966/set-a-currency-value-to-nan-inf-or-inf

    //Handle NaN, where exponent is -32767
    test(NAN, 'NAN');

    //Handle +inf, where exponent is 32767 and Negative is true
    test(PositiveInfinity, 'INF');

    //Handle -inf, where expondent is 32767 and Negative is true
    test(NegativeInfinity, '-INF');
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:56:34+00:00Added an answer on May 24, 2026 at 7:56 pm

    Currency is not an IEEE754 float type and does not have NAN or INF values.

    The documentation explains that Currency is implemented as a 64 bit integer with implicit scale of 10000 and that the range of possible values is -922337203685477.5808 to 922337203685477.5807. Since this covers the full range of a 64 bit integer it follows that there are no bit patterns available for sentinel values like NAN or INF.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running some benchmark tests over my code and I want to make sure
I want to extensively test some pieces of C code for memory leaks. On
I want to test some PHP on my local machine running Windows XP Professional.
I want to generate some test data so for each row in a table
Writing some test scripts in IronPython, I want to verify whether a window is
If I have some php classes inside a namespace com\test and want to import
I have some kind of test data and want to create a unit test
We want test the JTAPI feature of our application. Are there any emulator for
I want to test the behavior of a certain piece of .NET code in
There are some code samples for ActiveMQ C++ Client, which are asynchronous. What I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.