Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Re: Assigning r...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 202 of 213
Post > Topic >>

Re: Assigning real to integer

by CBFalconer <cbfalconer@[EMAIL PROTECTED] > Dec 23, 2007 at 08:29 PM

john wrote:
> 
> Is there any way to assign a real variable to an integer variable?

>From ISO10206:

 6.7.6.3 Transfer functions

 trunc(x)

 From the expression x that shall be of real-type, this function
 shall return a result of integer-type. The value of trunc(x)
 shall be such that if x is positive or zero, then 0 <= x -
trunc(x)
 < 1; otherwise -1 < x <= x - trunc(x). It shall be an error if
such
 a value does not exist.

 Examples:
        trunc(3.5) {yields 3}
        trunc(-3.5) {yields -3}

 round(x)

 From the expression x that shall be of real-type, this function
 shall return a result of integer-type. If x is positive or zero,
 round(x) shall be equivalent to trunc(x+0.5); otherwise, round(x)
 shall be equivalent to trunc(x-0.5)  It shall be an error if such
 a value does not exist.

-- 
Merry Christmas, Happy Hanukah, Happy New Year
        Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
     <http://cbfalconer.home.att.net>


-- 
Posted via a free Usenet account from http://www.teranews.com
 




 3 Posts in Topic:
Assigning real to integer
john <john@[EMAIL PROT  2007-12-24 01:52:25 
Re: Assigning real to integer
"Chris Burrows"  2007-12-24 11:14:27 
Re: Assigning real to integer
CBFalconer <cbfalconer  2007-12-23 20:29:16 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 6 2:17:05 CDT 2008.