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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ac8:5205:: with SMTP id r5mr5428876qtn.230.1575384359274; Tue, 03 Dec 2019 06:45:59 -0800 (PST) X-Received: by 2002:a9d:155:: with SMTP id 79mr3191644otu.240.1575384358996; Tue, 03 Dec 2019 06:45:58 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no1476969qtd.0!news-out.google.com!o19ni58qtr.1!nntp.google.com!g89no1476963qtd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 3 Dec 2019 06:45:58 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <87muca3vgd.fsf@nightsong.com> <57d49047-0a61-4d13-8822-d004732a3acc@googlegroups.com> <3b1b248b-43d0-4762-b1f5-1c5460d24c8b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <8070add5-c13c-43c2-92a5-6c5b8cff64a2@googlegroups.com> Subject: Re: Beginning Ada Programming, by Andrew T. Shvets (2020) From: Shark8 Injection-Date: Tue, 03 Dec 2019 14:45:59 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57635 Date: 2019-12-03T06:45:58-08:00 List-Id: On Tuesday, December 3, 2019 at 7:39:23 AM UTC-7, Simon Wright wrote: > AdaMagica writes: > > > Define a type for values you can read from a foldable meter rod (0 to > > 2 m). > > > > type Length is digits 4 range 0.0 .. 2.000; -- Meter > > type Length is delta 0.001 range 0.0 .. 2.000; > > > > A meter rod allows one millimeter as maximal precision: > > Floating point or fixed point number. > > > > What's difficult to grasp here? > > I think what's difficult to grasp is the need for such a type. Nothing > wrong with > > float len; > > or, for the more enlightened, > > typedef float length; > ... > length len; > > :-) :-) On that note, I think we should propose "statistical types" -- the underlying bit pattern will be treated as floating- or fixed-point or BCD according to some statistical probability: There's a 40% chance you're using floating-point this run, a 40% chance it's fixed-point, and a 20% chance it's BCD! Good luck debugging! there's a