lmms
lmms copied to clipboard
Adjust model rounding behavior to avoid a potential future mystery bug
AutomatableModel::fittedValue() currently rounds values using nearbyintf(), whose behavior depends on the current rounding mode. The default rounding mode appears to be FE_TONEAREST and is not ever changed in the entire LMMS codebase, so fittedValue() has been doing the same thing as round(), but with the added possibility of exploding if someone in the future decides to call fesetround() somewhere. This PR replaces nearbyintf() with round() to be more explicit about the behavior and eliminate the possibility of any spooky action resulting from different rounding modes.
This PR also cleans up formatting and replaces two ifs with a call to clamp().