You could write a custom field formatter in a custom module. See drupal-root/modules/field/modules/number/number.module and copy the related stuff for 'number_decimal' and adapt it to "trim_decimal".
number_field_formatter_info()
number_field_formatter_settings_form()
number_field_formatter_settings_summary()
number_field_formatter_view()
In custom_module_field_formatter_view() define your formatter (here named: trim_decimal) like this:
...
case 'trim_decimal':
foreach ($items as $delta => $item) {
$output = number_format($item['value'], $settings['scale'], $settings['decimal_separator'], $settings['thousand_separator']);
// If scale, we want to remove trailing 0 and the decimal separator,
// if there are no digits after decimal separator.
if ($settings['scale']) {
$output = rtrim(rtrim($output, '0'), $settings['decimal_separator']);
}
if ($settings['prefix_suffix']) {
$prefixes = isset($instance['settings']['prefix']) ? array_map('field_filter_xss', explode('|', $instance['settings']['prefix'])) : array('');
$suffixes = isset($instance['settings']['suffix']) ? array_map('field_filter_xss', explode('|', $instance['settings']['suffix'])) : array('');
$prefix = (count($prefixes) > 1) ? format_plural($item['value'], $prefixes[0], $prefixes[1]) : $prefixes[0];
$suffix = (count($suffixes) > 1) ? format_plural($item['value'], $suffixes[0], $suffixes[1]) : $suffixes[0];
$output = $prefix . $output . $suffix;
}
$element[$delta] = array('#markup' => $output);
}
break;