> for example > x = math.float(a/b + 4/3 + math.sin(3.14159/2)) > > does not truncate the result of a/b or 4/3 >
HI Alan: Thanks or you thoughts. Unfortunately, functions work with the same order of evaluation constraints. So x = float (stuff) looks internally just like temp=stuff x=float(temp) and so you would get same effects. In general, an operation does not know about things that will happen after it is done. This conceptually the same as your example 3/4 +0.5 returning 0.5, not 1.25, whereas 3.0/4.0 + 0.5 returns 1.25. This is a standard approach in programming. >> I discovered that your Help example > x = math.sin(3.14159/2) > returns your mystery internal string. > > So I suggest that Help for the Math plugin should mention > the new tostring() function in the same page, for example: > > x = tostring(math.sin(3.14159/2)) No, this is not what I would want to illustrate. The idea is the internal representation should be used since it allows faster arithmetic in susequent operations with the variable and since it avoid any lost of precision from converting to plain string. You should only use tostring when you want to display to a person. The internal representation is just the standard binary value of 8 byte double, except that whereever a byte b<=1 appears, that byte is replaced by 0x01(b+1). Then a zero byte is added at end. This way, the assignments which assume strings still work. > Attention: PowerPro's Web site has moved: http://www.ppro.org Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/power-pro/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/power-pro/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
