Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • dannycatNovember 20, 2008 5:32 AM PST   
    GS, GN Format Descriptor

    Is there a way of specifying numerical data using a G type descriptor that behaves like ES or EN when the exponential format is required. Currently I believe only the standard E format is used with G specifiers.

    eg  -12345.678 in E13.6 format  -0.123456E+05
                             ES13.6 format -1.234567E+04
                             EN13.6 format -12.34567E+03

    The ES and EN formats give you an extra significant figure and are easier to read. Using the G format has the advantage of writing numbers in floating point format where possible which are even easier to read. A GS (& GN) format would provide a flexible and neat way of writing a large range of numbers fully utilising the space available.

     

     



    TimP (Intel)November 20, 2008 5:58 AM PST
    Rate
     
    Re: GS, GN Format Descriptor

    Quoting - dannycat

    Is there a way of specifying numerical data using a G type descriptor that behaves like ES or EN when the exponential format is required. Currently I believe only the standard E format is used with G specifiers.

    p edit descriptors may be ugly in some cases, but this is the first time I've seen a claim not to believe in them.



    Steve Lionel (Intel)November 20, 2008 3:02 PM PST
    Rate
     
    Re: GS, GN Format Descriptor

    As Tim hints, adding 1P (or 2P or whatever) before the G edit descriptor gives you control of the number of digits to the left of the radix point.  There is no S or N form of G.  You will want to make sure that you reset to 0P before using any F edit descriptors.



    Steve

    Attaching or including files in a post
    Doctor Fortran blog
    @DoctorFortran on Twitter

    dannycatNovember 21, 2008 4:30 AM PST
    Rate
     
    Re: GS, GN Format Descriptor

    As Tim hints, adding 1P (or 2P or whatever) before the G edit descriptor gives you control of the number of digits to the left of the radix point.  There is no S or N form of G.  You will want to make sure that you reset to 0P before using any F edit descriptors.

    Thank Steve, but using the P edit descriptor with G does not do what I requested. I tried it 1PG13.5 for 55.0 example gives a formatted string of 55.00000E+00 not 55.00000. I can get round by coding but the reason for this post was primarily to suggest that the GN and GS format descriptors would be nice to have as part of the language.



Forum jump:  

Intel Software Network Forums Statistics

16,369 users have contributed to 46,341 threads and 163,954 posts to date.

In the past 24 hours, we have 18 new thread(s) 102 new posts(s), and 67 new user(s).

In the past 3 days, the most popular thread for everyone has been Formula for the intersection of straight lines The most posts were made to Take a look at John Burkhard&# The post with the most views is \"-check none\" generates error

Please welcome our newest member bikerepair8


For more complete information about compiler optimizations, see our Optimization Notice.