![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 3
![]() |
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...
|
|
|
|
|
|
#12 | |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
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:
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
|
|
|
#13 |
|
Expert Programmer
|
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).
|
|
|
|
|
|
#14 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|