JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for COMP-FORTRAN-90 Archives


COMP-FORTRAN-90 Archives

COMP-FORTRAN-90 Archives


COMP-FORTRAN-90@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

COMP-FORTRAN-90 Home

COMP-FORTRAN-90 Home

COMP-FORTRAN-90  July 2016

COMP-FORTRAN-90 July 2016

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Does anybody else care about reliability?

From:

Van Snyder <[log in to unmask]>

Reply-To:

Fortran 90 List <[log in to unmask]>

Date:

Thu, 7 Jul 2016 12:46:27 -0700

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (139 lines)

Clive had a few misconceptions about the proposal.

The proposal specifies only intrinsic units Unitless and Radian.

The processor doesn't intrinsically understand the relationships between
any units.  That is the programmer's responsibility.  The processor does
generate conversion functions based upon unit definitions, but these
must be applied explicitly.

Conversions are not automatic, except during formatted input.  Within
expressions, if conversions are needed, they are explicit, using the
function defined by the unit definition.

If a conversion cannot be expressed in the form a*X+b, one can write
generic functions of the same names as the units to convert between, say
Janskys and optical magnitude.  Such functions would not be used for
automatic conversion during input.

There would be no "Fortran convention" for units in formatted files.
Units, if any, would be represented by a string that is the same as the
name of the units of the variable being read.  This seems like a pretty
trivial thing for other programs to include in their output.  Checking
or conversion would occur if and only if there is a "U" edit descriptor.

On Thu, 2016-07-07 at 15:45 +0100, Clive Page wrote:
> Yes I care about software reliability.  I don't feel at all well 
> qualified to respond to this, but so far nobody else on this list has 
> responded (but I see a few follow-ups on details on comp.lang.fortran) 
> so let me give a personal response as best I can.
> 
> I use and write astronomical data analysis software.  Most of 
> astronomical packages that others write are now coded in C or C++ or 
> Java.  Most older astronomers gave up using Fortran during the long gap 
> before Fortran90; the younger ones never considered learning Fortran at 
> all, as far as I can tell.  I seriously doubt whether the addition of 
> this feature to Fortran would be enough to persuade them to switch or 
> learn.
> 
> Most of my own programming, however, is in Fortran, and like all 
> programmers I make mistakes, and hence spend a regrettable amount of my 
> time debugging my own code.  And astronomical calculations are 
> particularly infested with bizarre units.  For angles, astronomers seem 
> unable to lose their addiction to Babylonian notation 
> (degrees:arc-minutes:arc-seconds etc.), but also use radians, degrees, 
> and more.  Dates and times are almost as bad: we use ISO 8601 strings, 
> Julian Dates and Modified Julian Dates (where the base differs by 
> exactly 2,400,000.5 days), years, days, and seconds.  Software that I 
> have written in the last few years has had to cope with all these and more.
> 
> My guess, however, is that no more than 10% of my mistakes involve using 
> the wrong units, and when they occur they are always very evident, as 
> the results are typically out by a factor of some large number like 
> 86400, which even astronomers tend to notice, so they are easy to 
> diagnose and fix.  I don't expect that using a comprehensive units 
> system such as yours would actually reduce my debugging time by more 
> than a one or two percent, nor would it simplify the code.
> 
> I take your point that such a system might have prevented the loss of 
> the Mars Climate Orbiter which was most unfortunate but perhaps almost 
> unique;  I haven't seen any other evidence that mistakes in units 
> generally get through the most basic testing procedures that all 
> software developers use.  Because these mistakes cause effects which are 
> so hard to miss, they almost never escape into production code, in my 
> experience.
> 
> Another problem is the complexity of the whole subject.  I have a little 
> background here as one of the authors of a revision of the standard for 
> FITS files: a data format widely used by astronomy.  Those interested 
> can download it in various formats from
> http://fits.gsfc.nasa.gov/fits_standard.html
> Tables 3 to 6 and the adjacent text reveal some of the complexities 
> encountered in practice.  Most of those designing FITS files try to 
> document the physical units of their data values in one of the approved 
> forms so that they can be understood by humans.  Occasionally someone 
> proposes that FITS-reading software should do automatic conversion using 
> this standard, but I am not aware of any successful attempts to do this. 
>   The phrase "can of worms" springs to mind.
> 
> Your proposals includes, besides simple unit checking, unit conversions 
> in expressions and assignments and a new format for text files with 
> changes to format descriptors.  Units conversion might be feasible in 
> trivial cases, but where it might be most useful, e.g. to covert radio 
> fluxes in say micro-Janskys to optical magnitudes (a negative 
> logarithmic scale, as designed by the ancient Greeks), it requires so 
> much domain knowledge that it really would not be appropriate to put it 
> into a compiler.  I really think that it is hopelessly optimistic to 
> expect such conversions to work in a useful manner.
> 
> For I/O it would be desirable to cover unformatted and stream files, 
> where at least in most cases both input and output are likely to be 
> performed by Fortran programs.  For text files I'm not so sure actually: 
> when I read or write text files it is usually to interface to a human or 
> to some other package, such as another analysis program, a spreadsheet, 
> or database.  The chances of getting these packages to adopt for their 
> CSV files the same convention for units as Fortran are, well, just about 
> zero.
> 
> On the other side of the cost/benefit analysis, I have no idea is how 
> difficult it would be for compiler-writers to implement the current 
> proposals.  It looks to me like a large amount of work.  At present one 
> of the least satisfactory features of Fortran, as seen by a mere 
> programmer, is the large disparity between the standard in theory and 
> that actually usable in practice.  As someone interested in software 
> reliability I try to compile my code using at least two different 
> compilers and compare the results: this means that many nice features of 
> F2003 and F2008 are ones that I still cannot use because they are not 
> provided by enough compilers.  Given the current gap of at least 16 
> years between a standard being defined and all its features coming to 
> the majority of compilers in use, I would hesitate to put in the next 
> standard any features that were going to be expensive to implement or of 
> doubtful value for fear that they might perpetuate or even extend this 
> gap between theory and practice.
> 
> It might be possible to persuade me of the utility of a very much 
> cut-down proposal, just to provide unit checking on arguments of 
> procedures (and function return values).  This would involve the 
> provision by the programmer of a simple tag, a character string, for 
> each actual and dummy argument.  The sort of thing I have in mind is 
> where a function call which at present looks like this:
>    offset_angle = great_circle_distance (ra1, dec1, ra2, dec2)
> might have units tags added like this:
>    offset_angle = great_circle_distance[arcsec] (ra1[rad], dec1[rad], 
> ra2[rad], dec2[rad])
> 
> Just to emphasise: the compiler would not try to understand the string 
> at all, just check that actual and dummy arguments had strings that 
> matched exactly.  It would mean that, say, [rad] would fail to match 
> [rads] or [radian].  Users would soon learn to check the specification 
> of every procedure they called rather carefully and get this right, 
> while programmers could choose any units names they wanted.  Even this 
> simple proposal would impair the legibility of a program; whether the 
> resulting gain in units-checking would be worth it, well maybe.  It 
> would surely be simpler to implement, but I have no idea at all how much 
> work would be involved in even adding this simple units-checking 
> proposal to existing compilers.
> 
> Regards
> 

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
February 2023
November 2022
September 2022
February 2022
January 2022
June 2021
November 2020
September 2020
June 2020
May 2020
April 2020
December 2019
October 2019
September 2019
March 2019
February 2019
January 2019
November 2018
October 2018
September 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
April 2015
March 2015
January 2015
December 2014
November 2014
October 2014
August 2014
July 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
July 2013
June 2013
May 2013
April 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
August 2010
July 2010
June 2010
March 2010
February 2010
January 2010
December 2009
October 2009
August 2009
July 2009
June 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1997


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager