This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
DayCuts
Voice
Posts: 37 Joined: Tue Jun 15, 2004 8:43 am
Post
by DayCuts » Sat Aug 21, 2004 12:53 pm
I have looked through the tcl/tk help and tried using expr round(), this works of corse. However i seem unabled to round accurately to a specific X places. I have seen in a few places people use things such as [expr round(9.345) * 1.0] or similar things, but such workarounds are not very accurate as you can see simply by looking at the logic in the math.
Can anybody help me out with a more accurate method of rounding? TIA
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Sun Aug 22, 2004 2:27 pm
format %.<number of decimals>f <value>
eg:
returns 4.57
Have you ever read "The Manual"?
DayCuts
Voice
Posts: 37 Joined: Tue Jun 15, 2004 8:43 am
Post
by DayCuts » Sun Aug 22, 2004 3:13 pm
Ah, thank you user. I guess i just didn't relate format to string/math manipulation.
awyeah
Revered One
Posts: 1580 Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:
Post
by awyeah » Mon Aug 23, 2004 12:03 am
Actually its the same as in C, if you take a closer look.
%2f = 2 decimal places
%3f = 3 decimal places... and so on.
·awyeah·
==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Aug 23, 2004 6:05 am
awyeah wrote: %2f = 2 decimal places
Nope.
Have you ever read "The Manual"?