| To: | users@xxxxxxxxxx |
|---|---|
| Subject: | Re: [cinjug-users] Re: More results from cluster run on V matrix. |
| From: | James Hurt <jhurt@xxxxxxxxxxxxxxxx> |
| Date: | Wed, 17 Nov 2004 11:37:02 -0500 |
| Delivered-to: | mailing list users@cinjug.org |
| In-reply-to: | <419A45D3.2090304@ic-institute.com> |
| Mailing-list: | contact users-help@cinjug.org; run by ezmlm |
| References: | <4198E3C9.2080105@ic-institute.com> <04F6E174-378D-11D9-A85F-00039379ECCA@ic-institute.com> <419A2A21.9020005@ic-institute.com> <419A3300.9020605@ic-institute.com> <419A45D3.2090304@ic-institute.com> |
| User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) |
James Hurt wrote: The description for StreamTokenizer includes:... Translation: Numbers in exponential format (e.g. 2.9e-17) are not correctly parsed. The exponential component is missed.
// Create the StreamTokenizer
f = new FileReader(fileName);
st = new StreamTokenizer(f); // Modify it to turn off recognition of numbers
st.ordinaryChars('0', '9');
st.ordinaryChars('-', '-');
st.ordinaryChars('+', '+'); // Modify again so these chars are recognized as word
st.wordChars('0','9');
st.wordChars('-','-');
st.wordChars('+','+'); // Inside the nextToken loop
int tokenType = st.nextToken();
if (tokenType == StreamTokenizer.TT_WORD) {
// Is this a number or not?
double nval = 0.0;
try {
nval = Double.parseDouble(st.sval);
// Is a number, treat as such
...
} catch (NumberFormatException e) {
// Not a number - treat as a word
...
}
} else {
// Neither a number nor a word
...
}Comments: 1. The method parseNumber() is a do-nothing method. This is the default and there is no easy way (see above code) to turn this option off. 2. The parsing of numbers in StreamTokenizer is defective according to the Java Language specification and needs to be repaired. How do I go about seeing that this repair gets performed? -- James Hurt Vice President Research & Development Internet & Computer Institute Phone: 513-271-4249 |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [cinjug-users] Re: More results from cluster run on V matrix., James Hurt |
|---|---|
| Next by Date: | Re: [cinjug-users] Links, Brian K Bonner |
| Previous by Thread: | Re: [cinjug-users] Re: More results from cluster run on V matrix., James Hurt |
| Next by Thread: | Apache/Tomcat web server certificates, Jason Kretzer |
| Indexes: | [Date] [Thread] [Top] [All Lists] |