berkeley-softfloat-3 | SoftFloat release 3 - John R | Math library
kandi X-RAY | berkeley-softfloat-3 Summary
kandi X-RAY | berkeley-softfloat-3 Summary
SoftFloat release 3
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of berkeley-softfloat-3
berkeley-softfloat-3 Key Features
berkeley-softfloat-3 Examples and Code Snippets
Community Discussions
Trending Discussions on berkeley-softfloat-3
QUESTION
I am trying to learn how single precision IEEE-754 multiplication works. In particular, I am looking at Berkley SoftFloat implementation - f32_mul.
Just before the multiplication of significands is performed, the implicit bit is added to the significands of each multiplier respectively. The relevant part of code is below:
...ANSWER
Answered 2018-Dec-08 at 21:32The shifts are crafted so as to have the product fitting on 63 bits available with signed integer arithmetic.
You have sigA on 24 bits, that means sigA is bounded by sigA < 2^24
.
Same for sigB: sigB < 2^24
.
Thus the product sigA * sigB < 2^48
, or in other words, you have a guaranty that it fits in 48 bits
(it is at most (2^24-1)^2=2^48-2^25+1
).
Therefore, if you shift by 15 bits (8+7), you have a guaranty that the results fits on 63 bits
Due to implied ones, you also have sigA >= 2^23
and sigB >= 2^23
, thus sigA*sigB >= 2^46
. IOW, it spans at least 47 bits.
So by shifting by 15 bits, you are sure that the results fits either on 63 bits, or on 62 bits. It does not matter how many time you shift each significand, 15+0 or 1+14 would work equally well. But with a well balanced 8+7, each one still fit on 32 bits which is clever.
In the next line, you see that the product is always adjusted to fit with most significant bit at position 63 (1-based):
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install berkeley-softfloat-3
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page