Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 17th, 2005, 4:25 PM   #11
ivan
Professional Programmer
 
ivan's Avatar
 
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4 ivan is on a distinguished road
No problem, DaWei, I understand you. I was pretty convinced that it was a good information but I will do some more research about that...
ivan is offline   Reply With Quote
Old Oct 19th, 2005, 1:45 AM   #12
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6 bl00dninja is on a distinguished road
how can currency and integer represent the same thing when integer deals purely with whole numbers and currency deals with floating point numbers with a 1/100th (decimal) point of accuracy? one has complete numbers, one has complete numbers + an incomplete part. basically, stay away from the crappy currency type unless all your users will only run your app, and nothing else. floating point numbers require a lot more memory and you can represent these numbers in C using "printf"...but where do the parts of pennies go? this is the stuff of "office space" and "superman 3" lore. no, the binary representation of decimal floating point numbers is stupid-complicated. and just in case you missed the important character in this case, here it is, a few hundred times.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Quote:
What is the actual use of the currency Data Type?
uhh...dealing with currency? maybe i'm mistaken, maybe it's specifically designed for fibonacci numbers??? currency data type...dealing with currency? currency is MONEY...which has a decimal precision of 1/100 in america. maybe the indians know something we don't, which is why i have "apu" trying to explain fatal errors to me.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Oct 19th, 2005, 7:35 AM   #13
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Basically I believe a currency is your regular integer, (pure binary number) but the value is understood to be shifted down x places (divided by 10^x at the end). The reason its more precise than a double is that a double is stored as a binary float in memory, akin to standard form (value + placecount or mantissa + exponent).
Rory is offline   Reply With Quote
Old Oct 19th, 2005, 7:46 AM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
The purpose of a floating point number is to provide greater range at less precision in the SAME amount of memory. One can express a larger number by writing 100E100 than one can by writing 1000000. However, one can't express as many individual numbers.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:21 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC