Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #1166
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
|---|---|
| From | valerasimonov@gmail.com |
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: How to print floats with leading blanks instead of leading zeros using sprintf? |
| Date | Thu, 31 May 2012 05:43:39 -0700 (PDT) |
| Organization | http://groups.google.com |
| Lines | 33 |
| Message-ID | <ae01104c-e91d-4337-8c51-b7a27e53ba55@googlegroups.com> (permalink) |
| References | <3d97629a-6d13-4e42-bb08-9a1d05a569d9@vy7g2000pbc.googlegroups.com> <a2i989FfaaU1@mid.dfncis.de> <b987673d-4d34-4b67-b565-a77ccb766f3c@googlegroups.com> <a2kc1rF13iU1@mid.dfncis.de> |
| NNTP-Posting-Host | 132.206.126.41 |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | posting.google.com 1338468219 17332 127.0.0.1 (31 May 2012 12:43:39 GMT) |
| X-Complaints-To | groups-abuse@google.com |
| NNTP-Posting-Date | Thu, 31 May 2012 12:43:39 +0000 (UTC) |
| In-Reply-To | <a2kc1rF13iU1@mid.dfncis.de> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=132.206.126.41; posting-account=4Nx8HQoAAACPrCgQ4Rd61O9cDhaTWCLL |
| User-Agent | G2/1.0 |
| X-Received-Bytes | 2738 |
| Xref | csiph.com comp.graphics.apps.gnuplot:1166 |
Show key headers only | View raw
On Tuesday, May 29, 2012 12:33:00 PM UTC-4, Hans-Bernhard Bröker wrote:
> On 29.05.2012 04:56, valerasimonov@gmail.com wrote:
>
> [...]
> >>> However gnuplot outputs: sprintf(' %3.0f',1) "001"
>
> >> No, it doesn't.
> [...]
> > What I want to print is " 1". Do you know how this task can be
> > accomplished?
>
> You already knew yourself --- the command you tried did (pretty much)
> exactly that. You just misinterpreted the actual result you saw because
> you looked at it in a proportional-font output format.
>
> > About integers you are right again. But doesn't (although with
> > warnings) C transform int to float when necessary?
>
> Not in these cases it wouldn't. Variadic functions don't give the
> compiler the information to apply such transformations automatically.
> So if you tried a stunt like printf("5.3f", 3) in a C program, you
> would be giving the compiler and/or compiled program a legit excuse to
> do whatever it pleases (the technical term is "undefined behaviour").
>
> But that's rather beside the point, since you're using gnuplot here, not
> C. Yes, gnuplot is designed to imitate C, but the analogy cannot be
> perfect. gnuplot will convert automatically from float to integer and
> vice versa, both without a warning. It can do that because unlike C it
> has information about the type of things even at run time.
Hans-Bernhard Bröker, thank you for your reply and elucidations!
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar
How to print floats with leading blanks instead of leading zeros using sprintf? Валерий Симонов <valerasimonov@gmail.com> - 2012-05-28 08:09 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? sfeam <sfeam@users.sourceforge.net> - 2012-05-28 11:16 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? Валерий Симонов <valerasimonov@gmail.com> - 2012-05-28 19:33 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? sfeam <sfeam@users.sourceforge.net> - 2012-05-28 20:48 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? valerasimonov@gmail.com - 2012-05-29 06:18 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? valerasimonov@gmail.com - 2012-05-28 20:19 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-05-28 23:32 +0200
Re: How to print floats with leading blanks instead of leading zeros using sprintf? valerasimonov@gmail.com - 2012-05-28 19:56 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-05-29 18:33 +0200
Re: How to print floats with leading blanks instead of leading zeros using sprintf? valerasimonov@gmail.com - 2012-05-31 05:43 -0700
Re: How to print floats with leading blanks instead of leading zeros using sprintf? Christoph Bersch <usenet@bersch.net> - 2012-05-29 09:51 +0200
Re: How to print floats with leading blanks instead of leading zeros using sprintf? valerasimonov@gmail.com - 2012-05-29 06:19 -0700
csiph-web