- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When writing out a negative zero value to the console, (-0.0) the negative sign is dropped.
For example:
S = -0.000005
I want to print out a zero value if S is less than my threshold of 0.001
IF(ABS(S) .LT. 0.001) THEN
S=SIGN(0.0, S)
S now equals -0.0
if I now try to write out the variable S to the console using:
write(*,S) 10
10 format('S= ', F10.2)
I get:
S= 0.00
I need to preserve the sign of the original number as it represents a vector quantity.
Is this possible?
Using visual studio 2022, v17.10.5
Fortran compiler 2024.2.0, (IFX)
Fortran F77 compatibility.
- Tags:
- FORTRAN LANGUAGE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Arebus there is an older thread available here:
https://community.intel.com/t5/Intel-Fortran-Compiler/Minus-zero-instead-of-zero/td-p/1090742
can you try to use -assume minus0 ?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Arebus there is an older thread available here:
https://community.intel.com/t5/Intel-Fortran-Compiler/Minus-zero-instead-of-zero/td-p/1090742
can you try to use -assume minus0 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks:
Project>Properties>Configuration Properties>Fortran>Floating Point>Enable IEEE Minus Zero Support
Worked, prints out the minus sign.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page