floating-point-conversion
Assigning a float value to variable
I want to store 1.222 in the variable a.But when i print it is showing me 1.222000 which means that the variable a is stored as 1.222000.But i want to store the value as 1.222 in[详细]
2023-03-29 15:50 分类:问答Size of int and float
I have a question about the ranges of ints and floats: If they both have the same size of 4 bytes, why do they have different ranges开发者_StackOverflow社区?They are totally different - typically int[详细]
2023-03-28 16:26 分类:问答C - how to divide floats?
I get input from command line as a int d. Now I am facing this problem: float a,b; int d; float piece; printf(\"Please enter the parts to divide the interval: \");[详细]
2023-02-14 10:20 分类:问答floating point rounding errors
The output is x=1000300y=1000000,z=1000300 I can understand how I got x and z but c\'s y\'s output makes no sense.[详细]
2023-02-12 10:22 分类:问答problems in floating point comparison [duplicate]
This question already has answers here: strange output in comparison of float with float literal (8 answers)[详细]
2023-01-20 20:37 分类:问答Confusion with floating point numbers
int main() { float x=3.4e2; printf(\"%f\",x); return 0; } Output: 340.000000// It\'s ok. But if write x=3.1234e2 the output is 312.339996 and if x=3.12345678e2 the output is 312.345673.[详细]
2023-01-18 14:44 分类:问答Overflow Questions on floats and floats × integers
1) Is this unoverflowable? long long v1, v2, result; [..] result = ((long double) v1 / v2) * 1000000LL; 1.a) Can I leave out the LL on the constant? And why.[详细]
2023-01-10 23:05 分类:问答Limit floating point precision?
Is there a w开发者_JAVA技巧ay to round floating points to 2 points? E.g.: 3576.7675745342556 becomes 3576.76.round(x * 100) / 100.0[详细]
2023-01-09 14:47 分类:问答convert int to float to hex
Using scanf, each number typed in, i would like my program to print out two lines: for example byte order: little-endian[详细]
2022-12-17 19:24 分类:问答C - Serialization of the floating point numbers (floats, doubles)
How to convert a floating point number into a sequence of bytes so that it can be persisted in a file? Such algorithm must be fast and highly portable. It must allow also the开发者_开发百科 opposite o[详细]
2022-12-12 02:15 分类:问答