Is D floating point semantics too advanced?

davidl davidl at 126.com
Thu Aug 23 23:44:39 PDT 2007


在 Thu, 23 Aug 2007 22:45:32 +0800,Hans-Eric Grönlund  
<hasse42g at gmail.com> 写道:

> Hello!
>
> I've written a post on my blog wondering if the floating point semantics  
> is too advanced. The problem I have with it is that I can't write  
> something like this:
>
> if (someValue == real.nan) {...}

Compiler should emit error messages(or warning?) of comparing with NAN for  
compile time constants

And the runtime NAN would leave to runtime to determine ( this is well  
defined in IEEE I think)

For compile time stuff, since it's result is *fixed*. So such code should  
at least be warned or
something. or some compiler option -W-floatnan?


>
> It will never be true, which - for me - is unintuitive.
>
> The post is at  
> http://www.hans-eric.com/2007/08/23/is-floating-point-handling-too-advanced-in-d/
> and I'd love to get some comments.
>
> Best regards
>
> Hans-Eric Grönlund
> Software Developer, Project Manager, Freelance Journalist
> www.hans-eric.com



-- 
使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list