zoukankan      html  css  js  c++  java
  • CompareValue 浮点数比较

    -1 LessThanValue The first value is less than the second value.
    0 EqualsValue The two values are equal.
    1 GreaterThanValue

    var
      A : Single;
      B : Single;
      C : Single;

    begin
      A := 23.0;
      B := 23.0;
      C := 23.1;

      // Compare 2 equal floats
      case CompareValue(A, B) of
        LessThanValue    : ShowMessage('A < B');
        EqualsValue      : ShowMessage('A = B');
        GreaterThanValue : ShowMessage('A > B');
      end;

      // Compare 2 unequal floats
      case CompareValue(A, C) of
        LessThanValue    : ShowMessage('A < C');
        EqualsValue      : ShowMessage('A = C');
        GreaterThanValue : ShowMessage('A > C');
      end;

      // Compare 2 unequal floats - but allow for a difference of up to +/- 0.2
      case CompareValue(A, C, 0.2) of
        LessThanValue    : ShowMessage('A < C');
        EqualsValue      : ShowMessage('A = C');
        GreaterThanValue : ShowMessage('A > C');
      end;
    end;
  • 相关阅读:
    bus总线
    vue 动态组件、父子组件传参
    echarts
    记录板
    留言板
    如何移除双系统mac中的windows系统
    Kernel,Shell,Bash 的关系
    zju 校队选拔 被虐记
    COGS 2638. 数列操作ψ 线段树
    退役公告【现已复活】
  • 原文地址:https://www.cnblogs.com/luckForever/p/7254648.html
Copyright © 2011-2022 走看看