Alexisused
V2EX  ›  问与答

请问, js 浮点数精度问题的正确处理方式是什么?

  •  
  •   Alexisused · Oct 16, 2017 · 2377 views
    This topic created in 3309 days ago, the information mentioned may be changed or developed.

    例如 0.1 + 0.2 = 0.30000000000000004 这种,到底应该怎么处理呢, 如何才能得到准确的结果呢

    ineed
    ineed
    Oct 16, 2017 via iPhone
    1
    (0.1*10+0.2*10)/10 这样可以吗?我一般这样做
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1722 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 14:39 · PVG 22:39 · LAX 06:39 · JFK 09:39
    ♥ Do have faith in what you're doing.