286N/A * reserved comment block 286N/A * DO NOT REMOVE OR ALTER! 286N/A * Copyright 2001-2005 The Apache Software Foundation. 286N/A * Licensed under the Apache License, Version 2.0 (the "License"); 286N/A * you may not use this file except in compliance with the License. 286N/A * You may obtain a copy of the License at 286N/A * Unless required by applicable law or agreed to in writing, software 286N/A * distributed under the License is distributed on an "AS IS" BASIS, 286N/A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 286N/A * See the License for the specific language governing permissions and 286N/A * limitations under the License. 286N/A * Represent the schema type "float" 286N/A * @author Neeraj Bajaj, Sun Microsystems, inc. 286N/A * @author Sandy Gao, IBM 286N/A //convert a String to Float form, we have to take care of cases specified in spec like INF, -INF and NaN 286N/A // Can't call Float#compareTo method, because it's introduced in jdk 1.2 286N/A //distinguishes between identity and equality for float datatype 286N/A //0.0 is equal but not identical to -0.0 286N/A // NOTE: we don't distinguish 0.0 from -0.0 286N/A // This check is necessary because floatToIntBits(+0) != floatToIntBits(-0) 286N/A // NOTE: 0.0 is equal but not identical to -0.0 286N/A // NOTE: we don't distinguish 0.0 from -0.0 286N/A // this is NaN <> other 286N/A // other is NaN <> this 286N/A // NOTE: we don't distinguish 0.0 from -0.0 286N/A // REVISIT: use the java algorithm for now, because we 286N/A // don't know what to output for 1.1f (which is no 286N/A // if it contains 'E', then it should be a valid schema 286N/A // canonical representation 286N/A // at most 3 longer: E, -, 9 286N/A // expected decimal point position 286N/A // for non-zero integer part 286N/A // decimal point position 286N/A // move the digits: ddd.d --> d.ddd 286N/A // trim trailing zeros: d00.0 --> d.000 --> d. 286N/A // add the last zero if necessary: d. --> d.0 286N/A // append E: d.dd --> d.ddE 286N/A // how far we shifted the decimal point 286N/A // append the exponent --> d.ddEd 286N/A // the exponent is at most 7 286N/A // non-zero digit point 286N/A // put the first non-zero digit to the left of '.' 286N/A // move other digits (non-zero) to the right of '.' 286N/A // append 0 if nessary: 0.03 --> 3. --> 3.0 286N/A // append E-: d.dd --> d.ddE- 286N/A // how far we shifted the decimal point 286N/A // append the exponent --> d.ddEd 286N/A // the exponent is at most 3