Double to Integer

您所在的位置:网站首页 bob11 Double to Integer

Double to Integer

2024-07-09 21:02| 来源: 网络整理| 查看: 265

taylorswift:

they have unspecified precision, which is not the same thing as infinite precision. as far as i’m aware, they are currently capped to a max precision of Float80

Thank you - that's what I take it to mean, though not what's said, in the discussion of literals (emphasis mine):

Instead, a literal is parsed as having infinite precision and Swift’s type inference attempts to infer a type for the literal

https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure#Literals

It seems the literal will be preserved until the point where it has to be given the default type Double [corrected below] for the target architecture Double to be sure for x86, but perhaps f32 in wasm or some kind of float16 in an alternative reality.

I'm honestly not trying to be pedantic, but separating the notion of literals from their typed values might help new developers sort through questions like this.



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3