Most of Google searches that hit my blog are about ‘ruby on rails interview questions‘.
Responding to this popular request
, I will post 3 more questions that are related.
1. What type of data would you use to represent currency?
2. Why is it not a good practice to use float for currency?
3. Explain the following behaviour:
~$ ruby --version
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
~$ irb
irb(main):003:0> (10.12*100).to_i
=>; 1011
The answer – in my next post .
Advertisement
Filed under: ActiveRecord, Currency, Data Extraction, Data Modelling, interview questions, ruby-on-rails Tagged: | activerecord, currency, decimal, float, interview questions, rails, ruby
[...] Why You Shouldn’t Use Float for Currency (floating point issues – explained for Ruby and RoR) This article is a response to http://vladzloteanu.wordpress.com/2010/01/06/ruby-on-rails-interview-questions-update/ [...]