ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Real value changing from C++ to Lisp

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Siwar_M
548 Views, 2 Replies

Real value changing from C++ to Lisp

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 behaviour 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,

Siwar_M

2 REPLIES 2
Message 2 of 3
artc2
in reply to: Siwar_M

We don't round off real numbers internally - they are maintained as doubles.

 

How are you determining that the number has been rounded off?  If you are simply looking at the value on the Acad command line, then that roundoff is from the display, not from the actual variable being rounded off.

Message 3 of 3
Siwar_M
in reply to: artc2

You were right, the value remained unchanged, it was just the command line that was displaying an approximation.

 

Thank you for the help.

Siwar_M

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost