amirfi95 commented on PR #196: URL: https://github.com/apache/dubbo-go-hessian2/pull/196#issuecomment-3114127617
> @wongoo yeah, you are right. I had a careful check the code block, and foud dubbo-hessian-lite both support `hessian` and `hessian2`. `hessian` has only `double ::= 'D' b7 b6 b5 b4 b3 b2 b1 b0` format when encoding float and double. > > In fact, dubbo-hessian-lite encode the number depending the value, but not the type, `float(32-bit in java)` or `double(64-bit in java)`. All the float would be transform to double, and when the value is less then 3 digits after the decimal point, the number will be encoded in `x5f b3 b2 b1 b0` format. > > So what should we do? > > * Follow dubbo-hessian-lite, we should add the value judgement and deside which format to encode in `func encFloat` of `double.go`. > * Encode exactly depend on the type, we should add `func encFloat32`. Hi could you elaborate why you are decoding a double prefixed with x5f as an integer and divide it by 1000. The name BC_DOUBLE_MIL implies millis (/100) but the spec says decode it as 4 byte float and not as integer. I'm struggling to match existing implementations against the spec :/ (spec mentioning compact doubles as float : http://hessian.caucho.com/doc/hessian-serialization.html#anchor14) >::= x5f b3 b2 b1 b0 # 32-bit float cast to double @willson-chen willson-chen -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
