Support "Not a Number" and Infinity in Obsidian Properties

There is currently no supported way to represent “not a number” not infinity as in Obsidian. The YAML specification indicates that the former should be .NaN and the latter as .INF (with any capitalization combination) but both of these create broken states for Obsidian if used.

The broken state (of not displaying anything) indicates that the underlying YAML parser in use by Obsidian already supports these features, they just have not been properly exposed to the UI.

Use Case

Any time infinity needs to be displayed in contrast to a known limit.

Specific Example

I have information about how many steps, tracks, and patterns are possible for a given music sequencer. Most of them have hard limits of 8 or 64 or 4096, but a few are only limited by available memory or storage space. This state could be treated as “not as number” or “infinite”, but neither is supported by Obsidian.

Steps to reproduce

  1. Open sandbox
  2. Create a new note
  3. Add a property foo with the number type
  4. Attempt to enter .NaN - the property editor will not allow it
  5. Edit the source to foo: .NaN
  6. Return to live preview editing mode

Expected result

  • The value can be entered without workarounds
    • Either by allowing text after leading .
    • Or by adding a right click menu with “mark as infinity” and “mark as not a number” entries
  • Preferably displayed nicely as and NaN rather than .INF or .NaN

Actual result

  • The value cannot be entered without workarounds
  • Obsidian displays nothing as the property value
  • Obsidian displays a type mismatch error if the field is wrapped in quotes, but at least it displays

Proposed Solution

Support and display NaN and Infinity in properties along with associated ability to enter them somehow.

Current Workaround

Edit in source mode and insert quotes to that it will at least display, albeit with a type mismatch error message from Obsidian.


Additional information

Related to:

But this is a feature request and includes information about NaN, possible UI changes, and the fact that Obsidian’s YAML parser already supports it.

YAML Specification: