Modern Fortran Explained (2023) now published

I never knew you could do that - that’s very useful!

So cool! Indeed.

In fact, one can replace the do loop with alloc%comp = [(i,i=1,n)]**2

2 Likes

As a matter of programming style, that might be the preferred expression anyway. It tells a human reading the code what is the array and what is the scalar and whether reallocation might occur (i.e. when alloc%comp(:) is the array). Otherwise, he would need to track down the original declaration to see what the expression really means.

2 Likes

Many years ago, I wrote about gratuitous use of (:) Doctor, it hurts when I do this! - Doctor Fortran (stevelionel.com)

9 Likes

In this particular case, if alloc is the allocatable array and comp is the scalar, then neither alloc%comp nor alloc(:)%comp on the lhs will trigger allocation on assignment. However, if alloc is the scalar and comp is the allocatable array, then alloc%comp on the lhs can trigger allocation while alloc%comp(:) will suppress it.

2 Likes

I just got my copy. It is red, but a slightly more orange shade than the previous edition.

Exercise 5 (iv), page 187 and corresponding answer of the book says that 1.7**2.0 is NOT a constant expression because of the real exponent. Is this standard behavior? At least gfortran accepts it as a parameter.

1 Like

My reading of the 2023 standard suggests 1.7**2.0 is a constant expression.

In section 10.1.12 Constant expression

1 A constant expression is an expression with limitations that make it suitable for use as a kind type parameter, initializer, or named constant. It is an expression in which each operation is intrinsic, and each primary is
(1) a constant or subobject of a constant,

In section 10.1.5.1 Intrinsic operation classification we have

3 A numeric intrinsic operation is an intrinsic operation for which the intrinsic-operator is a numeric operator (+,–, *, /, or **). A numeric intrinsic operator is the operator in a numeric intrinsic operation.

This is supported by Table 10.2 — Types of operands and results for intrinsic operators which lists R**R for real R.

2 Likes

This is incorrect, and a hangover from the time when we also had initialization constants in the language. Thanks for drawing this to our attention.

Mike

3 Likes

6 Likes

The marketing strategies of publishers are somewhat opaque, even to their authors. The new edition of Modern Fortran Explained was published in the UK on 7 December but the date for elsewhere was given as today, 7 March. So, this is just a reminder that the book is now finally available worldwide, for instance at https://www.amazon.com/Modern-Fortran-Explained-Incorporating-Mathematics/dp/0198876580/ref=sr_1_1?crid=3RULUEVGS38SB&dib=eyJ2IjoiMSJ9.4W6OO_PXz7di1xafdmye4juBGS7tKCiTWT0oMxQnay2bAMS20cTkfr6kMPAJnMUu0fScKo5wbFasinYfFvLUtDugY2OoxSd7IboijL2em4mAcEIDZZXMU55MGInMHpNhtMtUNfuS3HbZGmSbwYHe-0xLlaUifTrwDZqohJG4qdLxXmnipszGS4h2uXECynKO9sAGB2nqEyogGinWq-e3l5J8k6bIoEsfbo5vaj9vScY.yjk1rAxzw8IHlpXiC1yy2UxpxeeEhRD3BqSACcaxRp0&dib_tag=se&keywords=metcalf+fortran&qid=1709799966&s=books&sprefix=metcalf+fortran%2Cstripbooks%2C251&sr=1-1.

Mike Metcalf

7 Likes

Temporarily out of stock. (paperback edition)
:frowning_face:
Edit: It is, apparently, available on amazon.pl but I will probably wait until is becomes also as an ebook. I’ve been using 2018 version bought on Google Play Books, quite intensively.

It can also be considered as a good news (the drawback of success) :slight_smile: for Fortran (but not for the reader).

1 Like

Dear Mike,

Still using Fortran (for my OSS CFD code) and the green 2011 version of your book. As I travel/stay between London, Eindhoven and Madrid, the book is not with me that often. Will there be a ebook, preferably a pdf, that I can store in my Google Drive? Or some other form which enables me to access it when its needed?

Henk

PS: Just discovered this forum!

1 Like

It is sold for $54 as an encrypted PDF at ebooks.com. Below are some details on the format.

Read online

You can read this ebook online in a web browser, without downloading anything or installing software.

Download file formats

This ebook is available in:

  • PDF (encrypted)

Digital Rights Management (DRM)

The publisher has supplied this book in encrypted form, which means that you need to install free software in order to unlock and read it.

Required software

To read this ebook on a mobile device (phone or tablet) you’ll need to install one of these free apps:

To download and read this eBook on a PC or Mac:

  • Adobe Digital Editions (This is a free app specially developed for eBooks. It’s not the same as Adobe Reader, which you probably already have on your computer.)

Ahhh great! Thanks!

Been looking everywhere but found no trace… and so I stumbled into this forum.

Adobe Digital Editions? Is it also available for Linux, more specifically Ubuntu (not Android).

Off to that site!

Both “Modern Fortran Explained” and “Modern Fortran: Building Efficient Parallel Applications” use Adobe Digital Editions. I would like to use and have them both, but I do not want to be dependent on an online repository to read them in a browser on eBooks (sorry but I do not like that concept for a number of reasons - I stay away from Creative Cloud as well). Reading, using books like these on a mobile device (especially a phone is - in German - eine Zumutung, first thing that popped up, an unreasonable demand ;- ). Looked at ordering online, but delivery is when I have left here and two thick books… was what I wanted to avoid. Remains downloading and using them under Windows. The downloads I can store on my Drive, but I can not access them while working under Ubuntu (unless there is something like a Chrome or Firefox extension). Continuing the search.

Modern Fortran: Building Efficient Parallel Applications is available as a regular PDF, at least if purchased through the Manning website. If you have purchased a print copy already, you can register it on the Manning website to get its PDF for free as well (I believe you will need a free account first).

Just note that if you haven’t read any of it in either format, it is a very different book to Modern Fortran Explained. It is much more of a learning guide/tutorial than a reference manual like Modern Fortran Explained. Both are very good books in their own rights.

3 Likes

Is it a really a free PDF or is it locked by some DRM?

Just bought Building Efficient Parallel Applications from Manning. The pdf that is.

No DRM just displays a line “Licensed to < name > < email >” in the footer of each page. Which is fine of course.

2 Likes