Closed (fixed)
Project:
Computed Field
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
23 Feb 2009 at 17:31 UTC
Updated:
21 Aug 2009 at 06:29 UTC
Hi!
I'm trying to display floating point numbers (money, that is) with two decimals with no luck. All trailing decimal zeros get cut off. Is there any way to work around this? Other number formatting functions such as round() or ceil() work with no probs.
Sample:
$sum = $node->field_t1_pieces[0]['value'] * $node->field_t1_price[0]['value'];
$node_field[0]['value'] = number_format($sum,2);
Cheers,
Mikko
Comments
Comment #1
deekayen commentedI suspect that's the fault of having the incorrect field type. Make sure you defined the field as a decimal, not an integer.
Closing anyway because 5.x isn't supported anymore. You'll have to reproduce it in 6.x to re-open this.