Why is it invalid to add a period after a variable name to make it a float?


#22

Actually, there’s no separate math coprocessor since the i386. The floating-point unit (FPU) is integrated into the CPU itself.

Furthermore, the FPU deals with floating-point operations (and not “number operations”).
Integer math is performed by the integer units. Floating-point and high-level math operations, like trigonometric functions, logarithms, roots are offloaded to the FPU.

Regarding real numbers: any number that can be expressed in the form of (a+ib) is a real number.
You can’t store a real number on a computer, because they have an infinite number of decimal places. Floating point is a CS-concept, an approximation that uses a finite number of places.
So no, you can’t compare floats (a computer science concept) and real numbers (a math concept).


#24

I used the method float() to get the result in float, float(cucumbers). but it is still not working in my case.