Author Topic: Real value changing from C++ to Lisp  (Read 2134 times)

0 Members and 1 Guest are viewing this topic.

smans

  • Guest
Real value changing from C++ to Lisp
« on: August 21, 2013, 10:41:07 AM »
Hello everyone,

I'd like to return an ads_real (double) value to Lisp using acedRetReal(), but as a result the value is either rounded or truncated.

Here's the code :
int lisp_testReal(void)
{
    ads_real n = 4.59950316371;
    acedRetReal(n);
    return 0;
}

After calling the function in AutoCAD, this is what I get : 4.5995. Similar behavior if I set n to be equal to 1237.992458, the function will return 1237.99.
Is there any way to maintain the exact same number, without any modifications ? Thank you in advance.

I'm working on ObjectARX 2012 for AutoCAD 2012 x64 using MS Visual Studio 2008.

Kindly,
smans

owenwengerd

  • Bull Frog
  • Posts: 439
Re: Real value changing from C++ to Lisp
« Reply #1 on: August 21, 2013, 02:35:35 PM »
You are mistaken. The problem is in the way you are examining the returned value, not the value itself.

smans

  • Guest
Re: Real value changing from C++ to Lisp
« Reply #2 on: August 22, 2013, 06:06:31 AM »
It turned out the command line was just showing an approximation, but the value itself remained untouched from C++ to Lisp.

Thank you,
smans