IMind soft

Author's software

Development

Design

Designing

Being tested

Precise comparing of numbers

Writing functions:

equal(a, b [,digit])

Compares the two numbers (a and b) and outputs the result. You can specify an optional digit parameter, which sets the comparison accuracy, namely, how many digits after the decimal point into account when comparing, if there are more number of digits after the decimal point, they are not counted.

Gives the following results

Function result Result words Example
0 Less a<b
1 Equally a==b
2 More a>b

If the variables can not be compared (for example, one of them is a string or an object) the function equal outputs an empty value, which you can check the function isset

 

 

Top.Mail.Ru