Hello and welcome to the Golang programming language course.
In the previous session, we talked about integer numbers and indecision.
We want to talk about the other data types concept.
Floating point numbers, a floating point number or a float is used to represent real numbers that cannot
be expressed as integers, real numbers include all rational and irrational numbers, and because of
these floating point numbers can contain a fractional part such as seven point five or minus 100 in
twenty three point forty five.
For the purposes of thinking of a float in the go curriculum, it is a number that contains a decimal
point and go language.
Floating point numbers are divided into two categories.
As shown in the below diagram, fellow Terry to thirty two bits or four bytes and floats 64 64 bits
or eight points.
Now let's go to this school to illustrate how to use a floating point numbers like we did with integers.
We convert by floating point numbers in a simple way.
First defined two variables by shorthand declaration.
A column equals and initialize it by a floating point value, for example, thirty five point seventy
eight, and define another variable like B column equals, for example, forty six point twenty six.
Now you want to subtract these variables together.
So first, define another variable like see column equals B minus A
and now display the result value and type of C variable so that if a initialize person if because type
of variable A and B is below, so be used from person if asked, formatted string back is less and and
said, Hey, go to the next line.
F f b initialize % f backslash end and set b.
And if we want to display the result of B minus A, so we right % f for this pretty variable B minus
person, f for disability valuable a equals person, f for variable C because the values are valid,
but it's a and b are decimal.
The subtraction of two variables and b from each other will also be a decimal value.
So if you use five percent if as icing format for the C variable.
And we said B comma, a comma, c now go to the next line and display type of C value that saw B write
f f tie or C column person T uppercase and said C value of it.
Put it back in here and reformat the call, save the project and execute the program.
So go to terminal and execute the program by the comment.
Go round the backslash mean that goal.
Now we can see the output eight equals thirty five point seventy eight and B equals forty six point
twenty six and B minus eight means forty six point twenty six, minus three.
Five point seventy eight equals to ten point forty eight.
And type of C is float sixty four.
OK.
In this edition, we could define floating point variables, initialize them and display in order not
to prolong the time of decision.
We will finish it and we'll continue the content in the next session.
Goodbye.