Skip to content

Defining a symbol with a value of 0 fails #132

@Frizzled

Description

@Frizzled

When the value is "0", evaluate().valueOf() becomes a stringed expression instead of a result (confirmed for "GreaterEqual"):

    let math = ["GreaterEqual", "count", 4]
    ce.defineSymbol("count", {value: 0})
    let expr = ce.box(math)
    console.log(expr.evaluate().valueOf()) // "[\"LessEqual\",4,\"countLocal\"]"

When value is anything other than "0" evaluate().valueOf() works as expected:

    let math = ["GreaterEqual", "count", 4]
    ce.defineSymbol("count", {value: 0.000000001})
    let expr = ce.box(math)
    console.log(expr.evaluate().valueOf()) // false

This is also an issue with the newer assignValue()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions