zoukankan      html  css  js  c++  java
  • python自动类型转换(针对于Number数据类型来的)精度从低到高 bool->int-> float->complex 当两个不同是数据类型运算时候,默认想更高进度转化

    # ### 自动类型转换(针对于Number数据类型来的)
    '''
    精度从低到高
    bool->int-> float->complex
    当两个不同是数据类型运算时候,默认想更高进度转化
    '''
    # True 转化成整型是1  False转化成整型是0
    
    # bool + int
    
    res = True + 1
    print(res)
    
    #boll + float
    
    res = True +4.14
    print(res)
    
    
    #bool+complex
    res = False + 3j
    print(res)
    
    #int + float
    #3.14 15~18本质上存在精度损耗,因为小数的二进制在内存中是无限循环没有终止,一般进行截取15~18位
    
    res = 5+6.88
    print(res)
    
    #int +complex
    res = 5+(2+3j)
    print(res)
    
    #float + complex
    res = 3.55 + (-4-2j)
    print(res)
    

      

  • 相关阅读:
    图像滤波
    直方图histeq
    直方图
    基于灰度变换的图像增强
    图像增强
    图像旋转和缩放
    图像点运算
    像素的连接与联通
    程序员进阶之算法练习(一)
    RxSwift 系列(二)
  • 原文地址:https://www.cnblogs.com/huangjiangyong/p/10771263.html
Copyright © 2011-2022 走看看