How to take number on the module

How to take number on the module

Articles Hits: 102

The absolute value of number - the module - shows as far as this number differs from zero. It is possible to take on the module any sizes - from infinity in a negative part of a scale, indefinitely in positive, but the result of this operation will be always positive if the reference value differs from zero. Definition of the module of number - very simple task, and can raise questions only its realization in some concrete way.

Instruction

1. If it is required "in mind" to define the module of a real number, just reject its negative sign if such is. For example, the module of number-257 is equal 257, and module 747 is equal to the most this number. These two examples so register: |-257| = 257 and |747| = 747.

2. If necessary to take the number module in the calculator negative size multiply one by minus, and positive leave without changes. If you use the program Windows calculator in its "engineering" interface, it is possible to do without multiplication - use the sign change button. It is placed in the second row of the column of buttons second on the right and marked with a symbol ±.

3. To use the number module in formulas of the tabular editor of Microsoft Office of Excel use its built-in ABS function. For example, if just it is required to display in B3 cell the value module from A1 cell without some other changes, contents of B3 have to look so: =ABS(A1).

4. Programmatically it is possible to realize calculation of the module with use of the conditional operator of branching if/then - this design exists practically in any programming language. For example, that the value which is contained in a variable with the name of $someNum to replace it with the module in the PHP language the code of a line has to look so: if ($someNum Pascal the same operation can be written down so: if (someNum

It is very simple and often used mathematical operation therefore in all programming languages there is a built-in function which allows to do without conditional operator. As well as in Excel, in the majority of program languages of this function the name abs is appropriated, but there are also exceptions - in Si it is called fabs. The syntax has more distinctions and submits to rules of concrete language. For example, the example described above in the PHP language can be replaced with such application of function: $someNum = abs ($someNum);

5. It is very simple and often used mathematical operation therefore in all programming languages there is a built-in function which allows to do without conditional operator. As well as in Excel, in the majority of program languages of this function the name abs is appropriated, but there are also exceptions - in Si it is called fabs. The syntax has more distinctions and submits to rules of concrete language. For example, the example described above in the PHP language can be replaced with such application of function: $someNum = abs ($someNum);

Author: «MirrorInfo» Dream Team

Print