0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rubyの数値オブジェクトについて

Last updated at Posted at 2019-10-31

数値

p 4.8.class #何クラスに属しているのか見れる
p 4.8.methods #どんなメソッドをもっているのか

  • p 10 + 3 #足し算
  • p 10 * 3 #引き算
  • p 10 - 3 #引き算
  • p 10 / 3 #3
  • p 10 % 3 #1
  • p 10.0 / 3 #3.33333
  • p Rational(2,5) + Rational(3,4) #分数
  • p 2/5r + 3/4r #上記分数簡単に書いたもの
  • p 56.3 round #四捨五入
  • p 56.3 floor #小数点以下切り捨て
  • p 56.3 ceil #小数点以下切り上げ
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?