Deutsch English Français Italiano |
<87o7aiffbv.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson <Keith.S.Thompson+u@gmail.com> Newsgroups: comp.lang.c Subject: Re: Recursion, Yo Date: Tue, 09 Apr 2024 13:31:32 -0700 Organization: None to speak of Lines: 30 Message-ID: <87o7aiffbv.fsf@nosuchdomain.example.com> References: <uut24f$2icpb$1@dont-email.me> <uutqd2$bhl0$1@i2pn2.org> <uv2u2a$41j5$1@dont-email.me> <uv2v2o$42fo$3@dont-email.me> <uv3c77$7eb5$1@dont-email.me> <871q7esjbc.fsf@bsb.me.uk> <uv46eu$e0ps$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Tue, 09 Apr 2024 20:31:32 +0200 (CEST) Injection-Info: dont-email.me; posting-host="41710cd94b54dc6d2c462f463b62aa07"; logging-data="474487"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/sRARer5+N8bqCOK71PrRj" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:jPNbKdAQsX1qfjOzPuOs1ZAfq3U= sha1:TNl6Xmq+TkFNXn/SnpLwa1mpXnA= Bytes: 2350 Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: > On 09.04.2024 16:27, Ben Bacarisse wrote: >> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes: >>> >>> func ___(_) { return __(_,x^x,x^x^x) } >>> func __(_,_x,x_) { return --_?__(_,x_,_x+x_):_x+x_ } >> >> The trouble with AWK (without gawk's -M) is that functions like this >> just start to give a wrong, but plausibly sized, result. For example >> ___(80) is 23416728348467684 when it should be 23416728348467685. > > A general issue with functions and arithmetic producing "too large" > numbers with languages and systems that don't support them. Yes. > > I'd prefer at least an error indication, though, and not a silent > overflow. If I understand correctly, it's not overflow, it's quiet loss of precision. awk doesn't normally distinguish between integer and floating-point numbers, and uses FP to represent integers. A computation that should yield 23416728348467685 doesn't overflow, but it quietly yields 23416728348467684. (`gawk -M` supports arbitrary precision integer arithmetic.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Medtronic void Void(void) { Void(); } /* The recursive call of the void */