# Set (number) value to NaN in change / inject node

**URL:** https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589
**Category:** General
**Created:** [26 September 2023 12:35 UTC](https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589 "2023-09-26T12:35:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [26 September 2023 12:35 UTC](https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589/1 "2023-09-26T12:35:23Z")

</div>

I used to do the following to create a `NaN` :

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/f/5f2bc7a9b9d245263542a3070bf9bf844d23de0a.png)

I'm pretty sure this worked fine - until recently.  
Now (post 3.1) the `typedInput` field gets the red error indicating border & the node gets flagged with the red issue triangle.

Is this the intended / preferred way to create a `NaN`?  
If yes, would you accept a PR to re-enable this _functionality_?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [26 September 2023 13:55 UTC](https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589/2 "2023-09-26T13:55:23Z")

</div>

I think it still works & it is just a visual thing - did you deploy and test?

While you are at it, you might want to fix up binary `0b0101`, octal `0o17` and hexadecimal input `0x2b1c` 😛

I noticed this ↑ recently and haven't yet raised an issue! (naughty me)

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [26 September 2023 18:11 UTC](https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589/3 "2023-09-26T18:11:05Z")

</div>

PR is placed - including fixes for binary, octal & hex.

> <https://github.com/node-red/node-red/pull/4371>
>
> \- \[x\] Bugfix (non-breaking change which fixes an issue)
> \- \[x\] New feature (non-…breaking change which adds functionality)
> 
> \## Proposed changes
> 
> Based on a \[forum exchange\](https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589), this PR extends the validity checks for typedInput fields of type 'number'.
> 
> The following additional formats will pass the check:
> 
> \- \`NaN\`
> \- Binary values, e.g.: \`0b10101\` or \`0B11101\`
> \- Octal values, e.g.: \`0o1357\` or \`0O2468\`
> \- Hex values, e.g.: 0x25aF or 0X69Cd
> 
> \## Checklist
> 
> 
> \- \[x\] I have read the \[contribution guidelines\](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md)
> \- \[x\] For non-bugfix PRs, I have discussed this change on the forum/slack team.
> \- \[\] I have run \`npm run test\` to verify the unit tests pass
> \- \[\] I have added suitable unit tests to cover the new/changed functionality

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 November 2023 18:11 UTC](https://discourse.nodered.org/t/set-number-value-to-nan-in-change-inject-node/81589/4 "2023-11-25T18:11:44Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
