# Using float number more than 10 digit

 10 October 2017 jabermax2 PRO portfolio Jaber Zaker Joybari Iran Using float number more than 10 digit Hi everybody If i need a number more than 10 digit like  (  a = 0.12345678910  ) how should i do that ? formattedPrint of the number will show more accurate number but it is in string and if i execute the string again it get back to normal number. share quote
 10 October 2017 Archangel35757 Expert portfolio Michael Lawler Engineer Madison, USA what you want exceeds the accuracy/precision for floats.  And if I recall correctly, maxscript by default prints floats out to 6 decimal places... to go beyond that is pointless. share quote
 10 October 2017 PolyTools3D Expert   portfolio Jorge Rodríguez Argentina 3DS Max does support double float precision since a long time ago. However, as soon as you do some "real" stuff, everything is rounded to float.   But you can do your math using double values and then use the result to do some other stuff. It should be more precise than using float values. `````` (     a = double 0.000000001     b = double 0.000000001     format "DOUBLE: %\n%\n\n" (a+b) (formattedprint (a+b) format:".10f")          a = float 0.000000001     b = float 0.000000001     format "FLOAT: %\n%\n\n" (a+b) (formattedprint (a+b) format:".10f") )`````` __________________ Jorge Rodríguez PolyTools3D share quote
 10 October 2017 PolyTools3D Expert   portfolio Jorge Rodríguez Argentina Here is a better example of working with float and double values. As you can see, cumulative errors are not minor and lead to very different results. `````` (     af = float 0.031565        -- 0.031565f     bf = float 0.015988        -- 0.015988f     cf = float 0.098796        -- 0.098796f          ad = af as double        -- 0.031565d0     bd = bf as double        -- 0.015988d0     cd = cf as double        -- 0.098796d0          f = 0f     d = 0d0          for j = 1 to 10000 do     (         f += af + bf + cf         d += ad + bd + cd     )          clearlistener()          format "CORRECT RESULT: 1463.49\n\n"     format " FLOAT: %\t\t<- WRONG\n%\n\n"   (float f) (formattedprint f format:".10f")     format "DOUBLE: %\t\t<- CORRECT\n%\n\n" (float d) (formattedprint d format:".10f")          delete objects          box pos:[f,f,f] wirecolor:red        -- Less accurate     box pos:[d,d,d] wirecolor:green        -- More accurate          max zoomext sel all )`````` __________________ Jorge Rodríguez PolyTools3D share quote

 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 On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.