Skip to content

012-floating-point.md : NaN != NaN はtrue? #157

@sukeya

Description

@sukeya

012-floating-point.mdのNaN(Not a Number)の節で、

// false
bool d = NaN != NaN ;

とあります(コードから抜粋)。しかし、このサイトの例でgcc 11.1(C++20)を選び、

std::cout << "NaN != NaN? " << std::boolalpha
<< ( std::numeric_limits::quiet_NaN()
!= std::numeric_limits::quiet_NaN() ) << '\n';

を追記し、実行するとtrueになりました。
NaN != NaN はtrueではないでしょうか?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions