Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. semmmmml

    Fortran 95 kind conversion

    Thank you, this works! :)
  2. semmmmml

    Fortran 95 kind conversion

    After doing some digging, I came to the following result: The cut off after the 7th digit came from not initializing pi correctly wrong: real(rk) :: pi = 3.14159265358979323846264338327950288419716939937510582 correct: real(rk) :: pi = 3.14159265358979323846264338327950288419716939937510582_rk...
  3. semmmmml

    Fortran 95 kind conversion

    Yes, I am aware that many of the digits get lost right away, I just copied them in and was too lazy to delete the obsolete ones. And about the output: my mistake! Again, I didn't count the digits and didn't think that write(*,*) prints irrelevant digits. My output looks like this...
  4. semmmmml

    Fortran 95 kind conversion

    Hello salgerman, thank you for your explanation. I understand all the above and of course I understand that I do not gain precision by converting an integer into a real. Actually I just wanted to know, if there was an easy way to convert an integer into a selected_real_kind. This is why i did...
  5. semmmmml

    Fortran 95 kind conversion

    You are right, the integer has to be in the numerator, but my question is still the same. This is a minimal example: program conversion implicit none integer, parameter :: rk = selected_real_kind(15,307) integer :: a = 10, b = 5 real(rk) :: c !integer division but integer output ->...
  6. semmmmml

    Fortran 95 kind conversion

    Hello, I want to convert an integer variable into a selected_real_kind but I am not sure how to do this. Can anyone help me? The code looks like this: integer, parameter :: rk = selected_real_kind(15,307) !in this case double precision integer :: a = 10 real(rk) :: b b = 1._rk/a !here I get...

Part and Inventory Search

Back
Top