How do you programatically create decimal fields in Drupal forms? I simply need to be able to have a text field and validate if input is a decimal number like 100.00, 0.1, 10.6, etc.

I'm using Drupal 7.

Updated question to indicate 'programatic' solution (using Form API).
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()