Welcome to WebmasterWorld Guest from 23.20.223.88

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MySQL Float Type help!

Float[(m,d)]

     
5:44 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]

A small (single-precision) floating-point number. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38. If UNSIGNED is specified, negative values are disallowed. M is the display width and D is the number of significant digits. FLOAT without arguments or FLOAT(p) (where p is in the range from 0 to 24) stands for a single-precision floating-point number.

What is display width and what is significant digits?!

Can anyone give me some examples. thank you.

8:34 pm on Aug 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure what is display width, but

D is the number of significant digits. Significant digit is the first number after zeros, so
0,0000324 it's 3
1000,0002 it's 1
0,90001 it's 9
In above example the number of significant digits was: 3; 8; 5 correspondedly.
The more significant digits the better precision and more numbers you can write.

I think that M - the display width is how many digits will be returned on the query:
M = 3; then we get: 3.24E-5; 1.00E3; 9.00E-1
I'm not sure for that one however - you'll have to check on your own or somebody else will answer.
Best regards
Michal Cibor

4:43 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for your reply. getting better understanding.

In the above case, it is a float number.

So for

3.145

how would you calculate the significant digit?

5:35 pm on Aug 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



for 3.142 it's 4 significant digits
for 3.1416 it's 5
for 3.141592 it's 7
but as well for 0.00000003141592 it's 7 significant digits (zeros at the beginning don't count)
However 3.000000 it's 7
and 3000000 it's as well 7

So beginning zeros don't count, but trailing zeros do count!

In the 5th example you see that the value is 3 up to the 6th place
If you would write it as 3 it could mean that it is something between 2.5 and 3.499999... whereas 3.000000 is between 2.9999995 and 3.0000004999...

Best regards
Michal Cibor

PS. Writing this I recall my Measures teacher who said - don't measure your best - measure good! :)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month