Hi all!
First of all, I've been using Ember+ for years now and I am a big fan of the protocol. It does a lot of things right that modern waves of json over http seem to have forgotten.
I am currently working in a JVM environment, so we do not have the luxury of using libember without creating some foreign language bindings for it or running some protocol server. However, given that you are based on S101/ASN.1/X.690 this isn't necessary since great tools exist that perform this encoding/decoding native on the JVM with excellent performance (at least as good as you need if you're on the JVM in the first place).
This has worked great for many years, however, currently we're working on providing support for real value encoding. And this is where things become a big confusing.
From the documentation:
Real values must be encoded in binary form [X.690 8.5.6], base 2 [X.690 8.5.6.2]. Maximum precision shall be double (64 bit).
This makes perfect sense, and it also very nicely ensures that existing X.690 frameworks can both decode and encode Ember+ reals. In practice, base 8, 10, and 16 are very uncommon anyways.
As an example I've found a good example here:
(page 4, examples of encoding real values in ASN.1).
The value of 0.15625 is encoded as 80 FB 05. This is also in agreement with other
ASN.1 tools I have tried, such as wireshark's S101 protocol. And it's an easy to follow example.
However, by using libember the same value is encoded as 80 FD 05.
So there's a difference here. FD is -3 in two's complement, which seems like a strange exponent given that the mantissa is 5. By using EmberViewer and wireshark it seems like there's a pattern where the exponent has a different value than what other ASN.1 tools suggest. By inspecting the libember code it seems like the IEEE754 exponent is just shifted by 1023 without taking into account that the mantissa is represented differently in the normal domain of IEEE754 and ASN.1. But I am not an expert in libember, so please correct me if I am wrong...
Anyways, I am a bit lost in my tracks right now given that apparently no ASN.1 implementations except for libember-based ones are able to work with e.g. ember-viewer for real values.
I am not sure what I am looking for in terms of a response here, but if somewhere in my analysis I've just misunderstood something, or if I am making false assumptions please let me know. I am just looking to clarify this discrepancy, and would appreciate all help I can get doing so.
Cheers!