|
klerindias Novice
Joined: 23 Jan 2010 Posts: 37
|
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Sun Jul 22, 2012 4:12 pm |
As far as I know there's no way to change the decimal separator, CMUD uses the American format. Why you're getting that error when you try 2.1, I have no idea. What are you trying to do with that expression (store it in a variable, send it to a command/function, etc.)?
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Sun Jul 22, 2012 5:17 pm |
have your script use %replace to switch format back and forth?
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
klerindias Novice
Joined: 23 Jan 2010 Posts: 37
|
Posted: Sun Jul 22, 2012 5:49 pm |
shalimar wrote: |
have your script use %replace to switch format back and forth? |
No script.
This is result when i just doing in command line:
#show (2+2)
#show (2.1+2)
#show (2,1+2) etc. |
|
|
|
rozdwojeniejazni Wanderer
Joined: 13 Aug 2011 Posts: 74
|
Posted: Sun Jul 22, 2012 11:07 pm |
My local decimal separator is , (Poland, win7)
#sh (2+2) -> 4 working
#sh (2.1+2) -> 4.1 working
#sh (2,2+2) -> illegal character in expression: ,
Everything is right. I see no dependency on system settings. |
|
|
|
klerindias Novice
Joined: 23 Jan 2010 Posts: 37
|
Posted: Sun Jul 22, 2012 11:48 pm |
Hmm, so where i have to look to solve this.
When i changed decimal separator to .
My result as follow:
#show (2+2)-> 4
#show (2.1+2)->4.1
#show (2,1+2)->illegal character in expression: ,
I dont want change local settings.
Why it not works?
Win7x64 EN with polish(programmer) keyboard |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Mon Jul 23, 2012 12:48 am |
I suspect the problem is the local Windows settings, but I'm not sure. Cmud does not have any internal method of changing the decimals to use a comma, so it may be an interaction between Windows and Cmud.
|
|
|
|
klerindias Novice
Joined: 23 Jan 2010 Posts: 37
|
Posted: Mon Jul 23, 2012 7:20 pm |
So any ideas why its working this way?
I cant use . in local, because of other programs.
Need to use ,
Where i should look? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jul 24, 2012 12:18 am |
Quote: |
Where i should look?
|
CMud does not offer any sort of control over how parameters in a function call are delimited, so effectively CMud in your case cannot tell if (2,1+2) is a list of 2 parameters being passed to some function or the polish locale equivalent of 2.1+2. I don't think it's a matter of knowing/not knowing that the comma is your decimal separator, so much that in your case the decimal separator is now the same as the parameter delimiter (ie, a conflict of functionality).
Since CMud merely inherits the locale settings and doesn't let you override them (and since Windows doesn't let you customize it for individual applications to deal with stuff like this), you will have to execute your math in a different language with better locale support and then convert the results as desired. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Jul 24, 2012 1:49 pm |
One way of dealing with simple cases like this would be to use division instead of decimals, e.g.:
Code: |
#show ((%float(21)/10 + 2) |
But that will be a pain for more complicated cases. |
|
|
|
|
|