Who faced such things as converting float values to IBM Floating 32bit and back? I solve this question in Java , realizing that you need to build on concepts like mantissa, sign, exponent (judging from an article in the Wiki: IBM Floating 32bit Architecture) you get this code to find the values listed above:
public class Main { public static void main(String[] args) { float d = -157.1817f; String binaryBits = Integer.toBinaryString(Float.floatToIntBits(d)); char[] arrayCharact = new char[binaryBits.length()]; arrayCharact = binaryBits.toCharArray(); StringBuilder sign = new StringBuilder(); sign.append(arrayCharact[0]); StringBuilder exponent = new StringBuilder(); for (int k=1; k<7; k++) exponent.append(arrayCharact[k]); StringBuilder mantissa = new StringBuilder(); for (int k=7; k<31; k++) mantissa.append(arrayCharact[k]); System.out.println(sign + "\n" + exponent + "\n" + mantissa); }
}
What to do next? What to do with these variables? how correct is the approach? and whether I reason correctly, what is the translation of float in IBM Floating 32bit?
PS is not a programmer by education, but Pts will be useful for writing a disser. thank you