# 5.4: Decimal Operations (Part 2)

## Divide Decimals

Just as with multiplication, division of decimals is very much like dividing whole numbers. We just have to figure out where the decimal point must be placed.

To understand decimal division, let’s consider the multiplication problem

[(0.2)(4) = 0.8]

Remember, a multiplication problem can be rephrased as a division problem. So we can write 0.8 ÷ 4 = 0.2 We can think of this as “If we divide 8 tenths into four groups, how many are in each group?” Figure (PageIndex{1}) shows that there are four groups of two-tenths in eight-tenths. So 0.8 ÷ 4 = 0.2.

Figure (PageIndex{1})

Using long division notation, we would write

Notice that the decimal point in the quotient is directly above the decimal point in the dividend.

To divide a decimal by a whole number, we place the decimal point in the quotient above the decimal point in the dividend and then divide as usual. Sometimes we need to use extra zeros at the end of the dividend to keep dividing until there is no remainder.

HOW TO: DIVIDE A DECIMAL BY A WHOLE NUMBER

Step 1. Write as long division, placing the decimal point in the quotient above the decimal point in the dividend.

Step 2. Divide as usual.

Example (PageIndex{9}):

Divide: 0.12 ÷ 3.

Solution

0.12 ÷ 3 = 0.04

Exercise (PageIndex{17}):

Divide: 0.28 ÷ 4.

(0.07)

Exercise (PageIndex{18}):

Divide: 0.56 ÷ 7.

(0.08)

In everyday life, we divide whole numbers into decimals—money—to find the price of one item. For example, suppose a case of 24 water bottles cost $3.99. To find the price per water bottle, we would divide$3.99 by 24, and round the answer to the nearest cent (hundredth).

Example (PageIndex{10}):

Divide: $3.99 ÷ 24. Solution$3.99 ÷ 24 ≈ $0.17 This means the price per bottle is 17 cents. Exercise (PageIndex{19}): Divide:$6.99 ÷ 36.

($0.19) Exercise (PageIndex{20}): Divide:$4.99 ÷ 12.

($0.42) ### Divide a Decimal by Another Decimal So far, we have divided a decimal by a whole number. What happens when we divide a decimal by another decimal? Let’s look at the same multiplication problem we looked at earlier, but in a different way. [(0.2)(4) = 0.8] Remember, again, that a multiplication problem can be rephrased as a division problem. This time we ask, “Ho w many times does 0.2 go into 0.8?” Because (0.2)(4) = 0.8, we can say that 0.2 goes into 0.8 four times. This means that 0.8 divided by 0.2 is 4. [0.8 div 0.2 = 4] We would get the same answer, 4, if we divide 8 by 2, both whole numbers. Why is this so? Let’s think about the division problem as a fraction. [dfrac{0.8}{0.2}] [dfrac{(0.8)10}{(0.2)10}] [dfrac{8}{2}] [4] We multiplied the numerator and denominator by 10 and ended up just dividing 8 by 2. To divide decimals, we multiply both the numerator and denominator by the same power of 10 to make the denominator a whole number. Because of the Equivalent Fractions Property, we haven’t changed the value of the fraction. The effect is to move the decimal points in the numerator and denominator the same number of places to the right. We use the rules for dividing positive and negative numbers with decimals, too. When dividing signed decimals, first determine the sign of the quotient and then divide as if the numbers were both positive. Finally, write the quotient with the appropriate sign. It may help to review the vocabulary for division: HOW TO: DIVIDE DECIMAL NUMBERS Step 1. Determine the sign of the quotient. Step 2. Make the divisor a whole number by moving the decimal point all the way to the right. Move the decimal point in the dividend the same number of places to the right, writing zeros as needed. Step 3. Divide. Place the decimal point in the quotient above the decimal point in the dividend. Step 4. Write the quotient with the appropriate sign. Example (PageIndex{11}): Divide: −2.89 ÷ (3.4). Solution Exercise (PageIndex{21}): Divide: −1.989 ÷ 5.1. Answer (-0.39) Exercise (PageIndex{22}): Divide: −2.04 ÷ 5.1. Answer (-0.4) Example (PageIndex{12}): Divide: −25.65 ÷ (−0.06). Solution Exercise (PageIndex{23}): Divide: −23.492 ÷ (−0.04). Answer (587.3) Exercise (PageIndex{24}): Divide: −4.11 ÷ (−0.12). Answer (34.25) Now we will divide a whole number by a decimal number. Example (PageIndex{13}) Divide: 4 ÷ (0.05). Solution We can relate this example to money. How many nickels are there in four dollars? Because 4 ÷ 0.05 = 80, there are 80 nickels in$4.

Exercise (PageIndex{25}):

Divide: 6 ÷ 0.03.

(200)

Exercise (PageIndex{26}):

Divide: 7 ÷ 0.02

(350)

## Use Decimals in Money Applications

We often apply decimals in real life, and most of the applications involving money. The Strategy for Applications we used in The Language of Algebra gives us a plan to follow to help find the answer. Take a moment to review that strategy now.

Strategy for Applications

1. Identify what you are asked to find.
2. Write a phrase that gives the information to find it.
3. Translate the phrase to an expression.
4. Simplify the expression.
5. Answer the question with a complete sentence.

Example (PageIndex{14}):

Paul received $50 for his birthday. He spent$31.64 on a video game. How much of Paul’s birthday money was left?

Solution

 What are you asked to find? How much did Paul have left? Write a phrase. $50 less$31.64 Translate. 50 − 31.64 Simplify. 18.36 Write a sentence. Paul has $18.36 left. Exercise (PageIndex{27}): Nicole earned$35 for babysitting her cousins, then went to the bookstore and spent $18.48 on books and coffee. How much of her babysitting money was left? Answer ($16.52)

Exercise (PageIndex{28}):

Amber bought a pair of shoes for $24.75 and a purse for$36.90. The sales tax was $4.32. How much did Amber spend? Answer ($65.97)

Example (PageIndex{15}):

Jessie put 8 gallons of gas in her car. One gallon of gas costs $3.529. How much does Jessie owe for the gas? (Round the answer to the nearest cent.) Solution  What are you asked to find? How much did Jessie owe for all the gas? Write a phrase. 8 times the cost of one gallon of gas Translate. 8($3.529) Simplify. $28.232 Round to the nearest cent.$28.23 Write a sentence. Jessie owes $28.23 for her gas purchase. Exercise (PageIndex{29}): Hector put 13 gallons of gas into his car. One gallon of gas costs$3.175. How much did Hector owe for the gas? Round to the nearest cent.

($41.28) Exercise (PageIndex{30}): Christopher bought 5 pizzas for the team. Each pizza cost$9.75. How much did all the pizzas cost?

($48.75) Example (PageIndex{16}): Four friends went out for dinner. They shared a large pizza and a pitcher of soda. The total cost of their dinner was$31.76. If they divide the cost equally, how much should each friend pay?

Solution

 What are you asked to find? How much should each friend pay? Write a phrase. $31.76 divided equally among the four friends. Translate to an expression.$31.76 ÷ 4 Simplify. $7.94 Write a sentence. Each friend should pay$7.94 for his share of the dinner.

Exercise (PageIndex{31}):

Six friends went out for dinner. The total cost of their dinner was $92.82. If they divide the bill equally, how much should each friend pay? Answer ($15.47)

Exercise (PageIndex{32}):

Chad worked 40 hours last week and his paycheck was $570. How much does he earn per hour? Answer ($14.25)

Be careful to follow the order of operations in the next example. Remember to multiply before you add.

Example (PageIndex{17}):

Marla buys 6 bananas that cost $0.22 each and 4 oranges that cost$0.49 each. How much is the total cost of the fruit?

Solution

 What are you asked to find? How much is the total cost of the fruit? Write a phrase. 6 times the cost of each banana plus 4 times the cost of each orange Translate to an expression. 6($0.22) + 4($0.49) Simplify. $1.32 +$1.96 Add. $3.28 Write a sentence. Marla's total cost for the fruit is$3.28.

Exercise (PageIndex{33}):

Suzanne buys 3 cans of beans that cost $0.75 each and 6 cans of corn that cost$0.62 each. How much is the total cost of these groceries?

($5.97) Exercise (PageIndex{34}): Lydia bought movie tickets for the family. She bought two adult tickets for$9.50 each and four children’s tickets for $6.00 each. How much did the tickets cost Lydia in all? Answer ($43.00)

## Practice Makes Perfect

### Add and Subtract Decimals

In the following exercises, add or subtract.

1. 16.92 + 7.56
2. 18.37 + 9.36
3. 256.37 − 85.49
4. 248.25 − 91.29
5. 21.76 − 30.99
6. 15.35 − 20.88
7. 37.5 + 12.23
8. 38.6 + 13.67
9. −16.53 − 24.38
10. −19.47 − 32.58
11. −38.69 + 31.47
12. −29.83 + 19.76
13. −4.2 + (− 9.3)
14. −8.6 + (− 8.6)
15. 100 − 64.2
16. 100 − 65.83
17. 72.5 − 100
18. 86.2 − 100
19. 15 + 0.73
20. 27 + 0.87
21. 2.51 + 40
22. 9.38 + 60
23. 91.75 − (− 10.462)
24. 94.69 − (− 12.678)
25. 55.01 − 3.7
26. 59.08 − 4.6
27. 2.51 − 7.4
28. 3.84 − 6.1

### Multiply Decimals

In the following exercises, multiply.

1. (0.3)(0.4)
2. (0.6)(0.7)
3. (0.24)(0.6)
4. (0.81)(0.3)
5. (5.9)(7.12)
6. (2.3)(9.41)
7. (8.52)(3.14)
8. (5.32)(4.86)
9. (−4.3)(2.71)
10. (− 8.5)(1.69)
11. (−5.18)(− 65.23)
12. (− 9.16)(− 68.34)
13. (0.09)(24.78)
14. (0.04)(36.89)
15. (0.06)(21.75)
16. (0.08)(52.45)
17. (9.24)(10)
18. (6.531)(10)
19. (55.2)(1,000)
20. (99.4)(1,000)

### Divide Decimals

In the following exercises, divide.

1. 0.15 ÷ 5
2. 0.27 ÷ 3
3. 4.75 ÷ 25
4. 12.04 ÷ 43
5. $8.49 ÷ 12 6.$16.99 ÷ 9
7. $117.25 ÷ 48 8.$109.24 ÷ 36
9. 0.6 ÷ 0.2
10. 0.8 ÷ 0.4
11. 1.44 ÷ (− 0.3)
12. 1.25 ÷ (− 0.5)
13. −1.75 ÷ (− 0.05)
14. −1.15 ÷ (− 0.05)
15. 5.2 ÷ 2.5
16. 6.5 ÷ 3.25
17. 12 ÷ 0.08
18. 5 ÷ 0.04
19. 11 ÷ 0.55
20. 14 ÷ 0.35

## Mixed Practice

In the following exercises, simplify.

1. 6(12.4 − 9.2)
2. 3(15.7 − 8.6)
3. 24(0.5) + (0.3)2
4. 35(0.2) + (0.9)2
5. 1.15(26.83 + 1.61)
6. 1.18(46.22 + 3.71)
7. $45 + 0.08($45)
8. $63 + 0.18($63)
9. 18 ÷ (0.75 + 0.15)
10. 27 ÷ (0.55 + 0.35)
11. (1.43 + 0.27) ÷ (0.9 − 0.05)
12. (1.5 − 0.06) ÷ (0.12 + 0.24)
13. [$75.42 + 0.18($75.42)] ÷ 5
14. [$56.31 + 0.22($56.31)] ÷ 4

### Use Decimals in Money Applications

In the following exercises, use the strategy for applications to solve.

1. Spending money Brenda got $40 from the ATM. She spent$15.11 on a pair of earrings. How much money did she have left?
2. Spending money Marissa found $20 in her pocket. She spent$4.82 on a smoothie. How much of the $20 did she have left? 3. Shopping Adam bought a t-shirt for$18.49 and a book for $8.92 The sales tax was$1.65. How much did Adam spend?
4. Restaurant Roberto’s restaurant bill was $20.45 for the entrée and$3.15 for the drink. He left a $4.40 tip. How much did Roberto spend? 5. Coupon Emily bought a box of cereal that cost$4.29. She had a coupon for $0.55 off, and the store doubled the coupon. How much did she pay for the box of cereal? 6. Coupon Diana bought a can of coffee that cost$7.99. She had a coupon for $0.75 off, and the store doubled the coupon. How much did she pay for the can of coffee? 7. Diet Leo took part in a diet program. He weighed 190 pounds at the start of the program. During the first week, he lost 4.3 pounds. During the second week, he had lost 2.8 pounds. The third week, he gained 0.7 pounds. The fourth week, he lost 1.9 pounds. What did Leo weigh at the end of the fourth week? 8. Snowpack On April 1, the snowpack at the ski resort was 4 meters deep, but the next few days were very warm. By April 5, the snow depth was 1.6 meters less. On April 8, it snowed and added 2.1 meters of snow. What was the total depth of the snow? 9. Coffee Noriko bought 4 coffees for herself and her coworkers. Each coffee was$3.75. How much did she pay for all the coffees?
10. Subway Fare Arianna spends $4.50 per day on subway fare. Last week she rode the subway 6 days. How much did she spend for the subway fares? 187. Income Mayra earns$9.25 per hour. Last week she worked 32 hours. How much did she earn?
11. Income Peter earns $8.75 per hour. Last week he worked 19 hours. How much did he earn? 12. Hourly Wage Alan got his first paycheck from his new job. He worked 30 hours and earned$382.50. How much does he earn per hour?
13. Hourly Wage Maria got her first paycheck from her new job. She worked 25 hours and earned $362.50. How much does she earn per hour? 14. Restaurant Jeannette and her friends love to order mud pie at their favorite restaurant. They always share just one piece of pie among themselves. With tax and tip, the total cost is$6.00. How much does each girl pay if the total number sharing the mud pie is (a) 2? (b) 3? (c) 4? (d) 5? (e) 6?

Amount charged for classes = $225 −$45 = $180 Number of classes = 180/30 = 6 Q 6 - If the division of p by 13.2 gives a quotient of 9.8 and remainder 8, find p. ## 25. Numeric operations If no number is specified on the command line, factor reads numbers from standard input, delimited by newlines, tabs, or spaces. The only options are  --help ' and  --version '. See section 2. Common options. The algorithm it uses is not very sophisticated, so for some inputs factor runs for a long time. The hardest numbers to factor are the products of large primes. Factoring the product of the two largest 32-bit prime numbers takes over 10 minutes of CPU time on a 400MHz Pentium II. In contrast, factor factors the largest 64-bit number in just over a tenth of a second: ## 25.2 seq : Print numeric sequences seq prints a sequence of numbers to standard output. Synopses: seq prints the numbers from first to last by increment . By default, first and increment are both 1, and each number is printed on its own line. All numbers can be reals, not just integers. The program accepts the following options. Also see 2. Common options.  -f format '  --format= format ' Print all numbers using format default  %g '. format must contain exactly one of the floating point output formats  %e ',  %f ', or  %g '.  -s string '  --separator= string ' Separate numbers with string default is a newline. The output always terminates with a newline.  -w '  --equal-width ' Print all numbers with the same width, by padding with leading zeroes. (To have other kinds of padding, use  --format '). If you want to use seq to print sequences of large integer values, don't use the default  %g ' format since it can result in loss of precision: Instead, you can use the format,  %1.f ', to print large decimal numbers with no exponent and no decimal point. If you want hexadecimal output, you can use printf to perform the conversion: For very long lists of numbers, use xargs to avoid system limitations on the length of an argument list: To generate octal output, use the printf %o format instead of %x . Note however that using printf works only for numbers smaller than 2^32 : On most systems, seq can produce whole-number output for values up to 2^53 , so here's a more general approach to base conversion that also happens to be more robust for such large numbers. It works by using bc and setting its output radix variable, obase , to  16 ' in this case to produce hexadecimal output. Be careful when using seq with a fractional increment , otherwise you may see surprising results. Most people would expect to see 0.3 printed as the last number in this example: But that doesn't happen on most systems because seq is implemented using binary floating point arithmetic (via the C double type) -- which means some decimal numbers like .1 cannot be represented exactly. That in turn means some nonintuitive conditions like .1 * 3 > .3 will end up being true. To work around that in the above example, use a slightly larger number as the last value: In general, when using an increment with a fractional part, where ( last - first ) / increment is (mathematically) a whole number, specify a slightly larger (or smaller, if increment is negative) value for last to ensure that last is the final value printed by seq. ## More word problem worksheets Explore all of our math word problem worksheets, from kindergarten through grade 5. K5 Learning offers free worksheets, flashcards and inexpensive workbooks for kids in kindergarten to grade 5. We help your children build good study habits and excel in school. Download & Print From only$2.20

K5 Learning offers free worksheets, flashcards and inexpensive workbooks for kids in kindergarten to grade 5. We help your children build good study habits and excel in school.

By taking the quotient as 910.0 / 28 SQL Server will retain decimal precision. Then, make your cast to a decimal with two places. By the way, as far as I know CONVERT typically takes just two parameters when converting a number to decimal.

we can use this query for dynamic value from table:

It will give the desire output

Unsure if this applies to your database, but in Trino SQL (a sort of database middleware layer), I find adding a decimal point followed by two zeros to any of two operands in this query (e.g., select 910.00/23 AS average or select 910/23.00 AS average ) returns a non-integer value ( 39.57 , instead of 39 ).

Adding 3 zeros after the decimal ( select 910.000/23 AS average ) returns a 3-decimal place result ( 39.565 ), and so on.

## 5.4: Decimal Operations (Part 2)

Multiplication of decimals relies on knowing how to multiply whole numbers, understanding place value, and appreciating the various multiplication situations involving decimals. The endless base ten chain shows the consistency of the base ten place value system from whole numbers to decimals.

As with whole number multiplication, the order of the numbers being multiplied does not affect the product. This is called the commutative property of multiplication.

Multiplying a decimal by a whole number

Multiplying decimals relies on adapting multiplication of whole numbers. When one of the numbers being multiplied is reduced to a tenth of its original size, the product is also reduced to a tenth of its original size. The following chart demonstrates this relationship.

Three groups of eight ones is 24 ones.

Three groups of eight tenths is 24 tenths.

24 tenths is the same as 2 ones and 4 tenths.

Three groups of eight hundredths is 24 hundredths.

Three groups of eight thousandths is 24 thousandths.

Multiplying decimals by decimals

When multiplying a number by a decimal less than one, the product will be smaller than the number being multiplied. This is because we are finding a fractional amount of a quantity. For example, 0.1 x 0.8 = 0.08, because the question is asking us to find one tenth of eight tenths. A tenth of a tenth (or a tenth multiplied by a tenth) is a hundredth, thus one tenth of eight tenths is eight hundredths.

Viewing decimal multiplication problems in common fraction and extended decimal form may help us better understand the answer. We can link multiplication of decimals to common fractions because we know that 0.1 (one tenth) is the same as 1/10, or 1 ÷ 10. Similarly, we can expand the way we record decimals to gain an understanding of the size of answers because we know that 0.1 is the same as 1 x 0.1, or 1 ÷ 10. We can rewrite 0.1 x 0.8 as:

• 1/10 x 8/10 = 8/100 = 0.08 (using rules for fraction multiplication)
• 0.1 x (0.1 x 8) = 0.01 x 8 = 0.08 (using rules for decimal multiplication)
• one tenth of eight tenths is eight hundredths (using common sense)

The relationship between the place value of the numbers being multiplied and the product is summarised by the following chart. As we move to the right or down the chart, the numbers increase by a factor of ten, so the answers increase by a factor of ten.

Rule for multiplying decimals

A common way to multiply decimals is to treat them as whole numbers, and then position the decimal point in the product. The number of digits after the decimal points in the factors determines where the decimal point is placed in the answer.

For example, 0.3 x 0.8 = 0.24. There is one digit after the decimal point in both 0.3 and 0.8, two digits altogether, so the answer will have two digits after the decimal point. We know that 3 x 8 = 24, so we can place the decimal point in front of two digits, giving 0.24. This method relies on a sound understanding of place value to check that answers are reasonable.

0.4 has one decimal place, 0.5 has one decimal place, so my answer will have two decimal places.

This is 4 tenths of 5 tenths.

Tenths by tenths gives hundredths, so my answer will have two decimal places.

4 tenths x 5 tenths = 20 hundredths

Example 1: Full explanation of 1.8 x 2.3 = 4.14

A wire expands to 1.8 times its length when heated. The wire is 2.3 cm long. How long will it be when heated?

This is nearly 2 times 2.3 cm, so the answer will be about 4 cm.

The easiest way to do this example is to use whole number multiplication and then adjust our answer accordingly.

To be able to multiply 18 by 23 we multiply 1.8 by 10 and 2.3 by 10 and so have actually multiplied by 100.

(1.8 x 10 x 2.3 x 10 = 18 x 23 x 100)

Once we have done the whole number multiplication, we must then divide our answer by 100 to compensate for this.

Out final answer is one hundredth of 18 x 23.

Example 2: Placing the decimal point, 23 x 0.67 = 15.41

Petrol costs .67 per litre. Khumalo pumps 23 litres of petrol into his car. How much does it cost him? To find this out I need to multiply 23 litres by .67. 0.67 is over half of one dollar, so my answer will be over $11 (half of$22).

Example 3: Full explanation of 0.234 x 0.07 = 0.01638

We can use whole number multiplication to solve this problem if we are aware of how decimals relate to whole numbers.

0.234 can be expressed as 234 thousandths and 0.07 can be expressed as 7 hundredths. This can be confirmed using a number expander (discussed in Meaning and Models).

We then do the multiplication as whole number multiplication.

Because we are multiplying thousandths and hundredths, our answer will be in hundred-thousandths.

We now need to express 1638 hundred-thousandths as a decimal. If we are not sure how to do this we can use the number expander.

The following movie shows a 'procedural' method being used to solve this problem.

Rows of zeros contribute nothing to the final answer and therefore are a waste of time and ink. The decimal point can be placed without multiplying the rows of zeros. 234 x 7 is 1638, but 0.237 x 0.07 will have 5 decimal places in the answer, so it will be 0.01638.

Caution: if you use the rule of counting decimal places in the question to find the number of decimal places in the answer, you MUST not discard zeros too early. For example, to multiply 0.25 by 0.4, you need 2+1 decimal places and the multiplication without a decimal point gives 0100. The answer is therefore 0.100. This is equal to 0.1, but the right-most decimal places cannot be discarded until after the multiplication rule has been used.

 Why is it not necessary to line up the decimal point to multiply? In addition and subtraction, it is important to line up the place value columns because we can only add or subtract digits in the same place value columns. We can, however, multiply digits in one place value column by those in another, so we do not need to line up the columns.

Multiplication Quiz

1. Given that 4857 x 6 = 29142, find:

 (a) 4857 x 0.6 (b) 48.57 x 0.6 (c) 485.7 x 0.0006

 2 1.5 x 7.62 3 0.4 x 0.06 4 0.002 x 0.05

1. Find the product of 7.15 and 1.9

3. Steve’s stride is 84.6 cm. How many centimetres will he travel if he takes 200 strides?

4. The length of my front garden bed is 4.3 times longer than the length of my back garden bed. If the length of my back garden bed is 156 cm, how long is my front garden bed?

5. Is the following statement true or false: 9.6734 x 0.9 > 9.6734?

If you would like to do some more questions, click here to go to the mixed operations quiz at the end of the division section.

## Naming decimal places

Naming decimal places can be defined as an expression of place value in words.

Apart from integers whose value has to be greater than “negative infinity” (symbol: $-infty$) and smaller than “positive infinity” or just “infinity” (symbol: infty$), there are also decimal numbers that represent the number of equal portions between two adjacent integers (adjacent integers are numbers that have been placed before and after the representing number). A decimal number is made of an integer part, placed on the left side of a decimal point, and a fractional part, placed on the right side of a decimal point. As a matter a fact, decimals are numbers which tells us how many parts of a whole we have. We use them to mark measure units of things that are not completely whole. Decimals are numbers which tells us how many parts of a whole we have. We use them to mark measure units of things that are not completely whole. Unit is a part of a decimal which tells us how many whole parts we have while mantissa tells us how many parts of a whole do we have left. The decimal or a decimal number can be written as a fraction. As an example of a decimal number, let’s take the number$ 28.531$. Now, number$28$(the left side of the decimal point) represents the integer part of the decimal number and$.531$(the right side of the decimal point) represents the decimal part of the number. The$ .531$represents a value which is smaller than$1$, but larger than$ and can also be represented as a fraction $frac<531> <1000>$. No matter how many digits there are after the decimal, their combined value is always less than $1$ but more than $. Thus, the value of the number$ 28.531$is greater than the value of the whole number$28$, but lesser than the value of the whole number$29$. Naming decimal places plays an important role in the representation of the number as a whole. Since the decimal system we use is a positional numeric system, all of the digits in a decimal number is termed according to their position in respect to the decimal point and it is important to name the decimal places properly. The entire decimal system is completely based on number$10$and all of the digits, before and after the decimal point, are defined in terms of ten because of that. The digit placed furthest to the right of the decimal point has the smallest value. Hence, in the number$28.531$, the digit 5 is placed furthest from the decimal point and hence has the smallest value. The entire number can be defined as$ 2cdot 10+8 cdot 1+5 cdot frac<1><10>+3 cdot frac<1><100>+1 cdot frac<1><1000>$. The number after the decimal point can be collectively pronounced as$6$tenths,$4$hundredths and$5$thousandths or, more simply, as$645$thousandths. All the place values of the numbers depend on position on the left or right side of a decimal point. Look at the example with more digits. Let’s take a look at, for example the number$1,987,654,321.123456$, The first digit before the decimal point represents the ones (number$1$), -the second stands for the tens (number$2$), the third for the hundreds (number$3$), -the fourth for the thousands (number$4$, after the comma), -the fifth for the ten thousands (number$5$), -the sixth for the hundred thousands (number$6$), -the seventh for the millions (number$7$, after the second comma), -the eight for the ten millions (number$8$), -the ninth for the hundred millions (number$9$) and -the tenth for the billions (number$1$, after the third comma). All digits after the decimal point are called decimals. -The first digit represents tenths (number$1$), -the second digit stands for the hundredths (number$2$), -third for the thousandths (number$3$), -fourth for the ten thousandths (number$4$), -fifth for the hundred thousandths (number$5$), -sixth for the millionths (number$6) There are larger and smaller place values, but these ones are used the most. It doesn’t matter how large the number of digits is, they can be read and understood with ease. Test the knowledge with worksheets. ### Addition and subtraction Addition of decimal numbers is pretty much the same as the one with the whole numbers, only with a decimal point. Example: Solve: Write one beneath the other, in a way that the decimal points align. This is the most important step this is how you know which parts you’re adding. As in any other addition you start from the left, and if you gain more than ten you simply transfer one to the other side. The same goes for the subtraction. Multiplication First step in multiplication of two decimal numbers is to multiply each one of them with10$,$100$,$1000$and so on to get whole numbers. For our example that would be$ 256 cdot 15$And this is something we know$2568 cdot 150 = 3840$The last step is to put the decimal point in place. Where would that be? This depends on the number of elements in mantissas of numbers you’re multiplying their sum will be the number of elements in mantissa in their product.$ 2.56$– number of elements in mantissa is$21.5$– number of elements in mantissa is$12.56 cdot 1.5$– numbers of elements in mantissa is$3$. This means that in the number$3870$we have to put the decimal point in the third place from the right. This leads us to our final solution:$ 2.56 cdot 1.5 = 3.84$(the last zero can be disregarded) Second way to do the multiplication: You multiply as you always multiplied, but just when you finish take down the decimal point: ### Division Division of two decimal numbers is similar to division of two whole numbers but there are few changes. The quotient won’t change if you multiply each number with the same number. This means that you can transform your decimal numbers into whole numbers, and with them you already know how to calculate. Example 1: First you multiply it with$10$,$100$,$1000$to get both numbers whole. In this example we’ll multiply both numbers with number$1000$:$ 2.514 : 1.257 2514 : 1257 = 2$and this is your solution. How about when you have two whole numbers, but divisor is greater than dividend? As you already know, one does not contain any two’s. this means that our decimal number will be something in a form of .*$

This is the point where you put a decimal place behind that zero, and then you simply add zeros to the left side and continue your division. We can do that because we know that every whole number can be written as a unit and infinitely many zeros behind the decimal point, which means that our one becomes $1.0000$ as many zeros we need.

$1 : 2 = 0.5$ (now one zero comes down)

Let’s explain decimals in an example.

You’re eating in a restaurant and order a pie. Now you have one whole pie.

How many pies do you have if you eat one half?

As you know you have one half, or $frac<1><2>$ pie, now you have to transform it into a decimal. Since we learned that this should be easy.

And if you buy another pie, how many pies in decimals do you have?

Now you have $1 + 0.5 = 1.5$ pies.

Let’s remember how we could write any whole number using decomposition in thousands, hundreds, tens and ones.

For example number $2 554$ can be written as:

Which means that number $2 554$ contains two thousands, $5$ hundreds, $5$ tens and $4$ ones.

What if we try to do that with decimals?

For example, number 3.14 can be represented as $3 cdot 1 + frac<1> <10>+ frac<4><100>$

Considering this, we can manipulate decimal numbers in any way we want.

Number $3.14$ can also be written as:

Any decimal number can be written as a fraction whose numerator and denominator are whole numbers. The easiest way to remember this is: as many decimal places does your number have, that’s how many zeros in a denominator you’ll have:

### Comparing decimals

One decimal is greater than the other if one has greater value.

How would you know which one is greater?

You simply go by the decimals and the first different digit will tell you. If that digit is greater than the other one, than that whole number is greater.

Example: Compare two numbers.

You go digit one by one and see that first five digits are the same. But sixth digit in number $A$ is greater than the sixth digit in number $B$. that means that

$C = 2.12345678954545$
$D = 1. 12345678954545$

Here we have no problem, because the numbers differ in the first digit which means that $C > D$

On first look you might thing these two numbers are the same, but be careful about the position of the decimal point. $E > F$.

### Decimals on the number line

Decimal numbers are, just like whole numbers, divided on the positive ones, and negative ones.

Positive decimal numbers are found on the right side of the point of origin, and negative ones on the left.

Between any two numbers on the number line lies infinitely many decimal numbers.

The safest way to be precise about placing a decimal number on the number line is to convert it into a fraction.

Place number .25$on the number line. As we already learned we can transform this number into a fraction: And we can shorten this fraction into$frac<1><4>$. This means that this point is$frac<1><4>$away from the point of origin to the right. First we’ll divide our segment from 0 to 1 into four parts and take the first dot. Place number$1.2$on the number line. We’ll again transform it into a fraction:$ 1.2 = frac<12> <10>= frac<6> <5>= frac<11><5>$This means that our number is located between 1 and 2,$frac<1><5>$away from$1$. Place number$- 2.45$on a number line. For numbers with many decimals or decimal number that are not obvious, like fractions$frac<1><2>$,$frac<1><4>$and so on, you can use approximated place. For example, this number is very close to$-2,5$or a fraction$ -2 frac<1><2>$so we’ll draw it close to it, but slightly to the right, because number$ -2.45 > -2.5\$.

## Where to Go From Here?

You can download the final playground using the Download Materials button at the top or bottom of this tutorial. To improve your Swift skills, you will find some mini-exercises to complete. If you are stuck or you need some help, feel free to take advantage of companion solutions.

In this tutorial, you’ve learned that types are a fundamental part of programming. They’re what allow you to correctly store your data. You’ve seen a few more here, including strings and tuples, as well as a bunch of numeric types.

In the next part, you’ll learn about Boolean logic and simple control flow. Head on to Part 3: Flow Control to carry on with this series.

If have any questions or comments, please tell us in the discussion below!