File: test_float2string.pro

package info (click to toggle)
gnudatalanguage 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,368 kB
  • sloc: cpp: 189,797; ansic: 46,721; sh: 677; python: 474; makefile: 146; xml: 69; f90: 28
file content (37 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
;
; Alain Coulais, June 2010
; under GNU GPL 2 or later
;
; few cases where STRING() conversion output
; differ between IDL and GDL
;
pro TEST_FLOAT2STRING

print, 'various Float conversion into strings:'

print, STRING(123123.)
print, STRING(123.)
print, STRING(123.e)
print, STRING(123.e0)
print, STRING(123.e1)
;
print, STRING(123.e, format='(f13.2)')
print, STRING(123.e, format='(e13.3)')
print, STRING(123.e1)
print, STRING(123.e1, format='(e13.3)')
print, STRING(123.e1, format='(e13.4)')
;print, STRING(123.e1, format='()')

print, STRING(123.123e4)
print, STRING(123.123e4, format='(e13.4)')
;
; bug id 2555865
;
print, 'conversion into strings in C style:'
;
resu=string(format='(%"test32T_%dinp.dat")',42)
print, 'Expected: >>test32T_42dinp.dat<<'
print, 'Result:   >>'+resu+'<<'
if (STRLEN(resu) NE 17) then print, 'difference between Exp. and Res.'

end