TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Exposing Floating Point (2019)

71 点作者 eindiran将近 2 年前

3 条评论

turtledragonfly将近 2 年前
Pretty solid article. I&#x27;m glad there was mention of the non-uniform-distribution of floats, though my biased view wishes there were a little more emphasis that floats <i>really really</i> want to be &quot;near 1&quot;, to keep precision. The practice of normalizing data to a [0,1] space, doing your math there, then transforming back to &quot;big&quot; space is useful not just for conceptual simplicity, but also for maintaining precision in intermediate results.<p>Also, there&#x27;s a pretty good range of integers that can be represented exactly by floats; one of the reasons the Lua developers were resistant to adding an integer type for many years. I believe you can represent about 24 bits of exact integers in a 32 bit float.<p>I&#x27;ve been wrangling with fixed-point representations a lot lately, so the differences are stark in my mind (:
评论 #36486785 未加载
评论 #36487193 未加载
评论 #36486622 未加载
评论 #36486931 未加载
jbandela1将近 2 年前
&gt; It seems that there is no way to configure the printing of floating point values to automatically maintain exact number of decimal digits needed to accurately represent the value.<p>C++17 has to_ chars&#x2F;from_chars and c++20 has std::format which will output the shortest output the shortest output required to round trip the floating point value exactly.
CoastalCoder将近 2 年前
Anyone know how he generates those illustrations?<p>If he&#x27;s not keeping it a secret, I&#x27;d love to have that in my toolbox.
评论 #36486843 未加载
评论 #36486583 未加载
评论 #36486575 未加载
评论 #36486627 未加载