qsharp-runtime icon indicating copy to clipboard operation
qsharp-runtime copied to clipboard

Function DoubleAsInt is not implemented

Open rajkk1 opened this issue 3 years ago • 1 comments

Describe the bug

When I try and run a function that uses DoubleAsInt() I get the error Cannot create an instance of Microsoft.Quantum.Convert.DoubleAsInt because it is an abstract class.

To Reproduce

open Microsoft.Quantum.Convert;

function TestDoubleAsInt(): Int {
    let value = 18.0;
    let result = DoubleAsInt(value);
    return result;
}

%simulate TestDoubleAsInt

Expected behavior

I would expect the output to be 18

Actual behavior

I get the error Cannot create an instance of Microsoft.Quantum.Convert.DoubleAsInt because it is an abstract class.

System information

  • OS: Windows

  • .NET Core Version: 6.0.100

  • Python Version: 3.9.12

Additional context Q# reference for function: https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.convert.doubleasint

rajkk1 avatar Jun 28 '22 11:06 rajkk1

I apologize for the hassle, but after investing on the IQ# side, it looks like the root cause is that DoubleAsInt is missing from https://github.com/microsoft/qsharp-runtime/blob/21f5fab97682d9bc0ae8e3b58f679fdb952f1c24/src/Simulation/QSharpFoundation/Convert/Convert.cs, such that I will transfer your issue back to the qsharp-runtime repo. Thank you for your patience as we investigate your issue! 💕

cgranade avatar Sep 16 '22 17:09 cgranade