homepage Welcome to WebmasterWorld Guest from 54.204.249.184
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
MySQL Float Type help!
Float[(m,d)]
AthlonInside




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

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.

 

mcibor




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

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

AthlonInside




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

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?

mcibor




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

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! :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved