You are not logged in.
Pages: 1
I'm curious if Python has built in functionality to set numbers to an arbitrary decimal place without using the Decimal class? It seems rather absurd to me to do things like
float(Decimal(str(4.5 + (sin (radians(.062*count))+ 1.0))).quantize(Decimal(10) ** -4))
Casting a float to a string to a Decimal to a float feels like I'm working too hard.
Offline
are you aiming just for a certain precision in output?
if so..just use sprintf notation...
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
are you aiming just for a certain precision in output?
No. These are real number values for Gimp scripts.
Offline
I know that one problem one runs into with floating decimals is the fact that Base10 numbers don't always translate well to Base2 numbers. I've never worked on GIMP scripts, but can you fill me in on why you have to have only x number of sig figs?
Offline
The problem is is that I don't actually know what the threshold is. If I use this particular function from within Gimp's GUI, it only goes to 3 decimal places. I know for a fact that it will process alright with four or more, but I don't know how many. I'm guessing that it probably doesn't matter, but the nature of my scripts is that I have to maintain tight control over the data. If anything goes wrong, it will distroy my animations. The videos I'm making take 75+ hours to process, and I never know if something is wrong until I build and watch whole thing.
Offline
Pages: 1