#3 format codes '(X)' and '(X0)' do not behave right

closed
nobody
None
5
2004-04-30
2004-04-18
No

The IDL format codes '(X)' and '(X0)' behave specially
(where 'X' is any one of a number of format codes such
as D, F, I and so on).

The IDL (X0) format means, "print using a natural
width," where that is more or less arbitrarily defined
for floating point numbers, and the exact width for
integers. The (X) format means "print with maximum
precision."

GDL appears to handle integers and strings fine, but
not floating point.

Examples:
print, !pi, format='(F)'
IDL=" 3.1415927"
GDL="3"
print, !pi, format='(F0)'
IDL="3.141593"
GDL="3"
print, !dpi, format='(D)'
IDL=" 3.1415926535897931"
GDL="3"
print, !dpi, format='(D0)'
IDL="3.141593"
GDL="3"

I don't understand enough about the format-code parser
to tell how this can be fixed, so I leave it as a bug
report.

Craig Markwardt

gdl 0.7.2
[305]> uname -a
Linux xylo 2.4.20-20.7smp #1 SMP Mon Aug 18 14:39:05
EDT 2003 i686 unknown
[306]> cat /etc/redhat-release
Red Hat Linux release 7.1 (Seawolf)

Discussion

  • Marc Schellens

    Marc Schellens - 2004-04-30
    • status: open --> closed
     
  • Marc Schellens

    Marc Schellens - 2004-04-30

    Logged In: YES
    user_id=932957

    Corrected in 0.8:

    GDL - GNU Data Language, Version 0.8
    GDL> print, !pi, format='(F)'
    3.1415927
    GDL> print, !dpi, format='(D0)'
    3.141593

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks