From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d853e66024dcd092 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-08-04 12:49:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!tethys.csu.net!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ada 64-bit IEEE compliant float & Oracle Date: 04 Aug 2003 15:49:12 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <3F2E94D5.610F50F4@raytheon.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1060026640 27420 128.183.235.92 (4 Aug 2003 19:50:40 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 4 Aug 2003 19:50:40 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.ada:41177 Date: 2003-08-04T19:50:40+00:00 List-Id: "James A. Krzyzanowski" 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