floating-point tag

14 questions


1 answers
91 views
0
I want to change the string from Python to float or int

From Python30.33333 to float 30.333330 like int 30What should I do to change my brother?


1 answers
87 views
0
How can I determine if the string is a number (integer plus real numbers) in Python?

If you use isdigit(), only the integer is true, and the real type shows FalseI don't think there's anything like isfloat() what should I do?


1 answers
150 views
0
Why does 0.1f become 10 times slower if you change it to zero

When I ran it on Visual Studio 2010 SP1,Source Code 1 operates about 10 times faster than Source Code 2.There are only two lines that change. I don't think there's much differenceWhy is the performanc...


1 answers
71 views
0
To divide two integers and save them as prime numbers?

I thought 0.5 would come out if I said 1/2, but 0 came outIf you divide two integers, you just cut off the decimal pointWhen a and b are int c = a/bHow do we get c to float as a result?a = 1b = 2print...


1 answers
118 views
0
I want to change it to a string without any unnecessary parts such as zero below the decimal point when I print out the real number, what should I do?

On 64-bit operating systems, double represents up to +-253. Until 53I'm using double because I think the size of the number I'm expressing is about unsigned 32-bit Integer. The problem is that even if...


2 answers
138 views
0
How do I write float instead of an integer in the step of range()?

Can I increase from 0 to 1 by 0.1 by using range()?Since you write range(0,1,0.1), the step can only receive an integer.for i in range(0, 1, 0.1): print ifor i in range(0,1,0.1):TypeError: range() int...

1 years ago

1 answers
107 views
0
GCC does not optimize a*a*a*a*a*a to (a*a*a)*(a*a*a).

As far as I know, the compiler optimizes power(a,2) to a*apow(a,6) does not optimize, but calls the library function pow().The C++ Intel Compiler optimizes you to 6Why does the GCC C compiler optimize...


1 answers
117 views
0
How to change float to int in Java

float a=8.61f; int b; b=(int)a;This is how you change float to int. It's not accurate. The value of b is 8, but it's supposed to be 9.And when the value of a is -7.65f, the result is -7, not -8 What s...

1 years ago

1 answers
108 views
0
How to Round to Second decimal place

In C language, float type such as 37.7777779 37.777779 -> How do I round to the second decimal place, such as 37.78?


1 answers
123 views
0
Why don't you use Double and Float to mark money?

I was told not to use double or float when marking money. Why is that?I think there must be a good reason, but I don't know why.

1 years ago
- 1 - »

© 2024 OneMinuteCode. All rights reserved.