Name:

== equality test operator

Library name:

sollya_obj_t sollya_lib_cmp_equal(sollya_obj_t, sollya_obj_t)

Usage:

expr1 == expr2 : (any type, any type) -> boolean

Parameters:

Description:

Example 1:

   > "Hello" == "Hello";
   true
   > "Hello" == "Salut";
   false
   > "Hello" == 5;
   false
   > 5 + x == 5 + x;
   true

Example 2:

   > verbosity = 1!;
   > asin(1) * 2 == pi;
   true
   > cos(3)^2 == 1 - sin(3)^2;
   Warning: the tool is unable to decide an equality test by evaluation even though faithful evaluation of the terms has been possible. The terms will be considered to be equal.
   true
   > exp(5) == log(4);
   false

Example 3:

   > autosimplify=off;
   Automatic pure tree simplification has been deactivated.
   > exp(1+x) == exp(x+1);
   false
   > autosimplify=on;
   Automatic pure tree simplification has been activated.
   > exp(1+x) == exp(x+1);
   false
   > (1/3+x)^2 == x^2 + 1/9 + (5-3)*x/3;
   true
   > log(x)/log(10) == log10(x);
   false

Example 4:

   > prec = 12;
   The precision has been set to 12 bits.
   > verbosity = 1!;
   > 16384.1 == 16385.1;
   Warning: Rounding occurred when converting the constant "16384.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   Warning: Rounding occurred when converting the constant "16385.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   true
   > 16384 == 16384.25;
   false
   > 0.1 == 1/10;
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   false
   > 0.1 == round(1/10, prec, RN);
   Warning: Rounding occurred when converting the constant "0.1" to floating-point with 12 bits.
   If safe computation is needed, try to increase the precision.
   true

Example 5:

   > error == error;
   false
   > error != error;
   false
   > @NaN@ == @NaN@;
   false
   > @NaN@ != @NaN@;
   true
   > [@NaN@,@NaN@] == [@NaN@,@NaN@];
   false
   > [@NaN@,@NaN@] != [@NaN@,@NaN@];
   true
   > error == @NaN@;
   false
   > error != @NaN@;
   false
   > a = error;
   > match a with
     @NaN@ : ("a contains @NaN@")
     [@NaN@, @NaN@] : ("a contains [@NaN@, @NaN@]")
     default:("a contains something else");
   a contains something else
   > a = @NaN@;
   > match a with
     @NaN@ : ("a contains @NaN@")
     [@NaN@, @NaN@] : ("a contains [@NaN@, @NaN@]")
     default:("a contains something else");
   a contains @NaN@
   > a = [@NaN@, @NaN@];
   > match a with
     @NaN@ : ("a contains @NaN@")
     [@NaN@, @NaN@] : ("a contains [@NaN@, @NaN@]")
     default:("a contains something else");
   a contains [@NaN@, @NaN@]
See also: !=, >, >=, <=, <, in, !, &&, ||, error, prec, autosimplify
Go back to the list of commands