开发者

Passing Decimals with Protobuf across services

开发者 https://www.devze.com 2023-02-07 05:30 出处:网络
We have proto messages that ideally would contain a decimal as a 开发者_如何学JAVApart of the message.This proto file is being used by both a Java and a .NET client.

We have proto messages that ideally would contain a decimal as a 开发者_如何学JAVApart of the message. This proto file is being used by both a Java and a .NET client.

Since we cannot use decimal, what would the recommended approach be for passing these values?


How many significant digits?

If you know ahead of time, you could use a fixed-point representation, e.g. an integer which is treated as units of 10-6 or whatever is most appropriate.

If not, well, there's string…

0

精彩评论

暂无评论...
验证码 换一张
取 消