Find Exponential Notation

Processing (and other Java-based languages) seem to put numbers in exponential notation when they are very, very small but not quite zero.

Example: -9.0145690E-4 is really -0.000090145690

Finding this to be a problem when trying to do things with those numbers later (like write audio sample values) I wrote a little Processing snippet that solves that problem, though does result in some loss of accuracy (since numbers are rounded up/down to 0).

Code:

Leave a Reply

Your email address will not be published. Required fields are marked *