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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9bb56e94a4c5bb5e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news2.google.com!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: How unchecked conversion works? Date: 14 Jan 2005 17:49:01 -0500 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1105742965 47323 212.85.156.195 (14 Jan 2005 22:49:25 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Fri, 14 Jan 2005 22:49:25 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:7785 Date: 2005-01-14T17:49:01-05:00 None writes: > well, I try to explain. I have those types for example > > type fixed is delta 0.03 range -90.0..90.0 > for fixed'size use 16 > > and > > type inte is range -32768..32767 > for inte'size use 16 > > > and a new function that renames unchecked_conversion to come from > fixed to inte (probably an inefficient way, but I have to do this > way), so I'd like to predict on paper which value of inte type > corresponds to 89.09 for example: what kind of calculus should I do? > This depends on something else? Thanks again! If you are trying to control the exact representation of the fixed point type, you need to specify the 'Small for the type: for fixed'small use 0.03; Then the least significant bit of 'fixed' represents a value of 0.03; 89.09 / 0.03 is 2970, so that is the result of the unchecked conversion you are discussing. This is explained in sections 3.5.9 and 3.5.10 of the Ada Reference Manual, but it is somewhat obscure. -- -- Stephe