To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 11060
11059  |  11061
Subject: 
Re: number notation in official parts
Newsgroups: 
lugnet.cad.dev
Date: 
Fri, 12 Mar 2010 09:50:14 GMT
Viewed: 
23028 times
  
In lugnet.cad.dev, Travis Cobbs wrote:
In lugnet.cad.dev, Timothy Gould wrote:
My point is that to write in mixed format (some %f and others %e) requires some
strange coding unless there is a weird language which does it automatically. I'm
pretty sure that to do it in C or Fortran would be quite hard.

Actually, in C, %g does exactly this.  Having said that, I think LDDP is a
Delphi app, so it uses Pascal, and I don't remember how Pascal does formatting.

--Travis

Ahhh. I'd never heard of %g before now. I'm so used to %f and %e it had never
occured to me that there might be a mixed option. Handy to know as I suspect it
would be helpful in reading files of unknown format.

I'm sure Delphi has some hideous yet totally type-safe system ;)

Tim



Message has 2 Replies:
  Re: number notation in official parts
 
(...) All float specifiers (e, E, f, g, G) are treated identically by the scanf functions. When scanning floats, they always recognize all float formats. One other thing about %g on output is that it automatically strips trailing zeros, which %f (...) (14 years ago, 12-Mar-10, to lugnet.cad.dev)
  Re: number notation in official parts
 
(...) Yes, and no, or rather, maybe. In Delphi you would do something like Write(Format('%g', [Value])); i.e more or less the same format strings as in C. But, it is type-safe at runtime :-) (14 years ago, 12-Mar-10, to lugnet.cad.dev)

Message is in Reply To:
  Re: number notation in official parts
 
(...) Actually, in C, %g does exactly this. Having said that, I think LDDP is a Delphi app, so it uses Pascal, and I don't remember how Pascal does formatting. --Travis (14 years ago, 12-Mar-10, to lugnet.cad.dev)

13 Messages in This Thread:





Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR