This is an example about the high precision in Fortran, at first we see a normal Program:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
program hello implicit none real :: div real :: i Print *,"write your number:" read *, i i= div(i) print *,"your result:",i end program Hello real function div( a ) implicit none real :: a div = a/3 end function div |

our Result looks like this:

1 2 3 |
write your number: 4 your result: 1.33333337 |

Now we use selected_real_kind(32) to get an higher precision data type:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
program hello implicit none real(kind=selected_real_kind(32)):: div real(kind=selected_real_kind(32)) :: i Print *,"write your number:" read *, i i= div(i) print *,"your result:",i end program Hello real(kind=selected_real_kind(32)) function div( a ) implicit none real(kind=selected_real_kind(32)) :: a div = a/3 end function div |

Now we get this result:

1 2 3 |
write your number: 4 your result: 1.33333333333333333333333333333333327 |

looks much better than the first.

Fantastic beat ! I would like to apprentice even as you amend

View Commentyour site, how can i subscribe for a blog website?

The account aided me a acceptable deal. I have

been a little bit familiar of this your broadcast offered shiny transparent idea

Hello There. I discovered your blog using msn. This is a very well

View Commentwritten article. I’ll make sure to bookmark it and return to learn more of your helpful info.

Thank you for the post. I will certainly return.

Good post. I learn something totally new and challenging on blogs I stumbleupon everyday.

View CommentIt will always be interesting to read through content from other writers and practice something

from other web sites.

I needed to thank you for this very good read!!

View CommentI definitely loved every bit of it. I have got you book-marked to

check out new things you postâ€¦