Well, the variable $bitcoinamount is coming form post data $_POST['bitcoinamount']. So it's not necessarily a number to begin with.
I guess I could do something like
if ( is_float($ba) && $ba <= 21E6 && num_decimals($ba) <= 8 ) { return true; }
But I need a num_decimals() function.