You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.
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
The text was updated successfully, but these errors were encountered:
It seems this API effect other APIs, one can be seen in microsoft/QuantumLibraries#570; if give targetError a value of 0.0, an overflow behavior will occur. It might be better to fix Ceiling rather than other high-level APIs.
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:
To Reproduce
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
The text was updated successfully, but these errors were encountered: