Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > float, double etc...

float, double etc...
Thread Tools
Dapp
Fresh-Faced Recruit
Join Date: Jun 2003
Status: Offline
Reply With Quote
Aug 19, 2003, 06:58 AM
 
hi

i have in delphi (m$) a type "real". which one corresponds this in cocoa?
thanks
     
Angus_D
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Aug 19, 2003, 10:44 AM
 
Probably double.
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Aug 19, 2003, 10:47 AM
 
Originally posted by Dapp:
hi

i have in delphi (m$) a type "real". which one corresponds this in cocoa?
thanks
What values does a real hold? In mathematics, a real number is a rational or irrational number (but not an imaginary number). I don't think this could be what it is in Delphi, since no programming language that I am aware up (save something like Mathematica or Maple) supports irrational number. Does the "real" support decimals? If so, it's a float. If not, I'd guess a double.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
DaGuy
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status: Offline
Reply With Quote
Aug 19, 2003, 10:56 AM
 
Cocoa implies Objective-C which implies C.
Therefore, in Cocoa you have all the usual C types and some Cocoa specific wrappers for them i.e. NSNumber, NSDecimal which come in handy for storing numbers in collection classes etc.

What kinds of real numbers are you dealing with? positive or negative integers, decimals, very high precision decimals? C is designed for efficient memory use so it offers you many numerical types.

You could always use a high precision signed decimal type to account for all cases. It just wouldn't be elegant programming.
     
Wevah
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Aug 19, 2003, 10:57 AM
 
Originally posted by Arkham_c:
What values does a real hold? In mathematics, a real number is a rational or irrational number (but not an imaginary number). I don't think this could be what it is in Delphi, since no programming language that I am aware up (save something like Mathematica or Maple) supports irrational number. Does the "real" support decimals? If so, it's a float. If not, I'd guess a double.
Uhh...isn't a double just a higher precision float?
[Wevah setPostCount:[Wevah postCount] + 1];
     
Arkham_c
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Aug 19, 2003, 11:42 AM
 
Originally posted by Wevah:
Uhh...isn't a double just a higher precision float?
Yes, double is a high-precision float. I meant to say long but was reading the title while typing and entered it incorrectly.
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
Wevah
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Aug 20, 2003, 12:09 AM
 
Word. I'd half-thought I'd gone bananas.
[Wevah setPostCount:[Wevah postCount] + 1];
     
Gul Banana
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Aug 20, 2003, 07:32 AM
 
Originally posted by Arkham_c:
no programming language that I am aware up (save something like Mathematica or Maple) supports irrational number
Haskell, for example.
[vash:~] banana% killall killall
Terminated
     
   
 
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -4. The time now is 11:23 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,