How do you programatically create decimal fields in Drupal forms?
I can't think of a better solution than to use a standard textfield with the element_validate_number() validator:

$form['element'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; t('Title'),
  '#element_validate' =&gt; array('element_validate_number'),
);


If you need something more complicated than the is_numeric() that gets run by element_validate_number() you just need to provide your own validation function, or if you want to mess with the widget itself then create your own element type using hook_element_info()