This works in general:
ceil(number*10)/10
So in Ruby it should be like:
(number*10).ceil/10.0
More Related Contents:
- Very Basic Ruby puts and gets
- Why is division in Ruby returning an integer instead of decimal value?
- How to sum array of numbers in Ruby?
- How to deal with the sum of rounded percentage not being 100?
- Ruby factorial function
- All factors of a given number
- How to call methods dynamically based on their name? [duplicate]
- How to round a number to significant figures in Python
- Executing code for every method call in a Ruby module
- How to split (chunk) a Ruby array into parts of X elements? [duplicate]
- ActionController::UnknownFormat
- How to merge Ruby hashes
- Double Pipe Symbols in Ruby Variable Assignment? [duplicate]
- How can I clear the terminal in Ruby?
- What is the difference between Raising Exceptions vs Throwing Exceptions in Ruby?
- List of installed gems?
- How can I find the number of days between two Date objects in Ruby?
- Why is sum so much faster than inject(:+)?
- Ruby: extend self
- What are those pipe symbols for in Ruby?
- Ruby’s yield feature in relation to computer science
- How to make Sinatra work over HTTPS/SSL?
- Rubygems: How do I add platform-specific dependency?
- ERROR: Error installing ffi: ERROR: Failed to build gem native extension
- Is there a hook similar to Class#inherited that’s triggered only after a Ruby class definition?
- What is the opposite of string.next?
- How to use double brackets in a regular expression?
- Is there a ‘variable_get’ method? If not, how can I create my own?
- unzip (zip, tar, tag.gz) files with ruby
- What are the magic $-prefixed variables in Ruby? [closed]