The accuracy of this “write_data” command

My initial model size is “63.3663.98”,but when I use “write_data” command, the output size is "6.3359999999999999e+016.3979999999999997e+01", size changed. Did I make a mistake somewhere in input file? (623.5 KB) (1.1 KB) (334.1 KB)

No. Not all base 10 numbers are exactly representable in floating point (which uses a base 2 representation). When numbers are output in full precision, you can see that difference.

For further information on floating point math and its sometimes unexpected properties, please check out these websites (everybody doing computer simulations should be aware of these issues):

Thanks for reply. So, can I do something to get the same output size as input file?

Short of modifying the source code, no. It is not advisable, anyway.

1 Like