Skip to content

FAQ: The printout of casadi.DM shows only a few digits. How to print it more accurately?

András Retzler edited this page Dec 7, 2022 · 2 revisions

TL;DR casadi.DM.set_precision(16)

Example:

>>> import math
>>> import casadi
>>> A=casadi.DM(math.pi)
>>> A
DM(3.14159)
>>> casadi.DM.set_precision(16)
>>> A
DM(3.141592653589793)

The help about it says:

set_precision(int precision)
      Set the 'precision, width & scientific' used in printing and serializing to streams.
Clone this wiki locally