A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Why won't Single take my number?



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2010, 02:43 PM posted to microsoft.public.access.tablesdbdesign
Janie
external usenet poster
 
Posts: 100
Default Why won't Single take my number?

I have a field with NUMBER datatype, SINGLE field size, Fixed format and 0
Decimals. When I enter the value 100317090407 the number rewrites itself as
100317100000. When I enter 100317090417 again I get 100317100000. When I
enter 100317090499 once again I get 1003617100000.

My number is clearly under then max for a Single 3.402823E38, so what is
going on?

If I set my field size to DOUBLE, I do not encounter the same problem, but I
don't get it. Why do my numbers seem to have a mind of their own with the
SINGLE field size?
Ads
  #2  
Old March 17th, 2010, 03:13 PM posted to microsoft.public.access.tablesdbdesign
Allen Browne
external usenet poster
 
Posts: 11,706
Default Why won't Single take my number?

Single is a floating point number, with only around 7 significant digits.

Use Double, or Decimal.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Janie" wrote in message
...
I have a field with NUMBER datatype, SINGLE field size, Fixed format and 0
Decimals. When I enter the value 100317090407 the number rewrites itself
as
100317100000. When I enter 100317090417 again I get 100317100000. When I
enter 100317090499 once again I get 1003617100000.

My number is clearly under then max for a Single 3.402823E38, so what is
going on?

If I set my field size to DOUBLE, I do not encounter the same problem, but
I
don't get it. Why do my numbers seem to have a mind of their own with the
SINGLE field size?


  #3  
Old March 17th, 2010, 03:20 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Why won't Single take my number?

Janie

Which version of Access?

Where are you doing this? (directly in the table, via a form, ??)

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Janie" wrote in message
...
I have a field with NUMBER datatype, SINGLE field size, Fixed format and 0
Decimals. When I enter the value 100317090407 the number rewrites itself
as
100317100000. When I enter 100317090417 again I get 100317100000. When I
enter 100317090499 once again I get 1003617100000.

My number is clearly under then max for a Single 3.402823E38, so what is
going on?

If I set my field size to DOUBLE, I do not encounter the same problem, but
I
don't get it. Why do my numbers seem to have a mind of their own with the
SINGLE field size?



  #4  
Old March 17th, 2010, 04:51 PM posted to microsoft.public.access.tablesdbdesign
Janie
external usenet poster
 
Posts: 100
Default Why won't Single take my number?

Hmmm ... when reading the description of Single it sounds w-a-y different!
Up to seven decimal places and a maximum value of 3.402823 ^ 38

I get it ... I had already decided to go with Double .. but I wanted to
understand the why of the behavior.

So, bottom line is even though the maximum value is significantly higher, if
I want something grater than a 7 digit number, stay away friom Single.

Thanks for the enlightenment!
"Allen Browne" wrote:

Single is a floating point number, with only around 7 significant digits.

Use Double, or Decimal.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Janie" wrote in message
...
I have a field with NUMBER datatype, SINGLE field size, Fixed format and 0
Decimals. When I enter the value 100317090407 the number rewrites itself
as
100317100000. When I enter 100317090417 again I get 100317100000. When I
enter 100317090499 once again I get 1003617100000.

My number is clearly under then max for a Single 3.402823E38, so what is
going on?

If I set my field size to DOUBLE, I do not encounter the same problem, but
I
don't get it. Why do my numbers seem to have a mind of their own with the
SINGLE field size?


.

  #5  
Old March 17th, 2010, 05:22 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Why won't Single take my number?

On Wed, 17 Mar 2010 07:43:01 -0700, Janie
wrote:

If I set my field size to DOUBLE, I do not encounter the same problem, but I
don't get it. Why do my numbers seem to have a mind of their own with the
SINGLE field size?


The Single datatype does indeed have a range to 10^38 or so... but it only has
24 bits of precision, equivalent to about 7 digits.

If these values are some sort of identifier, i.e. a part number or the like,
and you're not going to be doing any math calculations with them, you would be
much better off storing them in a Text field (with an input mask to force all
digits if that's what you want). This is doubly the case if you want leading
zeroes.
--

John W. Vinson [MVP]
  #6  
Old March 17th, 2010, 06:45 PM posted to microsoft.public.access.tablesdbdesign
Fred
external usenet poster
 
Posts: 1,451
Default Why won't Single take my number?

Or, to put it structurally, there are two lmitations:

1. Numerical size of the number

2. # of digits of precision.

What you were trying to do complied with #1 but violated #2.


 




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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 OfficeFrustration.
The comments are property of their posters.