Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

logical operator in fortran 90
Hi,
I'm having the following problem with fortran 90 using logical
operators.
With the following statement I get the right answer.  The statement is
as follows:
if(x_cor_split(j).eq.x_cor_split(repetidos(i,2)).and.&
y_cor_split(j).eq.y_cor_split(repetidos(i,2))) then ...

Now, I need to obtain exactly the opposite answer, so I suppose that I
just need to change the lo .eq. by .ne., but when I change the lo, I
get a totally different answer of what I was expecting for. How can I
solve this problem?

FYI I'm using cvf 6.6

Hope somebody can help me,

Greetings,
Joel

Report this thread to moderator Post Follow-up to this message
Old Post
joel GUERRERO
10-20-04 08:56 AM


Re: logical operator in fortran 90
On 19 Oct 2004 20:22:29 -0700, joel GUERRERO wrote:
> Hi,
> I'm having the following problem with fortran 90 using logical
> operators.
> With the following statement I get the right answer.  The statement is
> as follows:
> if(x_cor_split(j).eq.x_cor_split(repetidos(i,2)).and.&
> y_cor_split(j).eq.y_cor_split(repetidos(i,2))) then ...

> Now, I need to obtain exactly the opposite answer, so I suppose that I
> just need to change the lo .eq. by .ne., but when I change the lo, I
> get a totally different answer of what I was expecting for. How can I
> solve this problem?

The negation of

(1) (a .eq. b) .and. (c .eq. d)

is which of the following? (pick one:)

(2) (a .ne. b) .and. (c .ne. d)
(3) (a .ne. b) .or. (c .ne. d)

> FYI I'm using cvf 6.6

Makes no difference.



--
Dave Seaman
Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling.
<http://www.commoncouragepress.com/i...book&bookid=228>

Report this thread to moderator Post Follow-up to this message
Old Post
Dave Seaman
10-20-04 08:56 AM


Re: logical operator in fortran 90
Dave Seaman wrote:
>
> On 19 Oct 2004 20:22:29 -0700, joel GUERRERO wrote: 
> 
>
> The negation of
>
>         (1) (a .eq. b) .and. (c .eq. d)
>
> is which of the following? (pick one:)
>
>         (2) (a .ne. b) .and. (c .ne. d)
>         (3) (a .ne. b) .or. (c .ne. d)
> 
>
> Makes no difference.
>

The logical negation of (1) is (3). It is a rather elementary
exercise in logic :)

Regards,

Arjen

Report this thread to moderator Post Follow-up to this message
Old Post
Arjen Markus
10-20-04 08:56 AM


Re: logical operator in fortran 90
Dave Seaman wrote:
> On 19 Oct 2004 20:22:29 -0700, joel GUERRERO wrote:
> 
>
> 
>
>
> The negation of
>
> 	(1) (a .eq. b) .and. (c .eq. d)
>
> is which of the following? (pick one:)
>
> 	(2) (a .ne. b) .and. (c .ne. d)
> 	(3) (a .ne. b) .or. (c .ne. d)

or

(4) .not. ((a .eq. b) .and. (c .eq. d))

Report this thread to moderator Post Follow-up to this message
Old Post
Tom Micevski
10-20-04 08:56 AM


Re: logical operator in fortran 90
joel GUERRERO wrote:
>
> Now, I need to obtain exactly the opposite answer, so I suppose that I
> just need to change the lo .eq. by .ne., but when I change the lo, I
> get a totally different answer of what I was expecting for. How can I
> solve this problem?

Enroll in the appropriate course, or consult a textbook on "Boolean
algebra". In the meantime, short answer is:  .not.(expr)


Report this thread to moderator Post Follow-up to this message
Old Post
bv
10-20-04 08:56 AM


Re: logical operator in fortran 90
On Wed, 20 Oct 2004 at 06:24 GMT, Tom Micevski (aka Bruce)
was almost, but not quite, entirely unlike tea:
> Dave Seaman wrote: 
> or
>       (4) .not. ((a .eq. b) .and. (c .eq. d))

Which the compiler ought to optimise to the quickest to evaluate
expression anyway, so use the expression that makes most sense in the
context. Sometimes refactoring complex boolean expressions makes me
realise I was thinking about it the hard way when I came up with with
the original expression.

--
TimC -- http://astronomy.swin.edu.au/staff/tconnors/
Disclaimer: This post owned by the owner

Report this thread to moderator Post Follow-up to this message
Old Post
TimC
10-20-04 08:56 AM


Re: logical operator in fortran 90
Hi,

http://mathworld.wolfram.com/deMorgansLaws.html

Regards,
B52B


joel GUERRERO wrote:
> Hi,
> I'm having the following problem with fortran 90 using logical
> operators.
> With the following statement I get the right answer.  The statement is
> as follows:
> if(x_cor_split(j).eq.x_cor_split(repetidos(i,2)).and.&
> y_cor_split(j).eq.y_cor_split(repetidos(i,2))) then ...
>
> Now, I need to obtain exactly the opposite answer, so I suppose that I
> just need to change the lo .eq. by .ne., but when I change the lo, I
> get a totally different answer of what I was expecting for. How can I
> solve this problem?
>
> FYI I'm using cvf 6.6
>
> Hope somebody can help me,
>
> Greetings,
> Joel

Report this thread to moderator Post Follow-up to this message
Old Post
B52B
10-20-04 01:56 PM


Re: logical operator in fortran 90
"joel GUERRERO" <joegi.geo@yahoo.com> wrote in message
news:bc7de858.0410191922.2f7cd7d1@posting.google.com...
> Hi,
> I'm having the following problem with fortran 90 using logical
> operators.
> With the following statement I get the right answer.  The statement is
> as follows:
> if(x_cor_split(j).eq.x_cor_split(repetidos(i,2)).and.&
> y_cor_split(j).eq.y_cor_split(repetidos(i,2))) then ...
>
> Now, I need to obtain exactly the opposite answer, so I suppose that I
> just need to change the lo .eq. by .ne., but when I change the lo, I
> get a totally different answer of what I was expecting for. How can I
> solve this problem?
>
> FYI I'm using cvf 6.6
>
> Hope somebody can help me,
>
> Greetings,
> Joel

As an extra comment :

If x_cor_split and/or y_cor_split are floating point numbers, it is not
recommended to be testing for equality, or non-equality, but within some
tolerance.


Les



Report this thread to moderator Post Follow-up to this message
Old Post
Les
10-20-04 01:56 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Fortran archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:56 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.