From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Parameterised 'Image Attributes Date: Fri, 25 Aug 2023 09:26:07 +0200 Organization: A noiseless patient Spider Message-ID: References: <4c861cba-9ad6-429d-b530-a40c45dfc176n@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 25 Aug 2023 07:26:03 -0000 (UTC) Injection-Info: dont-email.me; posting-host="38d7616789a656b231dda5c462d4acb3"; logging-data="4129582"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rB1oOp9CzuT4SIOA2j1rocKOXHiBhu2M=" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Cancel-Lock: sha1:4YqVOnKWokgkqmpUNKUHAonjlaU= Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65560 List-Id: On 2023-08-24 21:59, Stephen Davies wrote: > On Wednesday, 23 August 2023 at 17:16:12 UTC+1, Dmitry A. Kazakov wrote: >> On 2023-08-23 12:20, Stephen Davies wrote: >> >>> Actually, I think it might also be nice if Float'Trim_Image(X) returned >>> a string that only used exponential notation for very large or very >>> small values (which seems to be the default behaviour in Python). >> To use the shortest representation for the given precision unless >> specified otherwise: >> >> http://www.dmitry-kazakov.de/ada/strings_edit.htm#6 >> >> Ada 'Image attributes have "typographic quality" in plain contradiction >> to the claim being for debugging purpose. That is why the plus sign is >> always represented by a space and why floating-point representation is >> always selected even for exact zero and the way the exponent part is >> formatted. The typographic idea is to have *same looking* output. Note, >> even if the output is mathematically incorrect as in the case of >> floating-point numbers. 'Image considers precision and accuracy same, >> which is *always* wrong when dealing with floating-point numbers. >>> Different names would then be needed (Tidy_Image and Tidy_Width?). >> It takes several parameters to control the behavior in a reasonable way. >> -- > How about an attribute called something like User_Image > where programmers should make no assumption about the > generated strings and implementations can provide > OS-specific ways to customise things like leading > space/plus/neither, decimal separator character, digit > grouping character/spacing, exponential notation, enum > casing, etc. How anything can be implemented without making assumptions = specifications? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de