Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing a File with Hexadecimal Floating Point Constants in MATLAB
    primarykey
    data
    text
    <p>I am trying to parse a file containing some floating point test vectors in MATLAB.</p> <p>Here is part of the file:</p> <pre><code>b32+ +1.7FFFFFP127 -1.7FFFFFP127 +0.0P0 b32+ +1.000000P0 -1.6D0976P9 -1.6CC976P9 b32+ +1.000000P-126 -1.000000P-126 +0.0P0 b32+ -1.7FFFFFP127 +1.7FFFFFP127 +0.0P0 b32- -1.7FFFFFP127 -1.7FFFFFP127 +0.0P0 b32- +1.000000P0 -1.000000P0 +1.000000P1 b32- -1.7C3AB6P14 +1.000000P0 -1.7C3CB6P14 b32- +1.2F0948P14 +1.000000P0 +1.2F0748P14 b32- -1.000000P-126 +1.000000P-126 -1.000000P-125 b32- +1.000000P-126 +1.000000P-126 +0.0P0 b32- -1.000000P-126 +1.0410ADP-103 -1.0410AEP-103 b32- +1.7FFFFFP127 +1.7FFFFFP127 +0.0P0 b32* +1.12D2C6P92 -1.000000P0 -1.12D2C6P92 b32* +1.7FFFFFP127 -1.000000P0 -1.7FFFFFP127 b32* -1.7FFFFFP127 +1.000000P0 -1.7FFFFFP127 b32* -1.5FEA32P-51 +1.000000P0 -1.5FEA32P-51 b32* -1.000000P-126 +1.000000P0 -1.000000P-126 b32* -1.000000P0 +1.000000P0 -1.000000P0 b32* +1.000000P0 +1.000000P0 +1.000000P0 b32* +1.000000P-126 +1.000000P0 +1.000000P-126 b32* +1.000000P-126 +1.7FFFFFP127 +1.7FFFFFP1 </code></pre> <p>Basically I don't know how to parse this file because of the mixed data type.</p> <p>There are three possible floating point operations shown in this file (addition: b32+, subtraction: b32-, and multiplication: b32*). The first two numbers are the operands and the last number is the result.</p> <p>I want to format the numbers in 32-bit floating point format afterwards (which I could figure out probably). The issue is that I don't know how to get things like 'b32+', and then the numbers into variables in order to convert them into standard floating point format.</p> <p>I plan to implement an algorithm for the numbers where it looks at the sign (+/-) and sets the sign bit based upon that. Looks at the hex between the '.' and the 'P' and sets that as the significand. Then take the number after the P as the unbiased exponent. Then I plan to repeat this procedure for the other numbers.</p> <p>Thank you!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload