Questions tagged [single-precision]

57 questions
0
votes
1 answer

What is the equivalent of Matlab/Octave single type cast function in Python

I have received the data from a socket. In Matlab, this data is converted into single precision by the following function data_cal_rx = typecast(data_tcp2, "single"); Now I would like to have the same function in Python. Searching from google and…
fpga
  • 11
  • 1
  • 4
0
votes
1 answer

Why does the floating point representation of 0.1 end in 1?

I've been writing a decimal to single-precision IEEE754 floating-point converter, and I found a few discrepancies with numbers like 0.1 and 0.2 Let's take 0.1, the first step would be converting it into a simple binary representation (multiplying…
Soumil
  • 101
  • 1
0
votes
1 answer

Trouble grasping "error due to conversion" in single-precision IEEE-754 when attempting to represent 2^(-23)

Let me preface the question by saying that I understand why values such as 0.1, 3.14, 0.2, and other values not composable of combinations of powers of two are ultimately unrepresentable by IEEE-754 formats, and that they may only be approximated as…
bool3max
  • 2,748
  • 5
  • 28
  • 57
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
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
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
  • 29
  • 1
  • 7
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
  • 177
  • 2
  • 10
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,757
  • 2
  • 26
  • 46
0
votes
0 answers

Detect if floating point number is too big (overflow)

I'm starting with MIPS and have been assigned a homework in which I have to find the hypotenuse of a triangle given its legs (all of them are single precision floating point numbers). However, in every step I have to check for overflow, by comparing…
0
votes
0 answers

How computer shows us the result of 0.7 when we add 0.1 and 0.6 in calculator?

1) As I know, the computer converts the decimal numbers to binary digits and transacts as it. For example, when we add the decimal numbers like "12" and "37" in computer's calculator. Is it correct? 2) If first of my question is correct, how the…
0
votes
0 answers

fftw double precision to single precision

I already have fftw-2.1.5 on my system. How can I change it from double precision to single precision and do I need to reinstall it? Any help would be much appreciated.
Soheil
  • 193
  • 4
  • 10
0
votes
1 answer

How do I convert a big number (e.g. 1.23e29) to IEE 754 single-precision floating-point format?

I learned how to convert from decimal to IEEE 754 through here, but I have no idea of how to convert a really big number without having to divide it all by the method explained on the post. For example, I have to convert -1.5845632e29 to IEEE 754…
Mikael
  • 969
  • 12
  • 24