Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.fortran

Reply
 
Thread Tools Display Modes
  #16 (permalink)  
Old 10-07-2006, 05:08 PM
Dr Ivan D. Reid
Guest
 
Posts: n/a
Default Re: intrinsic logical to integer conversion?

On 6 Oct 2006 13:36:27 -0700, bjarne <bjarne@gmail.com>
wrote in <1160166987.125548.261340@e3g2000cwe.googlegroups. com>:

> The basic: The C++ Boolean type is called bool and can have the values
> true and false; bool, true, and false are keywords. The integer value
> of false is 0 and the value of true is 1.


Thanks, Bjarne. Looks like the code wasn't as assumptive as I surmised.
Although, the subroutine is called millions of times so short-circuiting out of
the loop early is probably a Good Thing(TM).

--
Ivan Reid, Electronic & Computer Engineering, ___ CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #17 (permalink)  
Old 10-22-2006, 05:14 AM
robin
Guest
 
Posts: n/a
Default Re: intrinsic logical to integer conversion?

"Mark Morss" <mfmorss@aep.com> wrote in message
news:1160147584.700704.208460@c28g2000cwb.googlegr oups.com...
> Pardon my ignorance, but I've been trying to find an intrinsic function
> for this in my reference (Chapman), and I haven't been successful.
> (Naturally I want .TRUE. = 1 and .FALSE = 0). Coercion does not work,
> at least not with g95. Do i have to write my own function?


Yes.
elemental function int (b) result (r)
logical :: b
integer :: r
if (b) then; r = 1; else; r = 0; end if
end function int



Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Conversion: DAYTIME tO DATE format Madan Gopal Kundu Newsgroup comp.soft-sys.sas 0 04-05-2006 07:28 AM
Re: Help with PROC LP, integer program initial solution David L Cassell Newsgroup comp.soft-sys.sas 1 12-16-2005 02:01 AM
Data conversion Tom Hide Newsgroup comp.soft-sys.sas 0 10-25-2005 09:50 AM
Re: Conversion table and interpolation toby dunn Newsgroup comp.soft-sys.sas 0 04-26-2005 09:07 PM
Re: RE : V8 to V9 conversion? Robin & Charmaine Templer Newsgroup comp.soft-sys.sas 1 01-20-2005 03:52 PM



All times are GMT. The time now is 11:00 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.