Skip to content

NaN support #101

@ajberdy

Description

@ajberdy

The openqasm spec references NaN values for floats, but oqpy does not support them.

To reproduce:

import math

import oqpy
from oqpy.base import to_ast


program = oqpy.Program()
float_var = to_ast(program, 1.0)
print(float_var)
float_var_nan = to_ast(program, math.nan)
print(float_var_nan)

outputs

FloatLiteral(span=None, value=1.0)
ValueError: cannot convert float NaN to integer

This should be handled, perhaps yielding FloatLiteral(span=None, value=math.nan)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions