Discussions

Petit computer 3 Community

Soybeanman2013niconico

10/02/2017 4:21 AM ·Spoilers

Open Closed

DATA文にNaNを書くには。

質問です。 DATA文にNaN(非数)を記述するにはどうすればいいのでしょうか? 教えてくださる方がいらっしゃいましたら、 コメントに書いて頂けると有難いです。

Advertisement

Comment

This post has no comments.

  • DATAに式を書くのは無理なので、恐らく無理です。(画像はエラー) なので、使わない数を書いて、読み込んだ数がその数だったらnanに変換するなどの工夫が必要だと思われます。 使わない数が無いならデータを文字列で記述して、数値に変換するとか。

    Yeahs0
    Played
  • (質問ってシツットモンスターの略だったのか。) ↑のサンプルです。

    Yeahs0
    Played
  • 様々な回答ありがとうございます。 こういちさん>> なるほど。 NaNは記述出来なくても他の方法で出力出来るのですね。 具体的な例も用意して下さってありがとうございます。 とても分かりやすかったです。 ーーーーー 疑問は解決しましたが、 次のトピックを開くまであけとくことにします。

    Yeahs1
    Played
  • そのものズバリは書けませんが、 どこかのバージョンから「定数だけからなる式」は定数扱いになったので、例えば次みたいにかけます repeat:read x: ? x: until x!=x data 1,2,1e308*2,1e308*2*0

    Yeahs6
    Played
  • コメントありがとうございます。 返信遅れてすみません。 MIKIさん>>なるほど! DATA文にはそういった数式も入れれるのですね! ためになります。 因みに、整数型変数でREADすると0に なるのですが、何故でしょうか? お答えいただけると嬉しいです。

    Yeahs0
    Played
  • infとnanが実数型だからだと思われます。

    Yeahs0
    Played
  • こういちさん>> お答えありがとうございます。 なるほど!実数型だったのですね! ためになります。

    Yeahs0
    Played
  • 受付終了します。 コメントありがとうございました。

    Yeahs0
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-DPU-2NL9-GLG-L7YH

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: