Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
進数を学ぼう!(Rubyの事例)
Search
KH
July 09, 2024
60
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
進数を学ぼう!(Rubyの事例)
KH
July 09, 2024
More Decks by KH
See All by KH
ファシリテーションテクニック / facilitation technic
kh777
0
18
Queryオブジェクトとは / What is a Query Object in Rails?
kh777
0
19
Ruby Silverを取得してみた
kh777
0
47
Ruby と Rails のざっくりとした Cookie の扱い方
kh777
0
20
睡眠テクニックを身につける / sleep-technique
kh777
0
72
Featured
See All Featured
Site-Speed That Sticks
csswizardry
13
1.6k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
A better future with KSS
kneath
240
18k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
540
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The Invisible Side of Design
smashingmag
301
52k
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
Visualization
eitanlees
153
17k
From π to Pie charts
rasagy
1
400
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Transcript
進数を学ぼう!(Ruby の事例)
IPv4アドレスは10進数表記・・・?(192.168.0.1) Rubyの進数表記・・・?(0b1010、0x1A) 進数わからん!!
10進数 • 「0」「1」「2」……「9」「10」のように、それぞ れの桁の数字が「10」になると桁上がりする数字の こと • 「0」から「9」までの組み合わせで表現される数字 • 例:391
2進数 • 「0」と「1」の組み合わせで表現される数字 • 「0」「1」「10」……のように、それぞれの桁の数 字が「2」になると桁上がりする数字のこと • 例:110(10進数では6)
8進数 • 「0」から「7」までの組み合わせで表現される数字 • 「0」「1」...「7」「10」……のように、それぞれの 桁の数字が「8」になると桁上がりする数字のこと • 例:377(10進数では255)
16進数 • 0から9までの数字とAからFまでのアルファベットの 組み合わせで表現される数字 • 「0」「1」「2」……「9」「A」「B」「C」「D」 「E」「F」のように、それぞれの桁の数字が「16」 になると桁上がりする数字のこと • 例:7D(10進数では126)
Ruby で進数に変換してみよう • String#to_i 文字列を引数に指定した2 〜 36の進数表現に変換する • 0b(2進数)0(8進数)0d(10進数)0x(16進数) 数字の接頭辞に指定することで、進数表現に変換する
• 例:0b10 => 2、010 => 8、0d10 => 10、0x10 => 16 • 例:’10’.to_i(8) => 8
進数を完全に理解できた