manual:chapter3:reals

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
manual:chapter3:reals [2019/11/05 16:32]
jojo1973 Added more commands
manual:chapter3:reals [2019/11/06 15:21] (current)
jojo1973 Added Special symbols
Line 124: Line 124:
 ==== Testing ==== ==== Testing ====
  
-Real numbers form an ordered set and its elements can be compared: **newRPL** provides a full set of arithmetic and logic operators plus some specialized ones.+Real numbers form an ordered field and its elements can be compared: **newRPL** provides a full set of arithmetic and logic operators plus some specialized ones.
  
 All these operators (except ''[[manual:chapter6:operators:cmd_ovr_cmp|CMP]]'') return ''1'' __if the test is true__ and ''0'' __if the test is false__. Actually any value different from ''0'' is considered __true__, but conventionally the operators return always ''1'' when the test succeeds. All these operators (except ''[[manual:chapter6:operators:cmd_ovr_cmp|CMP]]'') return ''1'' __if the test is true__ and ''0'' __if the test is false__. Actually any value different from ''0'' is considered __true__, but conventionally the operators return always ''1'' when the test succeeds.
Line 194: Line 194:
 ---- ----
      
-==== Special numbers ====+==== Special symbols ====
  
-Operation on real numbers aren't always defined on the whole field of real numbers.+Operations on real numbers aren't always defined on the whole field of real numbers: a notable example is the division, which is not defined if the divisor is ''0''. **newRPL** handles these occurrances defining two special symbols: ''∞'' (//infinity//) and ''NaN'' (//Not-a-Number//). 
 + 
 +The ''∞'' symbol is returned when attempting, as anticipated, a division by ''0'' or when the result of a function (e.g. ''[[manual:chapter6:transcendentals:cmd_tan|TAN]]'') diverges. Albeit ''∞'' must not be considered a number, it obeys to a number of rules. The following examples assume flag [[manual:appendix:flags#flag-103|-103]] is cleared. 
 + 
 +  * ''∞'' ''[[manual:chapter6:operators:cmd_ovr_add|+]]'' or ''[[manual:chapter6:operators:cmd_ovr_sub|-]]'' a finite number yields ''∞''; 
 +  * ''∞'' ''[[manual:chapter6:operators:cmd_ovr_mul|*]]'' or ''[[manual:chapter6:operators:cmd_ovr_div|/]]'' a finite number yields ''∞''; 
 +  * the sign rule in multiplication or division applies, therefore ''-∞'' is a valid object; 
 +  * sum, multiplication or power of ''∞'' with itself yields ''∞''
 +   
 +The ''NaN'' symbol is **newRPL** way of informing the user that the attempted calculation returns an //undefined// result: typical examples include the calculation of the difference ''∞ - ∞'' or the sine of ''∞''. In general any function that includes ''NaN'' among its arguments will yield ''NaN''.
  • manual/chapter3/reals.txt
  • Last modified: 2019/11/06 15:21
  • by jojo1973