[x3d-public] Ran into an interesting diff, X3DJSAIL JavaScript development, trailing 0s issue again.

Don Brutzman brutzman at nps.edu
Wed Apr 5 00:08:00 PDT 2017


OK now added to ConfigurationProperties, default is to strip trailing zeroes but now overidable for regular output:

ConfigurationProperties.setStripTrailingZeroes(boolean) and isStripTrailingZeroes()

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html#setStripTrailingZeroes-boolean-

http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/ConfigurationProperties.html#isStripTrailingZeroes--


On 3/31/2017 3:47 PM, John Carlson wrote:
> Can you make it a configuration property as to whether trailing zeroes are stripped on not?
>
> Thanks,
>
> John
>> On Mar 31, 2017, at 6:39 PM, Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu>> wrote:
>>
>> cc: x3d-public
>>
>> On 3/31/2017 12:38 PM, yottzumm at gmail.com <mailto:yottzumm at gmail.com> wrote:
>>> I don’ think the trailing 0 issue is finished yet.  Perhaps remove the feature?  It’s of little utility, I think.
>>>
>>> JS is not attached.  But original XML and XML produced from JS/Nashorn (X3DJSAIL) is.  Perhaps run the original through X3DLoader, dump to file and compare?  There should be a difference in small numbers.
>>
>> Excellent catch, as your excerpts show it was not handling exponents for scientific notation properly.  Now fixed.
>>
>> Incidentally these functions are exposed for X3DJSAIL programmer use.  I refactored them to be even more convenient, either providing a current value or else (via static method) converting any other value.
>>
>> ======================
>> Class org.web3d.x3d.jsail.fields.SFFloatObject
>> public java.lang.String stripTrailingZeroes()
>> public static java.lang.String stripTrailingZeroes(float value)
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFFloat.html#stripTrailingZeroes--
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFFloat.html#stripTrailingZeroes-float-
>>
>> Class org.web3d.x3d.jsail.fields.SFDoubleObject
>> public java.lang.String stripTrailingZeroes()
>> public static java.lang.String stripTrailingZeroes(double value)
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFDouble.html#stripTrailingZeroes--
>> http://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/jsail/fields/SFDouble.html#stripTrailingZeroes-double-
>>
>> Utility method to strip trailing fractional zeroes from double value First converting an integer (such as 100) to String results in trailing decimal point and zero (such as 100.0) which then allows rest of regex filter to work.
>> ======================
>>
>> Fixed and deployed, hope your next tests run clean on this one!


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list