Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
小数の丸め誤差の話
Search
circled9
July 26, 2024
Programming
0
140
小数の丸め誤差の話
Niigata5分Tech #10の発表資料です。
https://niigata-5min-tech.connpass.com/event/324842/
circled9
July 26, 2024
Tweet
Share
More Decks by circled9
See All by circled9
キースイッチ入門
circled9
0
74
CloudflareのAI関連の機能さわってみた
circled9
0
600
0.0.0.0 day
circled9
0
100
数値の文字列をパースしよう
circled9
0
220
🔥 Hono v4 やってみた
circled9
1
190
JetBrains AI Assistant を試してみた
circled9
1
520
Fresh
circled9
0
240
React Hooks 勉強会 vol.3
circled9
2
440
JSON.stringify()
circled9
2
490
Other Decks in Programming
See All in Programming
関数型まつり2025登壇資料「関数プログラミングと再帰」
taisontsukada
2
850
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
270
VS Code Update for GitHub Copilot
74th
1
410
NPOでのDevinの活用
codeforeveryone
0
370
第9回 情シス転職ミートアップ 株式会社IVRy(アイブリー)の紹介
ivry_presentationmaterials
1
240
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
130
Julia という言語について (FP in Julia « SIDE: F ») for 関数型まつり2025
antimon2
3
980
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
420
なぜ適用するか、移行して理解するClean Architecture 〜構造を超えて設計を継承する〜 / Why Apply, Migrate and Understand Clean Architecture - Inherit Design Beyond Structure
seike460
PRO
1
690
GoのGenericsによるslice操作との付き合い方
syumai
3
690
deno-redisの紹介とJSRパッケージの運用について (toranoana.deno #21)
uki00a
0
150
Rubyでやりたい駆動開発 / Ruby driven development
chobishiba
1
440
Featured
See All Featured
Making Projects Easy
brettharned
116
6.3k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Designing for humans not robots
tammielis
253
25k
GitHub's CSS Performance
jonrohan
1031
460k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
How to train your dragon (web standard)
notwaldorf
94
6.1k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Code Reviewing Like a Champion
maltzj
524
40k
Building a Modern Day E-commerce SEO Strategy
aleyda
42
7.3k
A better future with KSS
kneath
239
17k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Embracing the Ebb and Flow
colly
86
4.7k
Transcript
খͷؙΊޡࠩͷ Niigata 5min Tech #10 @circled9 1
ࣗݾհ @circled9 দҪɹਖ਼ࢤ / Matsui Masashi גࣜձࣾϞχΫϧ جຊใٕज़ऀͷࢿ֨͋Γ·͕͢ هԱ͋Γ·ͤΜ 2
ࠓখͷؙΊޡࠩͷΛ͠·͢ 3
Node.js 4
Ͳ͏ͯ͠ʁ • ଟ͘ͷϓϩάϥϛϯάݴޠɺ෦తʹΛೋਐͰѻ͍ͬͯΔ • ेਐͷখΛೋਐʹม͢Δͱޡ͕ࠩੜ͡Δ߹͕͋Δ • Ή͠Ζޡ͕ࠩग़ͳ͍ํ͕গͳ͍ͷͰ...? 5
ेਐͷখΛೋਐͰද͢ͷ͍͠ • ೋਐͷͷNܻ2ͷN-1ͷ 1 1 1 1 = 15 8
4 2 1 • ҰํɺೋਐͷখͷNܻ2ͷϚΠφεN-1ͷ 0. 1 1 1 = 0.5 + 0.25 + 0.125 = 0.875 1 1/2 1/4 1/8 • 2ͷϚΠφεNͷΈ߹ΘͤͰਖ਼֬ʹදݱͰ͖Δʹݶք͕͋Δ 6
Node.js 7
Ͳ͏͢ΕޡࠩΛ͛Δ͔ • খͷܭࢉΛͯ͠େৎͳܕͳͲΛ͏ • খͰͳ͘ͷܭࢉʹ͢Δ 8
খͷܭࢉΛͯ͠େৎͳܕͳͲΛ͏ • C#ͷ߹decimalܕ͕͋Δ • Pythonͷ߹decimalϞδϡʔϧ͕͋Δ • JavaScriptͷ߹big.jsͳͲͷϥΠϒϥϦ͕͋Δ 9
Python 10
খͰͳ͘ͷܭࢉʹ͢Δ • ܭࢉ͢Δલʹʹͯ͠ɺܭࢉޙʹখʹ͢ • ྫ͑100Λ͔͚ͯɺ࠷ޙʹ100ͰׂΔ • ((0.1 * 100) +
(0.2 * 100)) / 100 • ͜ͷ߹ɺܭࢉରͷͷܻΛؾʹ͢Δඞཁ͕͋Δ 11
Node.js 12
·ͱΊ • ଟ͘ͷϓϩάϥϛϯάݴޠͰɺখͷܭࢉͰޡ͕ࠩൃੜ͢Δ • ޡࠩΛग़͞ͳ͍Α͏ʹ͢ΔʹదͳରԠΛ͢Δඞཁ͕͋Δ 13
ଟ͘ͷϓϩάϥϛϯάݴޠʁ 14
খͷܭࢉͰޡࠩͷग़ͳ͍ϓϩάϥϛϯάݴޠ • COBOL • Ada • MSX-BASIC • etc... දݱʹBCDΛ͏ͷ͕ϙΠϯτͬΆ͍
15
BCD • Binary-Coded DecimalɺೋਐԽेਐ • ೋਐ4ܻ͋Ε0͔Β15·ͰͷΛදͤΔͷͰɺ0͔Β9Λͬ ͯेਐͷҰܻΛදݱ͢Δ • ྫ͑ेਐͷ26ɺBCDͰ 0010
0110 ʹͳΔ • BCDجຊใٕज़ऀࢼݧͷࢼݧൣғʹؚ·Ε͍ͯΔ 16
BCDجຊใٕज़ऀࢼݧͷ ࢼݧൣғʹؚ·Ε͍ͯΔ 17
શʹΕͯͨͱ͍͏͔ ֮͑ͨهԱ͢Βͳ͍😇 18
Goݴޠ 19
20
https://go.dev/ref/spec#Constant_expressions υΩϡϝϯτᐌ͘ ఆࣜৗʹਖ਼֬ʹධՁ͞Ε·͢ Constant expressions are always evaluated exactly; 21
22
͓͠·͍ 23
ࢀߟࢿྉ • খΛѻ͏ͳΒBCDΛ࠾༻͍ͯ͠Δݴޠ͕ѹత • https://qiita.com/ma2shita/items/d8aeec9e2921dc3536f4 24