Hey there!
I am using Debug Server Scripting to evaluate an expression, in my case it is a variable:
input_val = activeDS.expression.evaluate("ll_in1")
Unfortunately I am facing a "precision loss" when printing the value/ writing it to a file. This can be reproduced using the following commands:
js:> input_val
-4615967861030116837
js:> print( input_val )
-4615967861030116000
js:> print( input_val.toString() )
-4615967861030116000
The three least significant decimal numbers are set to zeros.
The same is for file.write( str );
I really need the exact numbers. Does anybody know where this issue comes from (JavaScript data handling?) and how it can be solved?
Edit: FYI I am currently using the CCS-internal Scripting Console, but the script originally is called by a batch file calling the dss.bat on a Windows machine.
Edit 2: Seems to be JavaScript. I tried a "dirty workaround", but it does not work as expected:
var num = -4615967861030116837;
var d = 1e5;
var head = parseInt( num/d );
var tail = parseInt( num % d );
js:> head
-4.6159678610301E13
js:> tail
-16352.0
js:> num
-4.6159678610301164E18
Thank you,
Matthias