Questions tagged [single-precision]

57 questions
2
votes
1 answer

What is the application of single-precision format in the following MATLAB code?

I am imitating the following MATLAB code. actually, this code implement the eigenface method for face recognition. %You are free to use, modify or distribute this code loaded_Image=load_img(); random_Index=round(400*rand(1,1)); …
mohammad rezza
  • 324
  • 1
  • 3
  • 17
2
votes
1 answer

IEEE 64 and 32 bit float validation in OCaml

I have a string matching the following regex \-?[0-9]*\.[0-9]+ which supposedly represents a IEEE floating point number. It could be single or double precision and I know the type in advance. I need to check if it could be interpreted as a valid…
krokodil
  • 1,326
  • 10
  • 18
2
votes
1 answer

Iterate through single precision floating point numbers between [1,2)

I am working on program that requires me to iterate through all single precision floating point (23 fractions bits) numbers in the range of [1,2). I am not quite sure how to go about this. I am writing this program in C#. If someone could give me…
1
vote
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
  • 407
  • 3
  • 9
1
vote
2 answers

What is the difference between a uint8 and a single image?

I already know uint8 contains intensity values between 0 and 255 (28-1) and single contains values between 0 and 1, it is used to hold larger values without upsetting the range error. But, apart from that, are there any other differences? What is…
1
vote
0 answers

Can't replace Fortran real variables by double precision variables or more precision

I am using a known code (CAMB) which generates values like this : k(h/Mpc) Pk/s8^2(Mpc/h)^3 5.2781500000e-06 1.9477400000e+01 5.5479700000e-06 2.0432300000e+01 5.8315700000e-06 2.1434000000e+01 6.1296700000e-06 2.2484700000e+01 6.4430100000e-06…
user1773603
1
vote
1 answer

Fixed-point instead of floating point

How many bits does fixed-point number need to be at least as precise as floating point number? If I wanted to carry calculations in fixed-point arithmetic instead of floating-point, how many bits would I need for the calculations to be not less…
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117
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
  • 105
  • 13
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
  • 783
  • 4
  • 11
  • 20
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[]…
mmaag
  • 1,534
  • 2
  • 18
  • 24
1
vote
1 answer

Convert from large decimal number into floating point representation

I think I know how to convert a decimal number into IEEE 754 single-precision floating-point representation, but I want to make sure. I want to represent 3.398860921 x 10^18 in IEEE 754 single-precision floating-point representation. I know how…
user2516663
  • 99
  • 1
  • 10
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

Difference between machine precision and underflow

I don't get the difference between machine precision and underflow. Take for example the single precision system: there the machine precision is 10^-7 while the underflow is 1.18 *10^-38. That means that 1.18 *10^-38 is the smallest number you can…
0
votes
1 answer

Why does summing numbers in ascending or descending sorting change the result?

I searched the answer to this question a lot, and I found that, in my case, it's the opposite. I am trying to sum single precision float numbers in descending and ascending order to figure it out which one gives the smallest error. Intuitively I…