I need a method that go down the scale of a BigDecimal number created as variable
Example:
number1 = BigDecimal.new('154.4978')
number1 => 154.4978
now I want that number1 = 154.49. How I go down the scale?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Have you tried
#truncate:It’s all in the API documentation: http://rubydoc.info/stdlib/bigdecimal/1.8.7/BigDecimal:truncate