This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Description
Describe the bug
The result of Lg with a non-positive parameter is NaN, so running the following program will cause overflow. The part of the output is shown below:
Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow.
To Reproduce
namespace NameSpace {
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Math;
@EntryPoint()
operation main() : Unit {
let nIdxRegQubits = Ceiling(Lg(-1.0));
// same as:let nIdxRegQubits = Ceiling(NaN());
Message($"{nIdxRegQubits}");
}
}
Expected behavior
Maybe a range check can be used to avoid it.
System information
operating system : Ubuntu 22.04 LTS
dotnet version : 6.0.400
QDK : 0.25.228311