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  2005

COMP-FORTRAN-90 2005

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: LOGICAL (was: maxloc of a logical array)

From:

robin <[log in to unmask]>

Reply-To:

Fortran 90 List <[log in to unmask]>

Date:

Fri, 1 Apr 2005 13:07:09 +1000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (184 lines)

> Date:          Wed, 30 Mar 2005 10:16:04 -0500
> From:          David LaFrance-Linden <[log in to unmask]>

>    Date:         Wed, 30 Mar 2005 23:48:48 +1000
>    From: robin <[log in to unmask]>
>
>    > Date:          Tue, 29 Mar 2005 11:13:59 -0500
>    > From:          David LaFrance-Linden <[log in to unmask]>
>    >
>    > Wrong for WHAT?  ...
>
>    Let's go for it them!
>            Of course, what you propose is foolish,
>
> You aren't making any friends with comments like this.

Well, then, consider your trying to sell such a machine.
For at least 55 years, logical hardware has been using
0=false, 1 = true.
0 + 0 = 0 (for + read .and.)
0 + 1 = 1
1 + 0 = 1
1+1 = 1
and for .or.
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 1 etc
Try convincing anyone that 1001 and 0110 are better than 1 and 0.
I thnk you will agree that the description was appropriate.

>    would require even more storage,
>
> Blatently false; see they reply I sent a few minutes ago.

Not false.  More instructions are required.

>    take more execution time,
>
> Not at all clear; see the reply I sent a few minutes ago.

It's patently obvious.
I invited you to inform us how your "proposal"
would handle the logical OR of a true and a false.
Until you do that, you won't see why you are wrong.
[Below does it trivially for constants.  I had variables in mind.]

>    and achieve nothing.
>
> It achieves the semantics of the language, as do all other methods.

It achieves nothing over 0/1 0/-1, pos/neg or any of the other methods,
and runs slower and fatter.

>    Perhaps you'd inform us how under your proposal you would handle
>    the logical OR of a true and false value?
>
> Bitwise OR:
>         .false. .or. .false. => ior(0,     0)      => 0      => .false.
>         .false. .or. .true.  => ior(0,     not(0)) => not(0) => .true.
>         .true.  .or. .false. => ior(not(0),0)      => not(0) => .true.
>         .true.  .or. .true.  => ior(not(0),not(0)) => not(0) => .true.

This is for constants.
What happens when you don't know in advance
what the values will be?  E.g.,   v .or. w
where v and w are LOGICAL variables

> AND is similar, as is XOR.  (EQV is NOT of XOR.)
>
>    It you took your argument to its conclusion, you would need a
>    machine having a word size of 96 bits in which every third bit was
>    actually used to represent a number.
>
> What mushrooms have you been eating?  This makes no sense.

It makes just as much sense as your proposal for
false = 0110 and true as 1001.

>    >  It would be my choice as an implementor.
>
>    Sure, but only because it's not defined in Fortran.
>
> Bingo.
>
>    But would you expect anyone to purchase such a product?
>
> Existence proofs don't do anything for you, do they?  I'm told many
> people have bought Digital/Compaq(/HP) Fortran for Alpha.  I don't
> know if CVF for x86 decided to use 1/0 or ~0/0, so I can't comment
> there.

The correct answer is that it would be a lemon.

> Maybe you mean who would buy a product that requires a 96 bit word in
> which every third bit was used to represent a number?  No, I wouldn't
> expect somebody to buy such a machine, but since you clearly don't
> understand the ~0/0 ideas, your question is irrelevent.

That's just the point -- I *do* understand those "~0/0" ideas.
That's why 0110 and 1001 is a lemon.

>    > In point of fact, I'll remind you that Digital/Compaq(/HP) Fortran for
>    > Alpha does indeed store .false. as 0 and .true. as ~0 (or -1 for those
>    > still thinking in two's complement), and uses even/odd as the testing
>    > method.  And they are easily converted to - and ~0/-1;
>
>    They can be converted to anything _provided_that you know
>    what it it you're looking at.
>    The point is, the user doesn't know, and can't rely on them because they
>    are not defined.
>
> Bingo.  But what are we talking about?  I thought we (everybody who
> has been on this thread) were in agreement the user can't rely on an
> implemtations choice for values.  Some of us have been debating the
> merits of various implementation options.  Which are you doing?

My point is that it *should* be defined.  And that if it
were defined, it should be as 0/1.

>    > as another
>    > poster said, these are just bit patterns and they take on "value" when
>    > you impose an interpretation on them.
>
>    Bits are binary digits, 0 and 1, and have clear unambiguous values.

> That's true, when you interpret them as bits according to the
> dictionary definition.  There are philosophies that worry about the
> verb "to be."  People talk about integers as being a sequence of bits.

Well, 0 and 1 are integers, and they are only one bit each.

> Or of floating point numbers being an interpretation of a packaging of
> bits.  But if you want to dive deeper into IS-ness, modern computers
> deal with bi-valued storage entities, which they package in groups
> into registers and memory.  We impose interpretations on those
> bi-valued packages.  If you insist on people's usage of "bit" as
> literal rather than colloquial, you just aren't going to get anyplace
> until you find like-minded people.

What you have missed is that 0 and 1 are the basic digit
values.
Hardware has been designed to represent and operate upon
logical (Boolean) values.
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 1.
where 0 = false and 1 = true.
General purpose computers since the 1940s have represented
Boolean operations this way, using their logical hardware.

>    Your suggestions sound like Alice's who might design a number
>    like 19486742 but only the RH digit has any value.
>
> What are "my suggestions"?

0110 and 1001 for logical.

>  That the testing method tests just the low
> bit?  This is not unique to the ~0/0 representation.  It exists in ALL
> designs where the storage can have more than 2 states.  You have to
> decide how to collapse the >2 states into 2 states.  even/odd is a
> priori no better or worse than 0/non-0 or negative/non-negative.  It
> is just one possible way.  If hardware were expensive, a claim could
> be made it is better than 0/non-0, since non-0 requires ORing all the
> bits together which is more complex than testing a single bit.
>
>    >  They aren't the right values or
>    > the wrong values for anything, until you declare the consistent
>    > context which imposes an interpretation.  What's your context to claim
>    > they are the wrong values?
>
>    They are values generated by and used by hardware,
>    and require only one bit of storage to represent them.
>
> ~0 can be stored in one bi-valued package of storage quite easily,
> thank you very much.

That is, of course, the case of 1/0.
But the Fortran case is to use a whole word to store a logical value.
Given that a whole word is used in Fortran,
0/1 is the best choice in terms of speed.

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