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
150
小数の丸め誤差の話
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
80
CloudflareのAI関連の機能さわってみた
circled9
0
670
0.0.0.0 day
circled9
0
110
数値の文字列をパースしよう
circled9
0
240
🔥 Hono v4 やってみた
circled9
1
200
JetBrains AI Assistant を試してみた
circled9
1
540
Fresh
circled9
0
250
React Hooks 勉強会 vol.3
circled9
2
440
JSON.stringify()
circled9
2
500
Other Decks in Programming
See All in Programming
1から理解するWeb Push
dora1998
7
1.8k
Design Foundational Data Engineering Observability
sucitw
3
180
Kiroで始めるAI-DLC
kaonash
2
570
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
960
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
130
AIコーディングAgentとの向き合い方
eycjur
0
260
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
220
Claude Codeで実装以外の開発フロー、どこまで自動化できるか?失敗と成功
ndadayo
4
2k
Putting The Genie in the Bottle - A Crash Course on running LLMs on Android
iurysza
0
130
AIエージェント開発、DevOps and LLMOps
ymd65536
1
380
2025 年のコーディングエージェントの現在地とエンジニアの仕事の変化について
azukiazusa1
20
10k
時間軸から考えるTerraformを使う理由と留意点
fufuhu
14
4.5k
Featured
See All Featured
How to Ace a Technical Interview
jacobian
279
23k
The Art of Programming - Codeland 2020
erikaheidi
55
13k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
Side Projects
sachag
455
43k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Faster Mobile Websites
deanohume
309
31k
Making Projects Easy
brettharned
117
6.4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
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