Questions tagged [single-precision]

46 questions
1
vote
1 answer

large integer to single point float

Im trying to convert a large integer to a 32 bit single precision float but I can't get past this problem I'm having. What if the binary representation of the big integer is larger than the 23 bit mantissa. For example, take the integer…
1
vote
1 answer

Strange result when taking 2 single-precision figures away from each other in VBA

Can anyone explain me why the result of the below does not equal zero? ? CSng("0.199881939681229") ? CSng(0.1998819) ? CSng(CSng(0.199881939681229) - CSng(0.1998819)) 1st line returns 0.1998819 2nd line returns 0.1998819 too but the 3rd returns…
PaMcD
  • 103
  • 11
1
vote
1 answer

Decimal to IEEE Single Precision Floating Point

I'm interested in learning how to convert an integer value into IEEE single precision floating point format using bitwise operators only. However, I'm confused as to what can be done to know how many logical shifts left are needed when calculating…
Andrew T
  • 723
  • 3
  • 11
  • 19
1
vote
2 answers

Why is 8099.99975f != 8100f

Edit: I know floating point arithmetic is not exact. And the arithmetic isn't even my problem. The addition gives the result I expected. 8099.99975f doesn't. So I have this little program: public class Test { public static void main(String[]…
IchBinKeinBaum
  • 1,434
  • 2
  • 17
  • 24
1
vote
1 answer

How are double-precision floating-point numbers converted to single-precision floating-point format?

Converting numbers from double-precision floating-point format to single-precision floating-point format results in loss of precision. What's the algorithm used to achieve this conversion? Are numbers greater than 3.4028234e+38 or lesser than…
0
votes
1 answer

Arduino convert float to hex IEEE754 Single precision 32-bit

I would like to convert float values ​​to IEEE754 Single precision 32-bit Hex values ​​in the following site on Arduino. https://www.binaryconvert.com/result_float.html?decimal=051046049048 float f = 3.10; byte hex[4] = {0}; byte FloatToHex(float…
0
votes
2 answers

Floating point to binary using IEEE 754

Hello there I need to store 0.2730 using IEEE format. Now what I did was to set the sing at 0 because the number is positive. Now I thought that that since what’s before the point is 0 then I don’t have to do any conversion to it because 0 in binary…
0
votes
0 answers

How to convert 32 bit Hex to float in python?

I have this hex value 0x3e76c8b4 which I converted to float using this python code. j = float.fromhex('0x3e76c8b4') # output 1047972020.0 But using this website I get this value 0.2409999966621399, which is my desired value. I failed to find the…
0
votes
1 answer

Converting IEEE single precision to decimal

If S = 0, E = 01110011, and F = 100101 E would be 115 right? and if so would that make the exponent -12 ? If the Bias is 127.
21 Average
  • 27
  • 7
0
votes
2 answers

Why is the Exponent for Float (32 Bit) in Java -126 and not -128?

32 Bit Standard: 1 Bit for Positive/Negative value of the number. 8 Bits for the Exponent and 24 Bits for Mantisse. 8 Bits for Exponent, that means 1 * 2^7 + 1 * 2^6 + ... = 255 When the maximum Exponent is 127, then the minimum Exponent should be…
Optimal
  • 1
  • 1
0
votes
1 answer

Floating point comparision

#include int main() { float f; f = 0.4; if(f<0.4) printf("It is less"); if(f>0.4) printf("It is greater"); if(f==0.4) printf("It is equal"); } I am not able to get why the output is showing "It is…
0
votes
1 answer

How do you determine how many integers are in set S of all in 32-bit IEEE floating-point values

Could anybody explain to me what it is stating exactly? I know this basically means that it's single precision with 1bit sign, 8bit exponents and 23bit mantissa. Shouldn't the answer is just be 2 * 2^8-2 * 2^23? Edit:does 2 * 2^8-2 * 2^23 determine…
Lawdevo
  • 9
  • 6
0
votes
0 answers

why IEEE 754 single precision has exponent range from -127 to 128 but not from -128 to 127

In IEEE 754 single precision 8 bit exponent range is from -127 to 128 but not from -128 to 127
0
votes
2 answers

double precision and single precision floating point numbers?

I was wondering why double precision and single precision numbers are sometimes equal and sometimes not. For example when I have the following they are not equal: import numpy as np x=np.float64(1./3.) y=np.float32(1./3.) but the following are…
MSB
  • 123
  • 1
  • 7
0
votes
1 answer

How does converting float to double work?

double can represent every value a float can represent. Does converting float to double simply extend the mantissa by adding 0 and extend the exponent part by filling sign bits? I tested some data at http://www.binaryconvert.com/index.html. It works…
Joe C
  • 2,539
  • 1
  • 19
  • 39