Details
-
Sub-task
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.7.5
-
None
-
Ambari:Ambari-2.7.5
OS: OpenEuler-22.03
Python: Python 3.9.9
Description
in python2, divide operator function as follows:
5 / 2 = 2
5.0 / 2.0 = 2.5
in python3, divide operator function as follows:
5 / 2 = 2.5
5.0 / 2.0 = 2.5
which means that in python2, the function of divide operator is depended on the data type.
If inputs are Integers, it becomes integer division.
If inputs are floating point number, it becomes float division.
in order to perform the same function of python2 divide in python3, I would like to define a util funtion named "py2Divide(val1, val2)" to do this: