From the original SynthMaker forum (2004–2014), with its members’ names and dates.
grease ·
I thought I should post in the bug forum...please see another thread:
Some utilitarian modules (also: float point error?)
SynthMaker calculates (21)*(0.05) + (-1) = 0.0500001. Is this a bug, or just a result of floating point arithmetic? Sorry - I don't know the basic ideas and terminology associated, but I understand these kinds of errors are an inevitable by-product of discrete computation.
malc ·
Hi grease, I'm pretty sure this isn't a bug. As you've suggested, it happens as a result of the way floats are represented (4 bytes only gives you a finite number of floats).
The best way to get round this would be for us to provide a string formatting component to give you control over number of dps etc. Like many things at the moment this is easy to do, we just need to do it. I'll see if I can squeeze it in soon.
An alternative for now would be to use integer arithmetic and string concatenation to build a float string to a certain number of dp's. Something like this:
You might have to subtract the 0.0001 in the case where the float is negative.
grease ·
OK, thanks for the response. This is definitely low-priority!
stefan ·
I just tried to do the same float calculations here at work. It ends up as 0.05.... 🙂 In C++ that is, not in SM.
Wrote something here? To have a post removed or your name hidden, write to [email protected].