Forum: Poser Python Scripting


Subject: Floating point decimals and binary representation.

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


bagginsbill posted Tue, 24 August 2021 at 7:46 AM

OK so after a quick experiment I conclude your problem is simply that adding .1 each time is a bad way to do as the slight inaccuracy of representing .1 accumulates. Instead, just iterate on an integer and divide by 10.

Example:

for i in range(100):
    name = 'foo_copy_' + str(i/10) + '.bar'
    print(name)

Works just fine


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)