Welcome, Guest
Username: Password: Remember me
Please use this forum for suggestions to the XSharp Development Team
  • Page:
  • 1

TOPIC:

F2Bin 21 Oct 2021 19:12 #20054

  • Serggio
  • Serggio's Avatar
  • Topic Author


  • Posts: 45
  • F2Bin function in VO saves float in a somehow wierd format. It is mentioned that value part of the float is saved as REAL8, that should be IEEE754, but it is not. The order of bytes differs. In X# F2Bin complies with IEEE754, but not in VO. So there is a problem if you want to unpack binary value, saved in VO app, using XSharp's Bin2F, because of differences in their format.
    I've made quite a research of the problem and found a way to get values of sign, exponent and mantissa from VO's F2Bin, so I can write a VO-style Bin2F in X# - a so to say VOBin2F() function.
    But inspite of that I'm not very sure that I can write a proper VO-style "VOF2Bin" in X#, that will be adequately understood in VO app, because for now I need such an interoperability - both VO and X# must understand each other's binary float representation.
    Robert, you've been a developer in VO team for years, maybe you have that algorythm of VO's F2Bin. It would help a lot. Thank you for any help.

    Please Log in or Create an account to join the conversation.

    F2Bin 21 Oct 2021 20:51 #20057

    • robert
    • robert's Avatar


  • Posts: 3600
  • Serggio,
    It will be VERY difficult to emulate F2Bin in X#.
    VO uses Real8 (64 bit) ieee floating point numbers, F2Bin is based on the 80bit floating point numbers that the Intel Numeric coprocessor works with.
    VO copies the Real8 to the numeric coprocessor and writes the bits from that coprocessor to the string.
    And Bin2F does the opposite: it constructs the 80bit number from the string and then converts it to 64 bits.

    I have looked everywhere but have not found a .Net library that supports the 80 bit floating point numbers that the coprocessor works with.

    And to add to this: the fact that VO uses the numeric coprocessor which has 80 bits for calculations is also the reason why some (edge case) numeric calculations return slightly different results in VO than in X#. For example a Modulus operation on 2 floating point numbers may produce slightly different results.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    F2Bin 21 Oct 2021 21:33 #20064

    • Serggio
    • Serggio's Avatar
    • Topic Author


  • Posts: 45
  • Robert, thank you!
    Now I see why there is a 15-bit exponent and not a 11-bit one. I'll try to think something out :)
    There are algorythms to convert 80-bit float to 64-bit one. Will try to emulate something like 64 -> 80 also.
    I still would like to try.

    Please Log in or Create an account to join the conversation.

    F2Bin 21 Oct 2021 21:41 #20065

    • robert
    • robert's Avatar


  • Posts: 3600
  • Serrgio,

    Maybe the intel docs about the numeric coprocessor can explain how things are stored ?

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    F2Bin 22 Oct 2021 13:39 #20085

    • Serggio
    • Serggio's Avatar
    • Topic Author


  • Posts: 45
  • I've made an X# function VOBin2F which converts VO's F2Bin() result to a float (see the attachment). As for now I'll try to avoid making a reverse function. Let it be as it is.
    Attachments:

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1