Fortran formated output for floating point numbers

前端 未结 1 375
后悔当初
后悔当初 2020-12-22 07:26

Is there a way in Fortran to write float numbers as 17,3 and not 17.3, changing the dot to a comma?

I have some large data sets wirtten to

相关标签:
1条回答
  • 2020-12-22 07:42

    If you're just writing a line or two you can add the decimal edit descriptor dc to your output format. Here's a simple example

    write(*,'(dc,f12.3)') 12.3
    

    which produces

    12,300
    

    If you want to write to a file, add the clause

    decimal = 'comma'
    

    to your open statement, for example:

    open(6,decimal='comma')
    

    Of course, here I'm (re-)opening stdout to write commas rather than points.

    0 讨论(0)
提交回复
热议问题