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
110
小数の丸め誤差の話
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
51
CloudflareのAI関連の機能さわってみた
circled9
0
440
0.0.0.0 day
circled9
0
82
数値の文字列をパースしよう
circled9
0
160
🔥 Hono v4 やってみた
circled9
1
160
JetBrains AI Assistant を試してみた
circled9
1
450
Fresh
circled9
0
230
React Hooks 勉強会 vol.3
circled9
2
420
JSON.stringify()
circled9
2
480
Other Decks in Programming
See All in Programming
定理証明プラットフォーム lapisla.net
abap34
1
670
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
600
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
2.4k
Terraform で作る Amazon ECS の CI/CD パイプライン
hiyanger
0
110
Flatt Security XSS Challenge 解答・解説
flatt_security
0
1.1k
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
390
functionalなアプローチで動的要素を排除する
ryopeko
1
950
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
190
[JAWS-UG横浜 #79] re:Invent 2024 の DB アップデートは Multi-Region!
maroon1st
0
130
Fixstars高速化コンテスト2024準優勝解法
eijirou
0
200
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
0
230
盆栽転じて家具となる / Bonsai and Furnitures
aereal
0
2.2k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
32
6.4k
The Power of CSS Pseudo Elements
geoffreycrofte
75
5.4k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
The Invisible Side of Design
smashingmag
299
50k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
BBQ
matthewcrist
85
9.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
3k
No one is an island. Learnings from fostering a developers community.
thoeni
20
3.1k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Building Flexible Design Systems
yeseniaperezcruz
328
38k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.3k
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