comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Float conversion
Date: Fri, 30 Jul 2010 10:43:20 +0200
Date: 2010-07-30T10:43:20+02:00	[thread overview]
Message-ID: <1naf3ekl5k916$.f7ugc92galdz$.dlg@40tude.net> (raw)
In-Reply-To: 1d617940-d138-4b8c-a321-ed23b47431b8@x21g2000yqa.googlegroups.com

On Thu, 29 Jul 2010 18:30:06 -0700 (PDT), Phil Clayton wrote:

> On Jul 29, 8:15�pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
>> You should never use equality or inequality for floating-point types.
> 
> Inequalities (<, <=, >, >=) are ok - I think you meant don't use 'not
> equals' (which is still an equality operator).

Yes I did, thanks for correction.

> However, just because equality between floating point numbers is a
> dubious concept and should be avoided, it does not mean e.g. "<" and
> "<=" are simply interchangeable.  Far from it.

They are almost same. According to the extension principle:

I1<=I2

  T (true) if forall x in I1, forall y in I2  x<=y
  F (false) if forall x in I1, forall y in I2  not x<=y
  _|_ (undefined) otherwise

I1<I2

  T if forall x in I1, forall y in I2  x<y
  F if forall x in I1, forall y in I2  not x<y
  _|_ otherwise

The difference comes from _|_ being rendered T for "<=" and F for "<" when
I1 and I2 are equal as sets. It would be ill-advised to exploit this
difference without care.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2010-07-30  8:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 12:23 Float conversion Henrique
2010-07-29 12:44 ` Jacob Sparre Andersen
2010-07-29 12:46 ` Dmitry A. Kazakov
2010-07-29 15:08   ` Georg Bauhaus
2010-07-29 15:10     ` Georg Bauhaus
2010-07-29 15:35     ` Dmitry A. Kazakov
2010-07-29 18:21       ` Henrique
2010-07-29 19:08         ` Jeffrey R. Carter
2010-07-29 19:15         ` Dmitry A. Kazakov
2010-07-30  1:30           ` Phil Clayton
2010-07-30  8:43             ` Dmitry A. Kazakov [this message]
2010-07-30 13:14               ` Phil Clayton
2010-07-30 14:34                 ` Dmitry A. Kazakov
2010-07-31 15:12                 ` Stephen Leake
2010-08-03  1:07                   ` Phil Clayton
2010-08-03  3:31                     ` Shark8
2010-08-03 10:38                     ` Georg Bauhaus
2010-08-04  7:27                       ` Stephen Leake
2010-08-04 16:15                         ` Georg Bauhaus
2010-08-04 16:32                       ` Phil Clayton
2010-08-04  7:26                     ` Stephen Leake
2010-08-04 12:52                       ` Robert A Duff
2010-08-04 14:32                         ` Dmitry A. Kazakov
2010-08-04 19:36                           ` Simon Wright
2010-08-04 19:46                             ` Dmitry A. Kazakov
2010-08-04 20:29                             ` Georg Bauhaus
2010-08-05 12:05                         ` Stephen Leake
2010-08-07  5:54                           ` Shark8
2010-08-07  8:56                             ` Georg Bauhaus
2010-08-07 13:49                               ` Shark8
2010-08-05 10:20                       ` Phil Clayton
2010-07-30 13:16           ` Henrique
2010-07-29 15:37   ` Warren
2010-07-29 14:56 ` Georg Bauhaus
2010-07-29 17:56   ` Jeffrey R. Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox