python之浮点型类型
浮点型:float
如3.14,2.88
class float(object):
"""
float(x) -> floating point number Convert a string or number to a floating point number, if possible.
"""
def as_integer_ratio(self):
""" 获取改值的最简比 """
"""
float.as_integer_ratio() -> (int, int) Return a pair of integers, whose ratio is exactly equal to the original
float and with a positive denominator.
Raise OverflowError on infinities and a ValueError on NaNs. >>> (10.0).as_integer_ratio()
(10, 1)
>>> (0.0).as_integer_ratio()
(0, 1)
>>> (-.25).as_integer_ratio()
(-1, 4)
"""
pass def conjugate(self, *args, **kwargs): # real signature unknown
""" Return self, the complex conjugate of any float. """
pass def fromhex(self, string):
""" 将十六进制字符串转换成浮点型 """
"""
float.fromhex(string) -> float Create a floating-point number from a hexadecimal string.
>>> float.fromhex('0x1.ffffp10')
2047.984375
>>> float.fromhex('-0x1p-1074')
-4.9406564584124654e-324
"""
return 0.0 def hex(self):
""" 返回当前值的 16 进制表示 """
"""
float.hex() -> string Return a hexadecimal representation of a floating-point number.
>>> (-0.1).hex()
'-0x1.999999999999ap-4'
>>> 3.14159.hex()
'0x1.921f9f01b866ep+1'
"""
return "" def is_integer(self, *args, **kwargs): # real signature unknown
""" Return True if the float is an integer. """
pass def __abs__(self):
""" x.__abs__() <==> abs(x) """
pass def __add__(self, y):
""" x.__add__(y) <==> x+y """
pass def __coerce__(self, y):
""" x.__coerce__(y) <==> coerce(x, y) """
pass def __divmod__(self, y):
""" x.__divmod__(y) <==> divmod(x, y) """
pass def __div__(self, y):
""" x.__div__(y) <==> x/y """
pass def __eq__(self, y):
""" x.__eq__(y) <==> x==y """
pass def __float__(self):
""" x.__float__() <==> float(x) """
pass def __floordiv__(self, y):
""" x.__floordiv__(y) <==> x//y """
pass def __format__(self, format_spec):
"""
float.__format__(format_spec) -> string Formats the float according to format_spec.
"""
return "" def __getattribute__(self, name):
""" x.__getattribute__('name') <==> x.name """
pass def __getformat__(self, typestr):
"""
float.__getformat__(typestr) -> string You probably don't want to use this function. It exists mainly to be
used in Python's test suite. typestr must be 'double' or 'float'. This function returns whichever of
'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the
format of floating point numbers used by the C type named by typestr.
"""
return "" def __getnewargs__(self, *args, **kwargs): # real signature unknown
pass def __ge__(self, y):
""" x.__ge__(y) <==> x>=y """
pass def __gt__(self, y):
""" x.__gt__(y) <==> x>y """
pass def __hash__(self):
""" x.__hash__() <==> hash(x) """
pass def __init__(self, x):
pass def __int__(self):
""" x.__int__() <==> int(x) """
pass def __le__(self, y):
""" x.__le__(y) <==> x<=y """
pass def __long__(self):
""" x.__long__() <==> long(x) """
pass def __lt__(self, y):
""" x.__lt__(y) <==> x<y """
pass def __mod__(self, y):
""" x.__mod__(y) <==> x%y """
pass def __mul__(self, y):
""" x.__mul__(y) <==> x*y """
pass def __neg__(self):
""" x.__neg__() <==> -x """
pass @staticmethod # known case of __new__
def __new__(S, *more):
""" T.__new__(S, ...) -> a new object with type S, a subtype of T """
pass def __ne__(self, y):
""" x.__ne__(y) <==> x!=y """
pass def __nonzero__(self):
""" x.__nonzero__() <==> x != 0 """
pass def __pos__(self):
""" x.__pos__() <==> +x """
pass def __pow__(self, y, z=None):
""" x.__pow__(y[, z]) <==> pow(x, y[, z]) """
pass def __radd__(self, y):
""" x.__radd__(y) <==> y+x """
pass def __rdivmod__(self, y):
""" x.__rdivmod__(y) <==> divmod(y, x) """
pass def __rdiv__(self, y):
""" x.__rdiv__(y) <==> y/x """
pass def __repr__(self):
""" x.__repr__() <==> repr(x) """
pass def __rfloordiv__(self, y):
""" x.__rfloordiv__(y) <==> y//x """
pass def __rmod__(self, y):
""" x.__rmod__(y) <==> y%x """
pass def __rmul__(self, y):
""" x.__rmul__(y) <==> y*x """
pass def __rpow__(self, x, z=None):
""" y.__rpow__(x[, z]) <==> pow(x, y[, z]) """
pass def __rsub__(self, y):
""" x.__rsub__(y) <==> y-x """
pass def __rtruediv__(self, y):
""" x.__rtruediv__(y) <==> y/x """
pass def __setformat__(self, typestr, fmt):
"""
float.__setformat__(typestr, fmt) -> None You probably don't want to use this function. It exists mainly to be
used in Python's test suite. typestr must be 'double' or 'float'. fmt must be one of 'unknown',
'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be
one of the latter two if it appears to match the underlying C reality. Override the automatic determination of C-level floating point type.
This affects how floats are converted to and from binary strings.
"""
pass def __str__(self):
""" x.__str__() <==> str(x) """
pass def __sub__(self, y):
""" x.__sub__(y) <==> x-y """
pass def __truediv__(self, y):
""" x.__truediv__(y) <==> x/y """
pass def __trunc__(self, *args, **kwargs): # real signature unknown
""" Return the Integral closest to x between 0 and x. """
pass imag = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""the imaginary part of a complex number""" real = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""the real part of a complex number""" float
python之浮点型类型的更多相关文章
- 005 Python的数值类型
005 Python的数值类型 BIF 指的是内置函数,一般不作为变量命名.如 input,while,if,else,float,等等.整型:整数.(python3.0版本把整型和长整型结合在 ...
- Python的可变类型与不可变类型
Python基础知识,自己写一写比较不容易忘 Python的每个对象都分为可变和不可变,主要的核心类型中,数字.字符串.元组是不可变的,列表.字典是可变的. 对不可变类型的变量重新赋值,实际上是重新创 ...
- Python的基本类型介绍和可变不可变
Python的基本类型介绍 前言 做python有一段时间了,从工作开始就在不断地学习和积累.但是有时候用到一些技术点,甚至是基础知识的时候,总是会遗忘.所以,从今天开始,就在这里记录下来,不仅可以分 ...
- 26、Python的可变类型和不可变类型?
Python的每个对象都分为可变和不可变 可变:列表.字典 不可变:数字.字符串.元祖 对不可变类型的变量重新赋值,实际上是重新创建一个不可变类型的对象,并将原来的变量重新指向新创建的对象(如果没有其 ...
- python的变量类型(Day6)
Python的变量类型 变量可以指定不同的数据类型,这些变量可以存储整数,小数或字符. 变量赋值 Python 中的变量赋值不需要类型声明 等号(=)用来给变量赋值,等号左边为变量值,等号右边是存储在 ...
- python中的类型
python中的类型分为四种 1.整形 2.浮点型 3.字符串 4.对象(除了前三种,其他的都是对象) 比如函数也是对象 def fun(): print(123) type(fun) // < ...
- Python中布尔类型
我们已经了解了Python支持布尔类型的数据,布尔类型只有True和False两种值,但是布尔类型有以下几种运算:与运算:只有两个布尔值都为 True 时,计算结果才为 True.True and T ...
- Python的文件类型
Python的文件类型主要分为3种:源代码(source file).字节码(byte-code file).优化的字节码(optimized file).这些代码都可以直接运行,不需要编译或者连接. ...
- python none,null,,,,,类型
内建类型None表示一个空对象,没有方法和属性. None是一个特殊的常量. None和False不同. None不是0. None不是空字符串. None和任何其他的数据类型比较永远返回False. ...
随机推荐
- 转: V4L2驱动程序架构
源地址:http://blog.chinaunix.net/uid-26101960-id-3297657.html 1 V4L2简介 video4linux2(V4L2)是Linux内核中关于视频设 ...
- js中在window.onload中写function函数产生的问题
转载自:https://blog.csdn.net/c_p_h/article/details/63684510 今天在jsp中的form表单利用οnclick=”xxx”来监听js中一个functi ...
- PAT甲级——A1060 Are They Equal
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered ...
- matlab中disp函数的简单用法
输出数组类型的数据,也可以把string类型的数据看做数组输出 输出数字 >> num = ; >> disp(num) 输出字符串 >> disp('this i ...
- DAO设计模式总结
1.DAO(Data Access Object,数据访问对象),主要的功能是用于进行数据操作的,在程序的标准开发框架中属于数据层的操作. 数据开发结构流程: 资源层是数据库的操作层,里面可以进行各种 ...
- 【python之路23】递归
1.递归的基础 举例说明:老师要班里坐在最后的一排学生要一本书,老师对前面的人说你向最后一排的同学要一本书,那么最前面的人跟坐在第2排的人说,第2排的人跟第3排的人说,当命令传递到最后一排时,最后一排 ...
- 微信小程序滚动到某个位置添加class效果。
<scroll-view scroll-y="true" style="height:100vh;" bindscrolltoupper="up ...
- python中str的常用方法汇总(1)
a = 'strABC' # Strabc : 首字母大写,其他全部小写 b = a.capitalize() print(b) # STRABC : 全部大写 c = a.upper() print ...
- day 56
目录 聚合查询 分组查询 F与Q查询 ORM字段及参数 13个字段操作总结 自定义char字段 ORM中事物的操作 数据库三大范式 聚合查询 aggregate()是QuerySet()的一个终止子句 ...
- 洛谷P1966 [NOIP2013提高组Day1T2]火柴排队
P1966 火柴排队 题目描述 涵涵有两盒火柴,每盒装有 n 根火柴,每根火柴都有一个高度. 现在将每盒中的火柴各自排成一列, 同一列火柴的高度互不相同, 两列火柴之间的距离定义为: ∑(ai-bi) ...