- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

All;

I wrote this program:

Real*4 rsingle

Real*8 rdouble

rsingle = epsilon(rsingle)

rdouble = epsilon(rdouble)

Write(6,*)'rsingle = ',rsingle

Write(6,*)'rdouble = ',rdouble

Pause

And got this result:

rsingle = 1.1920929E-07

rdouble = 2.220446049250313E-016

Fortran Pause - Enter command<CR> or <CR> to continue.

The manual entry for epsilon ends with:

## Example

If `x` is of type REAL(4), EPSILON (X) has the value 2 ^{-23}.

Why is the difference betweeen 2^(-23) and what is written to the screen so big?

All help on this appreciated. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Why do you think there is a big difference? The numerical value of 2^(-23), when written in decimal form (what you get with write(*,*) is approximately 1.1920928955078125e-7. So, apart from a few extra decimals, that is quite the same value.

The only difference I can think of is the form in which these numbers are presented. But that is the presentation, not the actual value.

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Why do you think there is a big difference? The numerical value of 2^(-23), when written in decimal form (what you get with write(*,*) is approximately 1.1920928955078125e-7. So, apart from a few extra decimals, that is quite the same value.

The only difference I can think of is the form in which these numbers are presented. But that is the presentation, not the actual value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- My bad. I typed it out on the calculator wrong and failed to double check it. Thank you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

No problem - it happens to al lof us from time to time. One time I tried to solve a problem in a program and I was sure I had it fixed but still got the erroneous behaviour, only to find out an embarrassingly long time later that I had been running an old version ...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

*>>No problem - it happens to al lof us from time to time.*

My wife complained to me that I couldn't balance our check register...

... after looking at the numbers I realized I was using base-8 arithmetic.

Jim Dempsey

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