digitalmars.D.bugs - printf does not support type real
- Sean Kelly (3/3) Jul 16 2004 The subject says it all. I have to cast to a double to print values of ...
- Cabal (6/11) Jul 16 2004 I could be wrong but I believe the printf used in D is the original C
- Stewart Gordon (9/16) Jul 16 2004 Or even use writef now we have it.
- Jarrett Billingsley (3/3) Jul 16 2004 "It doesn't supply a code sample."
- John Reimer (3/7) Jul 16 2004 Why even bring this up? Haven't you noticed by now that everybody has
- Jarrett Billingsley (1/3) Jul 17 2004 some more than others ;)
- Sean Kelly (9/15) Jul 16 2004 Oops. I had thought that printf now silently called writef behind the s...
- Walter (4/6) Jul 16 2004 Use %Lf for real's. printf is a C function, and D reals correspond to C ...
- J C Calvarese (13/18) Jul 17 2004 This page might be helpful to you:
The subject says it all. I have to cast to a double to print values of this type. Sean
Jul 16 2004
I could be wrong but I believe the printf used in D is the original C function which only supports doubles in its original form. I seem to remember seeing the use of a %lf format specifier on one platform or another to indicate a long double (D real). You might try that to see if it works - your mileage may vary, I don't believe it is a standard. Sean Kelly wrote:The subject says it all. I have to cast to a double to print values of this type. Sean
Jul 16 2004
Cabal wrote:I could be wrong but I believe the printf used in D is the original C function which only supports doubles in its original form. I seem to remember seeing the use of a %lf format specifier on one platform or another to indicate a long double (D real).FWIS, it's %Lf (uppercase L).You might try that to see if it works - your mileage may vary, I don't believe it is a standard.Or even use writef now we have it.No it doesn't. It doesn't supply a code sample. Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.The subject says it all.
Jul 16 2004
"It doesn't supply a code sample." semantics, semantics :P if you can't figure out the problem from the title, you've got issues.
Jul 16 2004
Jarrett Billingsley wrote:"It doesn't supply a code sample." semantics, semantics :P if you can't figure out the problem from the title, you've got issues.Why even bring this up? Haven't you noticed by now that everybody has issues? ;-)
Jul 16 2004
Haven't you noticed by now that everybody has issues? ;-)some more than others ;)
Jul 17 2004
In article <cd936h$e9e$1 digitaldaemon.com>, Stewart Gordon says...Cabal wrote:Oops. I had thought that printf now silently called writef behind the scenes. My mistake.You might try that to see if it works - your mileage may vary, I don't believe it is a standard.Or even use writef now we have it.In this case one shouldn't be necessary, but just to be pedantic: real x = 1.0; printf( "%f", x ); // prints garbage ie. I had thought that printf had been re-implemented by Walter and no longer required the size modifiers. SeanNo it doesn't. It doesn't supply a code sample.The subject says it all.
Jul 16 2004
"Sean Kelly" <sean f4.ca> wrote in message news:cd973f$fvg$1 digitaldaemon.com...real x = 1.0; printf( "%f", x ); // prints garbageUse %Lf for real's. printf is a C function, and D reals correspond to C long doubles.
Jul 16 2004
Sean Kelly wrote:The subject says it all. I have to cast to a double to print values of this type. SeanThis page might be helpful to you: http://www.prowiki.org/wiki4d/wiki.cgi?HowTo/printf It has a list of format specifiers corresponding to particular D types. If you find a mistake, you can even edit the page to fix it. With the advent of writef, I'll going to look at phasing out my calls to printf: http://www.digitalmars.com/d/phobos.html#stdio I think if I'm using writef, I won't run into random garbage or access violations from using the wrong specifier. (Actually errors messages are much more helpful.) -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Jul 17 2004