New topic: 

Double & array's

<http://forums.realsoftware.com/viewtopic.php?t=37038>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        Sky Stream          Post subject: Double & array'sPosted: Tue 
Jan 11, 2011 8:05 pm                         
Joined: Sun Nov 23, 2008 12:27 am
Posts: 204
Location: New Jersey                I am not sure if I found a bug of if I am 
using the syntax incorrectly when adding numbers that are double to an array.

This works:
Code:  dim d() as double
  d.Append 15

This works:
Code:  dim d() as double
  d = array(15.0)

This does not work:
Code:  dim d() as double
  d = array(15)


I get an error message: Type mismatch error. Expected Double(), but got Int32()

thoughts?      
_________________
- Rich

RealStudio 2010 R5 Enterprise
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini 
running OS X 10.6.4  
                             Top                 npalardy          Post 
subject: Re: Double & array'sPosted: Tue Jan 11, 2011 8:22 pm                   
      
Joined: Sat Dec 24, 2005 8:18 pm
Posts: 6376
Location: Canada, Alberta, Near Red Deer                15 is determined by 
REAL basic to be an integer 
Array creates an array of the type given (in this case integers)
When you try to make an array of integers into an array of doubles you get the 
problem 
When you do d = array(15) you've asked REALbasic to try and assign an array of 
integers into an array of doubles
It refuses and you get the error      
_________________
My web site Great White Software
RBLibrary.com REALbasic learning  
                             Top                Sky Stream          Post 
subject: Re: Double & array'sPosted: Tue Jan 11, 2011 9:00 pm                   
      
Joined: Sun Nov 23, 2008 12:27 am
Posts: 204
Location: New Jersey                I ran into this issue in the bar chart I 
created (http://forums.realsoftware.com/viewtopic.php?f=1&t=37003) and I am 
debating if its worth flipping it to integer rather than double. Then again, 
the work around is not toooo toooo bad... 

Thank you Norman for the explanation.      
_________________
- Rich

RealStudio 2010 R5 Enterprise
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini 
running OS X 10.6.4  
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to