Skip to content

Commit 4711594

Browse files
committed
adding more tricky questions
1 parent f0f9704 commit 4711594

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Loading

Javascript/Tricky-JS-Problems/why-does-adding-two-decimals-in-javascript-produce-a-wrong-result.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@ In particular only certain sums of powers of two are exactly representable. 0.5
77
---
88

99
### Why is 0.1 + 0.2 Not Equal to 0.3 in Most Programming Languages?
10+
11+
---
12+
13+
### Problem statement: How is it that 0.1 + 0.2 = 0.30000000000000004?
14+
15+
if you have done programming in languages like Java or C, you must be aware of different data types used to store values. The two data types we would be considering in the discussion ahead are integer and float.
16+
Integer data types store whole numbers, while float data types store fractional numbers.
17+
Before we proceed, let’s understand one small concept: How are numbers represented for computational purposes? Very small and very large numbers are usually stored in scientific notation. They are represented as:
18+
19+
![](assets/2020-10-06-22-02-56.png)

0 commit comments

Comments
 (0)