On Thu, 15 Nov 2001, Shankar Unni wrote:
Thank you for your answers. > Generally, you don't want to store currencies in floating point, anyway, > and it's unfortunate that MySQL implements DECIMAL as floating point rather > than a variable-length BCD (which is exact). Yes. This is strange, because we would like to convert our applications from foxpro. It seems, we have to store these numbers as floating point, because we have to handle all currencies the same way. > However, I tried a sanity check on that number: taking a value of the order > of 100 trillion (say, US dollars - this would be of the order of 50x the > amount of the current US annual budget), converting it to, say, Turkish > Lire (150000x), I get a number that barely exceeds the signed 64-bit limit, > and definitely fits in an unsigned 64-bit number. > > For Italian lire, the number is a hundred times smaller, and should be well > within reach of 64-bit computation. > > Are you absolutely *sure* you can't stick to a 64-bit number? Are you > really dealing with hundreds of quadrillions of US dollars? We would like to prepare the system to handle extreme values without errors. To store the annual money circulation of an huge Hungarian company, we must use 12+2 digits at least 123.456.789.012,12 HUF and the system should convert it to ITL, USD etc. This way it exceeds the system's limit, and we cannot use integers, because we need to store fractions too. If we would multiply by 10000, we would get this: (Right now there is no real demand to count with these numbers, but what if it occurs in the future...) mysql> create table try (money decimal(20,2)); mysql> insert into try values (1234567890123456.12); mysql> select * from try; +---------------------+ | money | +---------------------+ | 1234567890123456.00 | +---------------------+ 1 row in set (0.00 sec) Of course this is the biggest number we plan to handle, and this is the worst case we would like to convert, and this could be only a subconscious fear. Thank you again, Gyulay Gabor ps. I tried this under foxpro, and got the same result. So the problem existed in our previous system, and we haven't even know about it. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php