why do i get a strange number (1 Viewer)

rainbows

Registered User.
Local time
Today, 13:33
Joined
Apr 21, 2017
Messages
425
i have just noticed a strange number in my allocation field ""9.999999E-0" yet in other records it seems to be ok i have took a screen shot of the table . to see the properties

can you please advise what i have not done correctly

thanks

steve


1673712850141.png


1673712968588.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 21:33
Joined
Sep 21, 2011
Messages
14,374
So what is the format in the other tables?
 

isladogs

MVP / VIP
Local time
Today, 21:33
Joined
Jan 14, 2017
Messages
18,252
That means its 0.09999....
Change the format property to Fixed in the table property sheet and the decimal places to e.g. 2
 

ebs17

Well-known member
Local time
Today, 22:33
Joined
Feb 7, 2020
Messages
1,953
You use Single as the data type. Single and Double are floating point numbers. Depending on how the values are generated, there may be slight changes.

Fixed-point numbers, such as those implemented by Currency and Decimal, are safer to use.
 

rainbows

Registered User.
Local time
Today, 13:33
Joined
Apr 21, 2017
Messages
425
sometimes the allocation could be 0.001decimal places
and now if i click on that field the same number appears but when i click of it it goes to 1


1673722332349.png



1673722363000.png


1673722391601.png
 

AccessBlaster

Registered User.
Local time
Today, 13:33
Joined
May 22, 2010
Messages
5,985
What happens if you expand the control (make it longer) does the number react? It's the "E" in the control that makes me curious.

1673725730861.png
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 15:33
Joined
Feb 28, 2001
Messages
27,253
This kind of problem occurs due to the fact that decimal fractions very rarely come out even in binary. Numbers like 1/2, 1/4, 3/8, etc. come out even because 1/8, 1/4, and 1/2 are all rational fractions in binary.

When you directly open the table (which it appears that you are doing), you often look directly at the number as it is stored. In your post #1, there was no Format listed, so you used the default for the data type, which is scientific notation. In that case, 9.9999...9999E-02 is .099999...99, which might be the closest that the binary fraction can come to 0.10 in that context. Thus, adding a format helps - except when you open the table directly and place focus directly on that field, your formatting behaves oddly again. That is because (if I recall this correctly) when a field has focus in a table view, formatting doesn't apply. You see the "true" number. But if you tabbed elsewhere, the field should revert to its correct format.
 

cheekybuddha

AWF VIP
Local time
Today, 21:33
Joined
Jul 21, 2014
Messages
2,296
ebs17 gave you the solution in Post #4.

Change the field size property from 'Single' to 'currency'
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 04:33
Joined
May 7, 2009
Messages
19,246
you may also try Decimal data type and Scale = 3.
 

rainbows

Registered User.
Local time
Today, 13:33
Joined
Apr 21, 2017
Messages
425
thank you to everyone
this worked ok

you may also try Decimal data type and Scale = 3.

steve
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:33
Joined
Feb 19, 2002
Messages
43,385
I don't know if this is still true, but there used to be some serious problems with the Decimal data type aside from it taking way more space than Currency.


Keep in mind that Currency is both a format and a data type. As a data type it is a scaled integer. That means it is an integer data type with four decimal places. So. 123.45 is stored as 1234500 and is divided by 10000 to display. This avoids ALL floating point issues caused by single and double. I always use the Currency data type for all numbers where I need decimal places but not more than 4.

Before you commit to using Decimal, I suggest that you determine if the bug still exists.
 

rainbows

Registered User.
Local time
Today, 13:33
Joined
Apr 21, 2017
Messages
425
i was a liitle confused when i put the either currency , decimal ets . when i put currency it put the £ sign infront of the number so thats why i put

decimal

or am i doing it wrong?

thanks steve

1673797181407.png


1673797264419.png



1673797343350.png
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:33
Joined
Feb 19, 2002
Messages
43,385
Choose Currency as the data type rather than Number. You can format it however you want. Use standard if you don't want the currency symbol. Use Percent if the value is a percent. When your numeric data includes decimal places, usually having a fixed number of places results in a neater look.
 

Users who are viewing this thread

Top Bottom