comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephe.Leake@nasa.gov>
Subject: Re: Ada 64-bit IEEE compliant float & Oracle
Date: 04 Aug 2003 15:49:12 -0400
Date: 2003-08-04T19:50:40+00:00	[thread overview]
Message-ID: <uispd430n.fsf@nasa.gov> (raw)
In-Reply-To: 3F2E94D5.610F50F4@raytheon.com

"James A. Krzyzanowski" <James_A_Krzyzanowski@raytheon.com> writes:

> Problem:
> 
> We are using Rational Ada and the IEEE compliant definition for 64-bit
> floating point numbers. We recently changed our DB to Oracle which uses
> a proprietary format for storing floating point numbers with greater
> precision than the average software system could possibly need.  Oracle
> uses 17 bytes to store floating point numbers; but I have read
> documentation that they use 126 bits (not 136) to store floating point
> numbers.

This all makes sense.

> We have declared new types based on the IEEE standard 64-bit float
> that have constrained ranges. For example, we have:
> 
> type Radian_Type is new Float_64_Bit range -2_Pi .. +2_Pi;
> subtype Latitude_Type is Radian_Type range -Pi_Over_2 .. +Pi_Over_2;
> subtype Longitude_Type is Radian_Type range -Pi .. +Pi;

I've tried this in the past; it always causes more problems than it's
worth.

What do you actually gain from this? If you ever get a
Constraint_Error, it's because of a bug in the software. So write unit
tests that check for outputs being in the proper range. Using these
subtypes means you are running those tests in the real application,
wasting CPU time and code ram.

> When we store Latitude_Type'Last in the DB and then retrieve it, we
> get a Constraint Error.

This is clearly a bug in the database and/or compiler. What do the
vendors say?


> Possible Solutions:

-1) report bug to Oracle and/or Rational (IBM?).

(who says solution numbers start at 1 :)

0) Eliminate constrained types, check for constraints in unit tests only.

-- 
-- Stephe



  reply	other threads:[~2003-08-04 19:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-04 17:16 Ada 64-bit IEEE compliant float & Oracle James A. Krzyzanowski
2003-08-04 19:49 ` Stephen Leake [this message]
2003-08-04 23:32 ` Robert I. Eachus
replies disabled

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