Bitburner equipment
However, we will first save the bits we need for rounding. Otherwise, we will shift f right 24- e bits. If e is less than -1, the floating-point number is between -½ and ½, exclusive. If e is greater than 24, shift f left e-24 bits. Also, if we are going to shift f right, we may have to round it, to get a result rounded to the nearest integer. If e is greater than 24 or less than 24, we have to shift the significand appropriately. If e is 24, our significand is correct, and we are done, so return f as the result. The exponent value is for a significand between 1 (inclusive) and 2 (exclusive), but our significand starts with a bit at 2 24. Now we have an s, an e, and an f for a value which does not overflow, so we can prepare the final value. In any of these cases, the conversion cannot be performed, and an error should be reported. If s is one, e is 32, and f is greater than 2 24 (any of the original significand bits were set), then the value overflows a signed 32-bit integer (it is less than -2 31 if the original f were zero, it would be exactly -2 31, which does not overflow). If s is 1 (the sign is negative) and e is more than 31, then the value overflows a signed 32-bit integer (it is less than or equal to -2 32). The conversion cannot be performed, and an error should be reported. If s is 0 (the sign is positive) and e is 31 or more, then the value overflows a signed 32-bit integer (it is 2 31 or larger). But, since we are only converting to an integer result, we can neglect this case, as long as the integer result is zero for these tiny input numbers.) If we were doing a general conversion to any value, we would have to handle the special case when e is zero: Subtract 126 instead of 127. (This converts the exponent from its biased/encoded form to the actual exponent. Adding 2 24 makes that bit explicit in f.) (If e is not zero, the significand implicitly has a 1 bit at its front. Otherwise, if e is not zero, add 2 24 to f.
![bitburner equipment bitburner equipment](https://oim.kbeautyhurt.pl/templates/f16dc396e088c7c707eabe9d7479e7a2/img/ce0eec3d60708e7db292151db1d01ac7.jpg)
![bitburner equipment bitburner equipment](https://fsoctz.fizjoterapiaodnowa.pl/templates/416274127132fd81d1d494b9f86816e4/img/365ea9883fd9111ab7e6256e0a1fb110.jpg)
In this case, the conversion cannot be performed, and an error should be reported. If e is 255, the floating-point object is either infinity (if f is zero) or a NaN (otherwise). We will treat these as twos-complement integers.
![bitburner equipment bitburner equipment](https://images.ffx.co.uk/tools/irwin_1923338.jpg)
Separate the 32 bits into one sign bit ( s), eight exponent bits ( e), and 23 significand bits ( f). To reproduce C’s conversion, this should be changed to round-toward-zero.) (Somebody should double-check this answer, especially border cases and the rounding of negative values.