realbasic-nug
[Top] [All Lists]

Re: Implicit coercion of real to integer

To: realbasic-nug at lists dot realsoftware dot com
Subject: Re: Implicit coercion of real to integer
From: "Nathan Warden" <natha1 at hotmail dot com>
Date: Thu, 19 Feb 2004 15:51:25 -0700

I'll second that.

Yep!  It is like that in every language I've ever used (C/C++, Future Basic, JAVA, and of course, RB).  Converting a double to an integer will NEVER be rounded.  The decimal value will ALWAYS just be dropped off the end.

Nathan Warden

>From: "Joseph J. Strout"
>Reply-To: "REALbasic Network Users Group"
>To: "REALbasic Network Users Group"
>Subject: Re: Implicit coercion of real to integer
>Date: Thu, 19 Feb 2004 16:08:16 -0600
>
>At 1:57 PM -0800 2/19/04, Stuart Malin wrote:
>
>>Using 5.2.4, Rb coerces a real to a string by truncation.
>>
>> Dim i As integer
>> i = 111.789  // yields 111
>
>That's coercing a real to an integer, not a string, but yes.
>
>>Is this documented (i.e., can be relied upon to remain this way in
>>the future)
>
>Yes.
>--
>
>REAL World 2004, The REALbasic User Conference, March 24th-26th
>
>
>- - -
>Unsubscribe or switch delivery mode:
>
>
>Search the archives of this list here:
>


Take off on a romantic weekend or a family adventure to these great U.S. locations. - - - Unsubscribe or switch delivery mode: Search the archives of this list here:
<Prev in Thread] Current Thread [Next in Thread>
  • Re: Implicit coercion of real to integer, Nathan Warden <=