The Number of Decimals to Save

 

For some algorithms, there is much important data to the right of the decimal place.  However, the piano only plays notes that are whole numbers.  In order to play numbers with a decimal component, this decimal must first be rounded off.  In order to avoid losing important data, you may enter a number of decimals to save.  This works by first multiplying each number by 10^(# of decimals), and then rounding the result.

 

For example, lets say we have the number

1.7584

and we want to save 2 decimal places.  The number is first multiplied...

1.7584  *  10^(2)  =  175.84

and then rounded...

175.84  -->round-->  176

 

Note that everything after the specified number of decimal places is still rounded off and lost, so make sure you include enough decimal places to accurately portray the music produced. 

Although the numbers produced this way might be quite large, using the "div" normalization will scale them back down to size and still keep their correct proportions.