Excel’s Numerical Limitations RRS feed

  • 問題

  • I understand that there is a Limitation in Excel:

    Excel’s numbers are precise up to 15 digits. For example, if you enter a large value, such as 123,456,789,123,456,789 (18 digits), Excel actually stores it with only 15 digits of precision. This 18-digit number displays as 123,456,789,123,456,000. This precision may seem quite limiting, but in practice, it rarely causes any problems.
    One situation in which the 15-digit accuracy can cause a problem is when entering credit-card numbers.
    Most credit-card numbers are 16 digits long. But Excel can handle only 15 digits, so it will substitute a zero for the last credit-card digit. Even worse, you may not even realize that Excel made the card number invalid.


    The solution?

    we can just disguzz Excel 2007 first.


    except precede the creditcard number with an apostrophe

    2007年8月27日 下午 02:56


  • Excel 是試算表,不是數學軟體。


    一般程式設計依據 IEEE 754 定義的8 bytes 浮點數,有效位數上限就是 15 ~ 16 位數,若要處理信用卡號,請當字串用,也就是數字前面加 ' ,例如:'123456789012345678901234567890

    2007年8月28日 下午 03:59