Forum: Poser Python Scripting


Subject: Floating point decimals and binary representation.

structure opened this issue on Aug 24, 2021 ยท 17 posts


odf posted Tue, 24 August 2021 at 4:17 AM

I'm not sure I understand the problem. If your application is to print version numbers, why represent them as floats, at all?

In general, to represent a number as a string rounded to a certain number of decimal places, say 3, you can use ("%.3f" % x).

for i in numpy.arange( 0.1, 0.9, 0.1 ):
  print("%.1f" % i)

-- I'm not mad at you, just Westphalian.