format question and function question 
Author Message
 format question and function question

hello all

is there a format descriptor (like Fw.d or Ew.d) which means:
    "print all your significant digits.  don't care if it's in decimal
     format, exponent format, or whatever.  just print it all and don't
     worry about how many characters it's gonna take."

also, when you define a function:

REAL FUNCTION foo(bar)

is it the fortran standard (and in particular, the MS powerstation fortran
standard) that foo will ALWAYS start out as zero?   in otherwords, is it
ok to do something like:

REAL FUNCTION foo(bar)
        REAL, INTENT(IN) :: bar

        foo = foo + bar
END FUNCTION foo

without having a statement like foo = 0?  

thanks!

pete

--
--
Great quotes:
+-=-=-=-=-=-+
I have never read a William Gibson novel.  I'd recommend reading some of his
    books, even though I have not done so myself.   (Console Cowboy)
Perjury is very similar to lying.   (Dan Quayle)
I feel that, musically, Motley Crue has always evolved as a band (Nikki Sixx)
-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-
Do you hate spam? Join the Coalition Against Unsolicited Commercial Email
(CAUCE) at http://www.*-*-*.com/ . Actions speak louder than words. Join Today!

     I BOYCOTT ANY COMPANY THAT USES MASS ADVERTISING ON THE INTERNET



Wed, 18 Jun 1902 08:00:00 GMT  
 format question and function question

Quote:

> hello all

> is there a format descriptor (like Fw.d or Ew.d) which means:
>     "print all your significant digits.  don't care if it's in decimal
>      format, exponent format, or whatever.  just print it all and don't
>      worry about how many characters it's gonna take."

Try WRITE (*,*) where the second * is your format specifier.
This generally writes out the correct number of significant digits.

Quote:
> also, when you define a function:

> REAL FUNCTION foo(bar)

> is it the fortran standard (and in particular, the MS powerstation fortran
> standard) that foo will ALWAYS start out as zero?   in otherwords, is it
> ok to do something like:

It is not a good idea for you to rely on any compiler to initialize
uninitialised variables for you.  Sooner or later it will get you!

Quote:

> REAL FUNCTION foo(bar)
>         REAL, INTENT(IN) :: bar

>         foo = foo + bar
> END FUNCTION foo

> without having a statement like foo = 0?

If your intent is to add the previous result to the input, then you
should store the previous result in a SAVEd local variable.  You should
not depend on an unsaved local variable to be defined upon return to the
Function or Subroutine.

Quote:
> thanks!

> pete

> --
> --
> Great quotes:
> +-=-=-=-=-=-+
> I have never read a William Gibson novel.  I'd recommend reading some of his
>     books, even though I have not done so myself.   (Console Cowboy)
> Perjury is very similar to lying.   (Dan Quayle)
> I feel that, musically, Motley Crue has always evolved as a band (Nikki Sixx)
> -=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-+-+-=><=-
> Do you hate spam? Join the Coalition Against Unsolicited Commercial Email
> (CAUCE) at http://www.cauce.org. Actions speak louder than words. Join Today!

>      I BOYCOTT ANY COMPANY THAT USES MASS ADVERTISING ON THE INTERNET

Jerry . . .

--

Custom Solutions              http://www.cs-software.com/
209 Bayberry Run
Summerville, SC  29485-8778    Your source for discounted
Voice:  (843) 871 9081           Fortran compilers and
Fax:    (843) 873 8626             related software



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Language question : function'Access / function'unchecked_Access

2. Intrinsoc function as argument to intrinsic function question

3. A function-generating function question.

4. Questions-Questions-Questions-Answers-Answers

5. Question(Questions, questions...)

6. J Format (": ) Questions

7. Locale and date format question

8. Simple formatting question?

9. Simple formatting question?

10. pb/cc 2.11 FORMAT$ question / suggestion

11. Field Format Question?

12. Report Formatting Questions

 

 
Powered by phpBB® Forum Software