mojira.dev
MCPE-164515

BE Script Engine says NaN === 1 => true

Minecraft Script:

[media][media]

Other JS Test Site:

[media]

 

Steps to reproduce

Just console.warn(NaN === 1); // Not only 1 but all numbers are possible

Attachments

Comments 4

Your report does not contain enough information to understand or reproduce the problem.
Please include a numbered list of specific steps along with the Observed and Expected results by Editing the Description above as shown here:

Steps to Reproduce:
1. (list every step completely, so someone else can reproduce the issue, and try following your list to make sure you can still reproduce the issue yourself)
2.
3.
Observed Results:
(briefly describe what you see happen, including any message(s) shown)
Expected Results:
(briefly describe what should happen)

(add screenshots or video to help explain the issue)

This report has been temporarily closed as Awaiting Response. It will automatically reopen when you add information. Please follow the format shown and include all sections (steps, observed, expected). Reports that do not contain all of the requested information and complete steps to reproduce the issue may be closed as Incomplete. For more information please read the Bug Tracker Guidelines.

Please avoid adding unnecessary comments like "please fix". Simply report the bug.

You may find this Report Creation Form helpful for any future reports you create.

In windows platform (windows, bds-win), every number (eg. 2, 28, NaN, Infinity) equals to `NaN`.

In unix-like platform (android, bds-linux), every number not equals to `NaN`.

The expecting result is `NaN` not equals to any number, includes `NaN`.

Steps to Reproduce:

To rapidly reduce this bug, please open 'Content log GUI' to view content log.

 

1.create a behaviour pack use this manifest.json:

{
    "format_version": 2,
    "header": {
        "name": "test",
        "description": "NaN equals to every number",
        "uuid": "67bba722-9705-11ed-bee4-1b6256aa0773",
        "version": [0, 1, 0],
        "min_engine_version": [1, 19, 50]
    },
    "modules": [
        {
            "description": "scripts",
            "type": "script",
            "language": "javascript",
            "uuid": "67bba574-9705-11ed-bee2-875d06de3443",
            "version": [0, 1, 0],
            "entry": "scripts/index.js"
        }
    ]
}

 

2.write a simple code in 'scripts/index.js'

console.warn(String(NaN == 1));

 

3.create a new world, enable 'Scirpts API' feature, then enable this behaviour pack.

 

4.enter this world.

 

Observed Results:

you will see a message like this.

[Scripting][warning]-true

It shows us that `NaN` equals to `1`.

 

Expected Results:

expectant result is `NaN` not equals to `1`. so the message should be:

[Scripting][warning]-false

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Could you please attach an example addon showcasing the issue?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki

namsic

(Unassigned)

Plausible

Multiple

Windows 11

1.19.70.22 Preview, 1.19.50.25 Preview, 1.19.41, 1.19.60

Retrieved