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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c0fe3a04fa2416f1 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Ada function sqrt(x) Date: 1996/09/22 Message-ID: #1/1 X-Deja-AN: 184693454 references: <01bba50c$7c1a2760$dc014dc6@MountainNet> <51o7nh$5vl@cf01> content-type: text/plain; charset=ISO-8859-1 organization: Estormza Software mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-09-22T00:00:00+00:00 List-Id: Oops! Of course I meant: generic type T is range <>; function Generic_Square_Root (N : T) return T'Base; function Generic_Square_Root (N: T) return T'Base is The_Square_Root : T'Base := N/2; begin loop declare The_New_Value : constant T'Base := (The_Square_Root + N / The_Square_Root) / 2; begin exit when The_New_Value = The_Square_Root; The_Square_Root := The_New_Value; -- This statement is important! end; end loop; return The_Square_Root; end Generic_Square_Root; matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant mheaney@ni.net (818) 985-1271