why do i get a strange number

rainbows

Registered User.
Local time
, 17:14
Joined
Apr 21, 2017
Messages
428
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
 
So what is the format in the other tables?
 
That means its 0.09999....
Change the format property to Fixed in the table property sheet and the decimal places to e.g. 2
 
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.
 
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
 
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
 
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.
 
you may also try Decimal data type and Scale = 3.
 
thank you to everyone
this worked ok

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

steve
 
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.
 
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
 
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

Back
Top Bottom