View Full Version : Solved: Decimal Type ?

in another post about converting to binary, we have encountered a problem trying to represent a number greater than what Long can handle. Single and Double handle "larger" numbers, but not more digits. The Mod function overflows if the "A" in A Mod B is larger than the 2+ billion that a Long can handle (does not matter what type A is).

What is the story with "Decimal" type. I have encountered many references, but there is always a caveat about "not being supported".

mvidas

06-14-2005, 12:48 PM

From the help file:

Decimal Data Type

Decimal Variables are stored as 96-bit (12-byte) signed integers scaled by a variable power of 10. The power of 10 scaling factor specifies the number of digits to the right of the decimal point, and ranges from 0 to 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335. With a 28 decimal places, the largest value is +/-7.9228162514264337593543950335 and the smallest, non-zero value is +/-0.0000000000000000000000000001.

Note At this time the Decimal data type can only be used within a Variant, that is, you cannot declare a variable to be of type Decimal. You can, however, create a Variant whose subtype is Decimal using the CDec function

By the way, if you don't mind me asking, where in NY are you?

From the help file:

Decimal Data Type

Decimal Variables are stored as 96-bit (12-byte) signed integers scaled by a variable power of 10. The power of 10 scaling factor specifies the number of digits to the right of the decimal point, and ranges from 0 to 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335. With a 28 decimal places, the largest value is +/-7.9228162514264337593543950335 and the smallest, non-zero value is +/-0.0000000000000000000000000001.

Note At this time the Decimal data type can only be used within a Variant, that is, you cannot declare a variable to be of type Decimal. You can, however, create a Variant whose subtype is Decimal using the CDec function

By the way, if you don't mind me asking, where in NY are you?\

from what Help file did you extract the above. I searched for decimal type through several VBA help utilities and found nothing. Searching on Cdec (now that I know about it), lead to similar results to yours.

near Rochester.

mdmackillop

06-14-2005, 04:59 PM

It appears in Excel 2003 VBA help.

sheeeng

06-14-2005, 07:16 PM

So, mvidas (http://www.vbaexpress.com/forum/member.php?u=289) and mdmackillop (http://www.vbaexpress.com/forum/member.php?u=87), u mean that i need to redo the mod function when convert dec to bin when input too huge? Can give some ideas to solve it? Thanks.

Related Thread:

Convert Decimal To Binary http://www.vbaexpress.com/forum/showthread.php?t=3599

Thanks a lot.

mvidas

06-14-2005, 07:23 PM

It is in my excel 2k help file as well, that is where I posted it from.

We now have a third Rochester area person? How cool! JOrzech and I are both from Rochester (actually we both live and work downtown), how far outside Roch are you? I'm from Spencerport originally, I've been living downtown about 4 years.

Sheeeng,

I'll take a better look at the decimal to binary thread tomorrow when I have a few minutes.

sheeeng

06-14-2005, 10:30 PM

Thanks, mvidas (http://www.vbaexpress.com/forum/member.php?u=289).

mvidas

06-15-2005, 06:40 AM

Also for the decimal data type (though it is the exact same as above), the information is at http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/office97/html/output/F1/D6/S5B20F.asp

It is in my excel 2k help file as well, that is where I posted it from.

it is amazing how simple it is to find things when someone else gives you a hint. For reasons not clear each time I played around with a VBA search, I did not find the Decimal Type (for the 300+ secondary selections). Of course, once I did find it and clicked on it, VBA Help exploded (as it often does)

We now have a third Rochester area person? How cool! JOrzech and I are both from Rochester (actually we both live and work downtown), how far outside Roch are you? I'm from Spencerport originally, I've been living downtown about 4 years.

I haved lived in Fairport for over (egads!) 30 years

mvidas

06-15-2005, 12:16 PM

Well, unfortunately/fortunately (depending on how you look), I am still a young'n, and haven't really found a place (either around rochester or anywhere else) that I care to really settle down in yet (much less live for 30 years). I've spent a good amount of time in Fairport, so I can definately see the appeal!

I'm very excited to find out that there's another 'local' around here, and you're an Excel fan to boot!

it is amazing how simple it is to find things when someone else gives you a hint. For reasons not clear each time I played around with a VBA search, I did not find the Decimal Type (for the 300+ secondary selections). Of course, once I did find it and clicked on it, VBA Help exploded (as it often does)

I find searcfhing in Help absolutely useless, I never seem to find what I want. But ... if you type a word in the immediate window, select it, and the F1, you usually can find something. This works well for me (even though I don't live in Rochester :devil:, but I do have a friend there, Tony Bruno, long shot I know, but you don't know him perchance?).

mvidas

06-16-2005, 06:07 AM

I do have a friend there, Tony Bruno, long shot I know, but you don't know him perchance?I don't know a Tony Bruno, sorry. The name sounds familiar, but thats the extent of it. This isn't a huge city so there is always a possibility that I've seen him :)

Powered by vBulletin® Version 4.2.5 Copyright © 2019 vBulletin Solutions Inc. All rights reserved.