Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Proposal for I/O in P1788 (M0017)



Michel

On 17 May 2010, at 18:24, Michel Hack wrote:
> (1)  I found the C examples quite useful for the purpose of explaining
>     what is going on, but I briefly cringed when I saw an example
>     where both bounds were handled in a single fprintf() invocation.
> 
>     Then I realised that the format was "%s %s" -- no actual conversion.
Thanks. Maybe I should emphasise that. I also thought of pointing out that the language could provide ways to output the interval's bounds with user-specified width w, e.g. if w=12, the language's output routine could use the format "%12s %12s".

> I wonder if it would be appropriate to include a warning that the usual
> C printf() and scanf()/strtod() functions don't include rounding control.
Well, in the proposed scheme that's the responsibility of convertToTextInterval(); whoever implements it will be a library writer, savvy enough to know this.

> (2) The notion of "recovery conversion".
I like the term. So you would like functions called, say,
   formatOf-recoveryConvertTextInterval(xx) 
included in the proposal?

> The reasoning above suggests that we should simply define inward-rounding
> conversions, and describe their purpose, leaving the verification of
> applicability to the programmer.
That's what I had in mind. I see it as a suitable form for archival purposes. It might be used by someone who wants to store intervals "exactly" on an external medium, and has a suspicious nature. So prefers a readable decimal format, to either the hexadecimal-significand text form of 3.4.3, or the unreadable (binary) interchange format.

John