Closed RookieT0T closed 1 month ago
Is this just for better readability? I extracted the bits stored in memory and the bits were exactly "1.01.10.110000000000000000000000000"
@RookieT0T does this help?
https://github.com/stillwater-sc/universal/blob/main/docs/posit-refinement-viz.md
If this documentation needs more articulation, let me know.
The posit decode was designed before the final spec was rectified, In the early days, we did the two's complement to get to the regime/exponent/fraction bits.
@RookieT0T
Here is the output of the posit manipulator test:
The to_binary() and color_print() methods are showing the posit components. The get() method gets you the raw bits.
Oh, I see. Given the same value, what is returned by to_binary() is different from the raw bits stored in the memory. Thanks for your clarification.
I believe arithmetic operations of this library are based on the raw bits instead of things printed out from to_binary(), right?
@RookieT0T, correct. The posit arithmetic type uses posit encodings for storage and implements value arithmetic, so it can be used as a plug-in replacement for native float and double.
@RookieT0T The regression suite for posits will give you a sense of what you can do with the posit<> type:
There is also a collection of application skeletons that you can look at. When we do mixed precision studies for computational science or engineering, we typically take a posit, a cfloat, a fixpnt, and potentially an lns to track precision, accuracy, and performance.
thanks for pointing them out
posit<32, 2> temp = -2.5; std::cout << to_binary(temp) << std::endl;
In this case, to_binary() function returns "0b1.10.01.010000000000000000000000000", I am not sure if this is valid. It seems incorrect because the function first encodes the positive number 2.5 and assigns 1 to the most significant bit to make it negative. I am skeptical about this process because 2's complement needs to be used for encoding or decoding negative posit numbers. I believe "1.01.10.110000000000000000000000000" is the encoded binary for -2.5.
I am an undergraduate right now and new to posit. This is my naive thought. If it is not a bug, some explanation is much appreciated.