You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Frederick Salardi (JIRA)" <ji...@apache.org> on 2008/05/21 00:08:55 UTC
[jira] Created: (MATH-206) ComplexFormat.parse doesn't parse a
double e.g. 0.0
ComplexFormat.parse doesn't parse a double e.g. 0.0
---------------------------------------------------
Key: MATH-206
URL: https://issues.apache.org/jira/browse/MATH-206
Project: Commons Math
Issue Type: Bug
Affects Versions: 1.2
Environment: Windows Vista + JDK 6
Reporter: Frederick Salardi
When running:
public static void main(String[] args) {
try {
String s = "0.0";
ComplexFormat cf = new ComplexFormat();
Complex c = cf.parse(s);
System.out.println("c = " + c);
} catch (ParseException ex) {
ex.printStackTrace();
}
}
i get the following error:
java.text.ParseException: Unparseable complex number: "0.0"
at org.apache.commons.math.complex.ComplexFormat.parse(ComplexFormat.java:307)
at complexformattest.Main.main(Main.java:26)
With integers it works correctly but support for doubles is even more important ;] (from my point of view). I downloaded the "Latest release"
Hope u fix it quick. I have a proposal but it affects much the code. Maybe You have some quick hint?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-206) ComplexFormat.parse doesn't parse a
double e.g. 0.0
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598523#action_12598523 ]
Sebb commented on MATH-206:
---------------------------
Surely the decimal "point" depends on the Locale - it may be "." or "," (perhaps there are others).
> ComplexFormat.parse doesn't parse a double e.g. 0.0
> ---------------------------------------------------
>
> Key: MATH-206
> URL: https://issues.apache.org/jira/browse/MATH-206
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: Windows Vista + JDK 6
> Reporter: Frederick Salardi
>
> When running:
> public static void main(String[] args) {
> try {
> String s = "0.0";
> ComplexFormat cf = new ComplexFormat();
> Complex c = cf.parse(s);
> System.out.println("c = " + c);
> } catch (ParseException ex) {
> ex.printStackTrace();
> }
> }
> i get the following error:
> java.text.ParseException: Unparseable complex number: "0.0"
> at org.apache.commons.math.complex.ComplexFormat.parse(ComplexFormat.java:307)
> at complexformattest.Main.main(Main.java:26)
> With integers it works correctly but support for doubles is even more important ;] (from my point of view). I downloaded the "Latest release"
> Hope u fix it quick. I have a proposal but it affects much the code. Maybe You have some quick hint?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (MATH-206) ComplexFormat.parse doesn't parse a
double e.g. 0.0
Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598623#action_12598623 ]
Luc Maisonobe commented on MATH-206:
------------------------------------
Using a no-argument constructor for ComplexFormat leads to use a default format which itself relies on the default locale as returned by Locale.getDefault(). This is a normal behavior and is the same behavior you get from parsing a single double value with functions like Double.parseDouble().
Parsing non-localized strings even in localized environments can be done by supplying the format to use to ComplexFormat, for example like this:
ComplexFormat cf = new ComplexFormat(NumberFormat.getInstance(Locale.US));
> ComplexFormat.parse doesn't parse a double e.g. 0.0
> ---------------------------------------------------
>
> Key: MATH-206
> URL: https://issues.apache.org/jira/browse/MATH-206
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: Windows Vista + JDK 6
> Reporter: Frederick Salardi
>
> When running:
> public static void main(String[] args) {
> try {
> String s = "0.0";
> ComplexFormat cf = new ComplexFormat();
> Complex c = cf.parse(s);
> System.out.println("c = " + c);
> } catch (ParseException ex) {
> ex.printStackTrace();
> }
> }
> i get the following error:
> java.text.ParseException: Unparseable complex number: "0.0"
> at org.apache.commons.math.complex.ComplexFormat.parse(ComplexFormat.java:307)
> at complexformattest.Main.main(Main.java:26)
> With integers it works correctly but support for doubles is even more important ;] (from my point of view). I downloaded the "Latest release"
> Hope u fix it quick. I have a proposal but it affects much the code. Maybe You have some quick hint?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (MATH-206) ComplexFormat.parse doesn't parse a
double e.g. 0.0
Posted by "Frederick Salardi (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Frederick Salardi resolved MATH-206.
------------------------------------
Resolution: Fixed
It works with "0,0".
But anyway doubles in java uses a dot not a comma.
> ComplexFormat.parse doesn't parse a double e.g. 0.0
> ---------------------------------------------------
>
> Key: MATH-206
> URL: https://issues.apache.org/jira/browse/MATH-206
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 1.2
> Environment: Windows Vista + JDK 6
> Reporter: Frederick Salardi
>
> When running:
> public static void main(String[] args) {
> try {
> String s = "0.0";
> ComplexFormat cf = new ComplexFormat();
> Complex c = cf.parse(s);
> System.out.println("c = " + c);
> } catch (ParseException ex) {
> ex.printStackTrace();
> }
> }
> i get the following error:
> java.text.ParseException: Unparseable complex number: "0.0"
> at org.apache.commons.math.complex.ComplexFormat.parse(ComplexFormat.java:307)
> at complexformattest.Main.main(Main.java:26)
> With integers it works correctly but support for doubles is even more important ;] (from my point of view). I downloaded the "Latest release"
> Hope u fix it quick. I have a proposal but it affects much the code. Maybe You have some quick hint?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.