- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is more of a question about the Fortran standard:
Is there a way to separate the sign of a number from its value in the format of a write() statement?
For example,
```fortran
write(*,"(*(sp,' ',g0))") 1.23
end
```
yields,
```ascii
+1.2300000
```
while,
```ascii
+ 1.2300000
```
would be desired.
Thanks for any hints.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
! Console25.f90
program Console25
implicit none
character(len=100) :: buffer
write(buffer,"(*(sp,g0))") 1.23
buffer = adjustl(buffer)
buffer = buffer(1:1) // ' ' // buffer(2:)
write(*,*) '|' // trim(buffer) // '|'
end program Console25
...
|+ 1.230000|
Jim Dempsey
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page