Scientific notation of bases other than decimal

Issue #580 invalid
Pol Welter created an issue

Try 0x5e2.

Experienced result: 1506.

Expected result: Not sure. But not 1506.

Could be

  • 1280 = 0x500
  • 500 = 0x5 * 100
  • NaN, because of ambiguity.

This seems to come from the parser deep down in floatio.c. I don't feel like digging over there...

Comments (6)

  1. Tey'

    Looks like we all missed that one :)

    For the records, the math engine support exponents for other bases (something like 0x5(+0d2) in your case), but not the parser. It also supports complement (0xsF5).

  2. Pol Welter reporter

    What exactly do you mean by complement?

    I was aware of the scientific thing, but this is new to me.

  3. Tey'

    It computes the two's complement and adds a minus sign (not sure why though). With the decimal number 5, the syntax is 0xsF5 for hexa (=> -0xB), 0bs10101 for binary (=> -0b1011) and 0os75 for octal (=> -0o3). Adding support for that in the evaluator is pretty easy, but I'm not sure there will be any uses of it.

  4. Pol Welter reporter

    I agree that this is not very useful. For computing the two's complement one should specify the bit length explicitly. For that we already have the unmask function.

  5. Log in to comment