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,6a8952cbe009f3ed X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.98.102 with SMTP id eh6mr1740329wib.7.1360469031078; Sat, 09 Feb 2013 20:03:51 -0800 (PST) Path: g1ni1983wig.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.139.MISMATCH!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newspeer1.nac.net!news.astraweb.com!border2.newsrouter.astraweb.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!nrc-news.nrc.ca!goblin3!goblin.stu.neva.ru!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Numerical calculations: Why not use fixed point types for everything? Date: Mon, 04 Feb 2013 23:12:54 +0200 Organization: Tidorum Ltd Message-ID: References: <4905b963-0036-4129-8050-fb26ef0154d6@googlegroups.com> <32314026-23ae-45b8-a4c5-e589e7d79de2@googlegroups.com> <64e3c342-d042-40a2-8a16-b1f0cdff9f16@googlegroups.com> <91527f7c-0679-4c21-95c7-a07f3fff265d@googlegroups.com> <8cc51443-23f6-4736-a862-d0223998fc2e@googlegroups.com> <753a3719-e15f-4626-b3cc-ac76f7ef7499@googlegroups.com> <8ee504a6-b371-42ef-a91e-bbb70e3b81d8@googlegroups.com> <2665b0e1-0558-45ac-9a26-7eb7a1ecd689@googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net uGcKKxxMJxw50UK/NBY2igHdVpAbhWX6V2zKJLmJkSwAH/PKgbL8qKz4uv/7OQtmDJ Cancel-Lock: sha1:aPKtCGlZq37AaufSAeZvNwPCe+A= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2013-02-04T23:12:54+02:00 List-Id: On 13-02-04 18:44 , Jeffrey Carter wrote: > On 02/04/2013 07:24 AM, Niklas Holsti wrote: >> On 13-02-04 12:09 , Ada novice wrote: >>> >>> When assigning constants, I always use >>> >>> Number : constant := 100.0 >>> >>> and then lets the compiler decides how it wants to treat the constant >>> when say multiplying with a type such as integer, >> >> (You can't multiply 100.0 with an integer, unless you do a type >> conversion or define your own multiplication operator.) > > Sure you can. > > Twice : constant := 2 * Number; > Half : constant := Number / 2; > > are both legal (ARM 4.5.5). You are right, and I stand corrected: you can compute with mixtures of integral named numbers and real named numbers to provide values for new real named numbers, if I've understood that ARM point correctly. But I also forgot about another thing: you can compute I * Number, where I is an Integer variable, since Number can be considered to be universal_fixed, and fixed-point types can be multiplied by Integer. So what YC said about multiplication of integers and named real numbers is correct. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .