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-Thread: a07f3367d7,a34155c47adc46f2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!news.tornevall.net!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Looking For Simple Routine To Put Integer Into Float Date: Mon, 24 May 2010 16:05:41 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <570f8963-82ba-42b9-981f-0f92e59161b3@a2g2000prd.googlegroups.com> NNTP-Posting-Host: 197fd7371d120c3d58e2247073306876 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 21fc671bb696c305525a70eb6d498214 X-Complaints-To: abuse@tornevall.net User-Agent: Thunderbird 2.0.0.24 (X11/20100411) X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: <570f8963-82ba-42b9-981f-0f92e59161b3@a2g2000prd.googlegroups.com> X-Validate-Post: http://news.tornevall.net/validate.php?trace=21fc671bb696c305525a70eb6d498214 X-SpeedUI: 1738 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news2.google.com comp.lang.ada:11946 Date: 2010-05-24T16:05:41-07:00 List-Id: ChristopherL wrote: > > type Unknown_integer_type is range -(2**16) ..(2**16) -1; -- 32 Bit > Integer If you want an unconstrained, 32-bit, signed integer type, something from Interfaces (such as Integer_32) is usually the way to go. > An_Unknown_Integer: Unknown_integer_type; > An_Integer: Integer; > A_Float: Float; -- Hoping this float is usually 32 bits Why hope? If you need a 32-bit floating-point type, again something from Interfaces might be in order, or declare an appropriate type for your application: type Real is digits 6 [range Low .. High]; for Real'Size use 32; In any case, the size of Float should be documented for your compiler. > An_Integer := 1234; > > An_Unknown_Integer := An_Integer; This shouldn't compile, as An_Integer has a different type than An_Unknown_Integer; you need a type conversion. > A_Float := Float (An_Unknown_Integer); What is the point of Unknown_Integer_Type and An_Unknown_Integer? What's wrong with A_Float := Float (An_Integer); ? -- Jeff Carter "You can never forget too much about C++." 115