Re: GWT-client math vs. java-math

2014-08-15 Thread Oskar Stangenberg
Im not sure but i doubt the radian/degree thing is in the specs. As for the 
RPC-serialization: I dont know it the long-bits-conversion is really 
necessary - its more of a feeling that Double.toString doesnt provide the 
necessary precision in gwt but its very well possible im wrong there. We 
are using atmosphere for data transfer and our own serializer logic that 
hands around raw strings until the value is acually needed so the 
performance impact is minimal
I havent found any libraries for the trig-functions. we are using our own 
with a lookup-array

Am Donnerstag, 14. August 2014 23:26:30 UTC+2 schrieb Colin Alworth:
>
> Thanks for posting about this Oskar. The radian/degree code can likely be 
> changed (is that behavior specified as part of the Java spec?), though 
> changing RPC serialization sounds like it would come with performance 
> penalties - any comments there?
>
> What is your preferred method of resolving the trig function issues - do 
> you have a gwt-able java lib that you can suggest?
>
> On Thursday, August 14, 2014 7:36:29 AM UTC-5, Oskar Stangenberg wrote:
>>
>> Well, not every one of these things is easy to fix. Especially the 
>> trig-functions - GWT is probably using the js-internal ones - which are 
>> most likely pretty fast and good enough for client-only code. 
>> The server-impl of the trig-functions isn't even java-code - they are 
>> native functions. So their exact impl might even depend on the JRE used
>>
>> Am Dienstag, 12. August 2014 19:45:08 UTC+2 schrieb Juan Pablo Gardella:
>>>
>>> Thanks for sharing. It will very useful track each problem to GWT issue 
>>> tracker.
>>>
>>>
>>> 2014-08-12 13:09 GMT-03:00 Oskar Stangenberg :
>>>
>>>> Hi guys, we are developing a GWT-project with a lot of shared files. We 
>>>> discovered a few discrepancies in the gwt-math and server-math and wanted 
>>>> to share them for anybody else having those issues:
>>>>
>>>>- First and foremost: all native double calculations are identical 
>>>>(+ - * / %)
>>>>- All trig-functions (sin,cos,tan,asin,acos,atan,atan2) seem to 
>>>>produces slightly different results. We recommend doing your own impl 
>>>> using 
>>>>lookup-maps 
>>>>- sqrt,log and pow seem to be identical although we only tested 
>>>>sqrt thoroughly
>>>>- As far as we know all functions like max,min,abs etc are identical 
>>>>- toDegrees and toRadian are actually different because GWT uses a 
>>>>constant for 180./PI and PI/180. which changes the order of operation 
>>>>compared to java
>>>>- For serialization of doubles we strongly suggest using 
>>>>Double.doubleToLongbits and Double.longBitsToDouble. You can 
>>>> additionally 
>>>>use Long.toString(long,32) and Long.parseString(string,32) to compress 
>>>> the 
>>>>String-representation
>>>>
>>>> I hope we can help some people with this info. Especially the 
>>>> toDegrees/toRadians was very surprising to find. This issue was reported 
>>>> though and might be fixed in a future GWT-version (we tested 2.6.1).
>>>> In case you are interested how we solved the issues here is the 
>>>> open-source-part 
>>>> of our project 
>>>> <https://xp-dev.com/sc/182005/HEAD/%2FGWTCommon%2Fsrc%2Fcom%2Funiverseprojects%2Fcommon%2Fshared%2Fmath>
>>>>  so 
>>>> you can check it out
>>>> Regards
>>>> Oskar Stangenberg
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Google Web Toolkit" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to google-web-toolkit+unsubscr...@googlegroups.com.
>>>> To post to this group, send email to google-we...@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/google-web-toolkit.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


Re: GWT-client math vs. java-math

2014-08-14 Thread Oskar Stangenberg
Well, not every one of these things is easy to fix. Especially the 
trig-functions - GWT is probably using the js-internal ones - which are 
most likely pretty fast and good enough for client-only code. 
The server-impl of the trig-functions isn't even java-code - they are 
native functions. So their exact impl might even depend on the JRE used

Am Dienstag, 12. August 2014 19:45:08 UTC+2 schrieb Juan Pablo Gardella:
>
> Thanks for sharing. It will very useful track each problem to GWT issue 
> tracker.
>
>
> 2014-08-12 13:09 GMT-03:00 Oskar Stangenberg  >:
>
>> Hi guys, we are developing a GWT-project with a lot of shared files. We 
>> discovered a few discrepancies in the gwt-math and server-math and wanted 
>> to share them for anybody else having those issues:
>>
>>- First and foremost: all native double calculations are identical (+ 
>>- * / %)
>>- All trig-functions (sin,cos,tan,asin,acos,atan,atan2) seem to 
>>produces slightly different results. We recommend doing your own impl 
>> using 
>>lookup-maps 
>>- sqrt,log and pow seem to be identical although we only tested sqrt 
>>thoroughly
>>- As far as we know all functions like max,min,abs etc are identical 
>>- toDegrees and toRadian are actually different because GWT uses a 
>>constant for 180./PI and PI/180. which changes the order of operation 
>>compared to java
>>- For serialization of doubles we strongly suggest using 
>>Double.doubleToLongbits and Double.longBitsToDouble. You can additionally 
>>use Long.toString(long,32) and Long.parseString(string,32) to compress 
>> the 
>>String-representation
>>
>> I hope we can help some people with this info. Especially the 
>> toDegrees/toRadians was very surprising to find. This issue was reported 
>> though and might be fixed in a future GWT-version (we tested 2.6.1).
>> In case you are interested how we solved the issues here is the 
>> open-source-part 
>> of our project 
>> <https://xp-dev.com/sc/182005/HEAD/%2FGWTCommon%2Fsrc%2Fcom%2Funiverseprojects%2Fcommon%2Fshared%2Fmath>
>>  so 
>> you can check it out
>> Regards
>> Oskar Stangenberg
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Web Toolkit" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-web-toolkit+unsubscr...@googlegroups.com .
>> To post to this group, send email to google-we...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/google-web-toolkit.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.


GWT-client math vs. java-math

2014-08-12 Thread Oskar Stangenberg
Hi guys, we are developing a GWT-project with a lot of shared files. We 
discovered a few discrepancies in the gwt-math and server-math and wanted 
to share them for anybody else having those issues:

   - First and foremost: all native double calculations are identical (+ - 
   * / %)
   - All trig-functions (sin,cos,tan,asin,acos,atan,atan2) seem to produces 
   slightly different results. We recommend doing your own impl using 
   lookup-maps
   - sqrt,log and pow seem to be identical although we only tested sqrt 
   thoroughly
   - As far as we know all functions like max,min,abs etc are identical
   - toDegrees and toRadian are actually different because GWT uses a 
   constant for 180./PI and PI/180. which changes the order of operation 
   compared to java
   - For serialization of doubles we strongly suggest using 
   Double.doubleToLongbits and Double.longBitsToDouble. You can additionally 
   use Long.toString(long,32) and Long.parseString(string,32) to compress the 
   String-representation
   
I hope we can help some people with this info. Especially the 
toDegrees/toRadians was very surprising to find. This issue was reported 
though and might be fixed in a future GWT-version (we tested 2.6.1).
In case you are interested how we solved the issues here is the 
open-source-part 
of our project 
<https://xp-dev.com/sc/182005/HEAD/%2FGWTCommon%2Fsrc%2Fcom%2Funiverseprojects%2Fcommon%2Fshared%2Fmath>
 so 
you can check it out
Regards
Oskar Stangenberg

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.