TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Real Close to the Machine: Floating Point in D

25 pointsby yawniekover 9 years ago

1 comment

shultaysover 9 years ago
defaulting floats to NaN seemed a little weird, so I checked what D defaults other data types.<p><a href="https:&#x2F;&#x2F;dlang.org&#x2F;spec&#x2F;type.html" rel="nofollow">https:&#x2F;&#x2F;dlang.org&#x2F;spec&#x2F;type.html</a><p>Well, it good weirder. int types are 0s except char types which are 0xFF, 0xFFFF (-1). Except dchar (32bit uint) which is 0x0000FFFF. And all floating types are NaN. Why the inconsistency?<p>Is there a reason for this? If you are gonna initialize your locals why not 0 for all? It would be more expected, consistent and probably efficient.
评论 #11057617 未加载
评论 #11057370 未加载
评论 #11057673 未加载