## D - floating point expressions

- bono u2.art Aug 19 2003
- "Walter" <walter digitalmars.com> Aug 23 2003

The simbols used for operator dealing with nan in floating point expression are dificult to learn and remember and is easy to confuse. Programer must use the reverse logic to find the meaning of the operator. But with a direct logic this problems, IMHO, could be simpler. The main idea is add the char '?' when dealing with nans Current table of Operators: Operator Greater Less Than Equal Unordered Exception Relation --------------------------------------------------------------------------------------------------- == F F T F no equal != T T F T no unordered, less, or greaterT F F F yes greater = T F T F yes greater or equal

<= F T T F yes less or equal !<>= F F F T no unordered <> T T F F yes less or greater <>= T T T F yes less, equal, or greater !<= T F F T no unordered or greater !< T F T T no unordered, greater, or equal !>= F T F T no unordered or less !> F T T T no unordered, less, or equal !<> F F T T no unordered or equal The simbols to change: New Current Relation ----------------------------------------------------- ?= !<>= unordered? !<= unordered or greater =? !< unordered, greater, or equal

<=? !> unordered, less, or equal ==? !<> unordered or equal The new table of Operators: Operator Greater Less Than Equal Unordered Exception Relation --------------------------------------------------------------------------------------------------- == F F T F no equal != T T F T no unordered, less, or greaterT F F F yes greater = T F T F yes greater or equal

<= F T T F yes less or equal <> T T F F yes less or greater <>= T T T F yes less, equal, or greater ?= F F F T no unordered ==? F F T T no equal or unordered? T F F T no greater or unordered =? T F T T no greater, equal, or unordered

<=? F T T T no less, equal, or unordered The are motivation for this change are: a) The same operator as integer expressions are used for normal comparison (call this basic operators): == != > >= < <= b) When the operator contains < or > and one of the one of the operands is a NAN then a exception is raised. c) To deal with NAN you add the '?' after the normal operator d) There are two more operators: <> and <>= This rule is simpler, IMHO. Comments ?

Aug 19 2003

I know they're a bit complicated. They do match, however, the NCEG proposed extensions to C (which were never adopted). Your idea has merit, I need to think about it. <bono u2.art> wrote in message news:bhtfsr$1sgt$1 digitaldaemon.com...The simbols used for operator dealing with nan in floating point

dificult to learn and remember and is easy to confuse. Programer must use the reverse logic to find the meaning of the operator. But with a direct logic this problems, IMHO, could be simpler. The main idea is add the char '?' when dealing with nans Current table of Operators: Operator Greater Less Than Equal Unordered Exception Relation --------------------------------------------------------------------------

== F F T F no equal != T T F T no unordered, less, or greaterT F F F yes greater = T F T F yes greater or equal

<= F T T F yes less or equal !<>= F F F T no unordered <> T T F F yes less or greater <>= T T T F yes less, equal, or greater !<= T F F T no unordered or greater !< T F T T no unordered, greater, or equal !>= F T F T no unordered or less !> F T T T no unordered, less, or equal !<> F F T T no unordered or equal The simbols to change: New Current Relation ----------------------------------------------------- ?= !<>= unordered? !<= unordered or greater =? !< unordered, greater, or equal

<=? !> unordered, less, or equal ==? !<> unordered or equal The new table of Operators: Operator Greater Less Than Equal Unordered Exception Relation --------------------------------------------------------------------------

== F F T F no equal != T T F T no unordered, less, or greaterT F F F yes greater = T F T F yes greater or equal

<= F T T F yes less or equal <> T T F F yes less or greater <>= T T T F yes less, equal, or greater ?= F F F T no unordered ==? F F T T no equal or unordered? T F F T no greater or unordered =? T F T T no greater, equal, or unordered

<=? F T T T no less, equal, or unordered The are motivation for this change are: a) The same operator as integer expressions are used for normal comparison

this basic operators): == != > >= < <= b) When the operator contains < or > and one of the one of the operands is

then a exception is raised. c) To deal with NAN you add the '?' after the normal operator d) There are two more operators: <> and <>= This rule is simpler, IMHO. Comments ?

Aug 23 2003