comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: How to convert a string containing two hex digits to a character?
Date: Mon, 11 Jan 2010 19:13:01 +0100
Date: 2010-01-11T19:13:00+01:00	[thread overview]
Message-ID: <g1ifcaxcm093.dojf9ui2deak.dlg@40tude.net> (raw)
In-Reply-To: 1eb0d4a1-8ad0-442a-b9aa-2b41a3f3a8db@d20g2000yqh.googlegroups.com

On Mon, 11 Jan 2010 07:53:14 -0800 (PST), Adam Beneschan wrote:

> On Jan 9, 8:04�am, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
> wrote:
> 
>>> There are no Pred and Succ on reals, complexes and the likes,
>>
>> BTW, there is Float'Succ! I tempted to say due to a language design flaw,
>> because it exposes the nature of Float as a model.
> 
> I don't see this is a flaw.  It's a reminder that a Float, on any
> computer, in any language, is actually limited to a subset of rational
> numbers,

Technically no:

1. the radix can be irrational = you can have a finite set or irrational
numbers

2. infinite sets of rational numbers still have no Succ

But I know what you meant. Yes any set of model numbers is finite. BUT that
alone is not enough to have Succ well-defined. Consider the model x=P/Q,
where P and Q are bignums. In this model of real numbers there is no
meaningful Succ.

> which means you need to exercise some caution when using
> them.  Programmers who think "Float" can represent any real number,
> and that arithmetic on them is just like doing arithmetic on real
> numbers, are going to get into trouble, so it doesn't seem like a good
> thing to hide "the nature of Float as a model".

But also using operations specific to the given implementation (model) make
the program fragile. I think that Succ is OK for fixed-point numbers, but
less sure in the case of floating-point ones.

> Anyway, Float'Succ was not present in Ada 83 but was added in Ada 95,
> so someone must have thought it was useful for some practical purpose.

They also added 'Adjacent, which could serve same purpose. However upper
and lower pairs +,-,*,/ would be more useful. (Upper + is greater or equal
to the exact +).

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



  reply	other threads:[~2010-01-11 18:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06  0:39 How to convert a string containing two hex digits to a character? Leslie
2010-01-06  0:43 ` Leslie
2010-01-06  1:22   ` Hibou57 (Yannick Duchêne)
2010-01-06  1:31     ` Hibou57 (Yannick Duchêne)
2010-01-06  2:05       ` Leslie
2010-01-06  2:39     ` Leslie
2010-01-06  2:42       ` Leslie
2010-01-06 21:54     ` Maciej Sobczak
2010-01-06 22:19       ` Hibou57 (Yannick Duchêne)
2010-01-09 10:50         ` Hibou57 (Yannick Duchêne)
2010-01-09 11:13           ` Hibou57 (Yannick Duchêne)
2010-01-09 11:33             ` Dmitry A. Kazakov
2010-01-09 14:50               ` Hibou57 (Yannick Duchêne)
2010-01-09 16:04                 ` Dmitry A. Kazakov
2010-01-11 15:53                   ` Adam Beneschan
2010-01-11 18:13                     ` Dmitry A. Kazakov [this message]
2010-01-15 19:59                     ` Hibou57 (Yannick Duchêne)
2010-01-15 22:06                       ` John B. Matthews
2010-01-06  5:17 ` tmoran
2010-01-06 22:19   ` Leslie
2010-01-06 22:22   ` Hibou57 (Yannick Duchêne)
2010-01-07 14:26 ` John B. Matthews
replies disabled

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