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
130
小数の丸め誤差の話
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
69
CloudflareのAI関連の機能さわってみた
circled9
0
550
0.0.0.0 day
circled9
0
97
数値の文字列をパースしよう
circled9
0
210
🔥 Hono v4 やってみた
circled9
1
180
JetBrains AI Assistant を試してみた
circled9
1
500
Fresh
circled9
0
230
React Hooks 勉強会 vol.3
circled9
2
430
JSON.stringify()
circled9
2
490
Other Decks in Programming
See All in Programming
UMAPをざっくりと理解 / Overview of UMAP
kaityo256
PRO
3
1.5k
JAWS DAYS 2025 re_Cheers: WEB
komakichi
0
110
Global Azure 2025 @ Kansai / Hyperlight
kosmosebi
0
140
エンジニアが挑む、限界までの越境
nealle
1
330
Embracing Ruby magic
vinistock
2
220
Vibe Coding の話をしよう
schroneko
14
3.8k
Flutterでllama.cppをつかってローカルLLMを試してみた
sakuraidayo
0
140
On-the-fly Suggestions of Rewriting Method Deprecations
ohbarye
3
5.3k
生成AI時代のフルスタック開発
kenn
3
340
バイラテラルアップサンプリング
fadis
3
470
VibeCoding時代のエンジニアリング
daisuketakeda
0
150
Boost Your Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
840
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.2k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
14
1.5k
Code Review Best Practice
trishagee
68
18k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
5
560
The Invisible Side of Design
smashingmag
299
50k
Six Lessons from altMBA
skipperchong
28
3.8k
Facilitating Awesome Meetings
lara
54
6.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
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