Using a dynamic precision value in number_to_currency based on the decimal value
问题 Thoughout our app we use number_to_currency(value, :precision => 2) . However, we now have a requirement whereby the value may need displaying to three or more decimal places, e.g. 0.01 => "0.01" 10 => "10.00" 0.005 => "0.005" In our current implementation, the third example renders as: 0.005 => "0.01" What's the best approach for me to take here? Can number_to_currency be made to work for me? If not, how do I determine how many decimal places a given floating point value should be displayed