Deutsch English Français Italiano |
<vrmg7d$2nif7$2@paganini.bofh.team> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!newsfeed.bofh.team!paganini.bofh.team!not-for-mail From: antispam@fricas.org (Waldek Hebisch) Newsgroups: comp.lang.c Subject: Re: Suggested method for returning a string from a C program? Date: Sat, 22 Mar 2025 14:07:43 -0000 (UTC) Organization: To protect and to server Message-ID: <vrmg7d$2nif7$2@paganini.bofh.team> References: <vrd77d$3nvtf$2@dont-email.me> <868qp1ra5f.fsf@linuxsc.com> <vrdhok$47cb$2@dont-email.me> <20250319115550.0000676f@yahoo.com> <vreuj1$1asii$4@dont-email.me> <vreve4$19klp$2@dont-email.me> <20250319201903.00005452@yahoo.com> <86r02roqdq.fsf@linuxsc.com> <vrh1br$35029$2@dont-email.me> <LRUCP.2$541.0@fx47.iad> <vrh71t$3be42$1@dont-email.me> <vrk8vm$2f4gc$1@paganini.bofh.team> <20250321113316.506@kylheku.com> <vrl6hp$2qg20$1@dont-email.me> <20250321210228.508@kylheku.com> Injection-Date: Sat, 22 Mar 2025 14:07:43 -0000 (UTC) Injection-Info: paganini.bofh.team; logging-data="2869735"; posting-host="WwiNTD3IIceGeoS5hCc4+A.user.paganini.bofh.team"; mail-complaints-to="usenet@bofh.team"; posting-account="9dIQLXBM7WM9KzA+yjdR4A"; User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.9.3 Bytes: 2800 Lines: 35 Kaz Kylheku <643-408-1753@kylheku.com> wrote: > On 2025-03-22, bart <bc@freeuk.com> wrote: > >> The point is that there was usually a size exactly double the width of >> 'int', but it become less necessary when 'int' reached 64 bits. > > Yes, because other than for masks of 128 bits, there isn't a whole > lot of stuff you can *count* for which you need such large integers. > > Money? > > In an accounting system, if you use signed 64 bits for pennies, you can > go to 9.2 x 10^16 dollars. Actually, to do fast division of N-bit number by fixed N-bit number one need 2N-bit multiplication. Such divisions appear in base convertions (to decimal) and when doing "decimal" rounding. Also, converting between currencies needs extra accuracy. So _fast_ financial arithmetic may need rather large number of digits, current tendecy is to allow up to 37 digits in intermediate quantities. Note that 64-bit _result_ type means that 32-bit integers are largest that can be multiplied exactly, that is very limiting. > Large integers are needed for crypto and such, but then 128 isn't enough > anyway. Double word arthmetic is crucial if you want efficient high-level implementation of multiple precision arithmetic. So, 64-bit is enough on 32-bit machines, 128-bit is needed on 64-bit machines and hypotetical 128-bit machines would need 256-bit integer type as a building block for efficient multiple precision arithmetic. -- Waldek Hebisch