Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

A question about ApproximateFactorial #571

Closed
weucode opened this issue Apr 21, 2022 · 0 comments
Closed

A question about ApproximateFactorial #571

weucode opened this issue Apr 21, 2022 · 0 comments
Assignees
Labels
good first issue Good for newcomers Kind-Bug Something isn't working Pkg-Standard Issue relates to the Microsoft.Quantum.Standard package. tracking This label will trigger gh-sync to create or update a mirror internal ADO issue.

Comments

@weucode
Copy link
Contributor

weucode commented Apr 21, 2022

Description

When using ApproximateFactorial ,a negative value for parameter will lead to following error.

Unhandled exception. Microsoft.Quantum.Simulation.Core.ExecutionFailException: The factorial is not defined for negative inputs.
---> NISLNameSpace.main on D:\00QuantumFuzzing\QsharpDemo\Program.qs:line 18

But the document does not mention the negative value will not work.Here is the description in page https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.math.approximatefactorial

Returns the factorial as Double, given an input of nn as a Double. The domain of inputs for this function is AbsD(n) < 170.0.

In my view,a negative value smaller than -170.0 will be work,please tell me is this right?

Testcase

namespace NameSpace {
	open Microsoft.Quantum.Intrinsic;
	open Microsoft.Quantum.Math;


	@EntryPoint()
	operation main() : Unit {
		let parameter0 = -2;
		mutable variable1 = ApproximateFactorial(parameter0);
	}
}

Environment

operating system:Windows 10

dotnet version:5.0.301

QDK:v0.24.201332


@msoeken msoeken self-assigned this Apr 21, 2022
@msoeken msoeken added Kind-Bug Something isn't working good first issue Good for newcomers Pkg-Standard Issue relates to the Microsoft.Quantum.Standard package. tracking This label will trigger gh-sync to create or update a mirror internal ADO issue. labels Apr 21, 2022
msoeken added a commit that referenced this issue Apr 21, 2022
msoeken added a commit that referenced this issue May 8, 2022
* Fixes #570. (#572)

* Fixes #571. (#573)

* Add DevSkim scanning (#576)

* Examples in fixed-point conversion functions.

* API review April 2022 (#561)

* API review April 2022

* Apply suggestions from code review

Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>

* Update api-design-2022-04.md

* Update api-design-2022-04.md

Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>

* Fixes #580. (#581)

* Address reviewer's feedback.

Co-authored-by: Angela Burton <anjbur@users.noreply.github.com>
Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>
msoeken added a commit that referenced this issue May 12, 2022
* Fixes #570. (#572)

* Fixes #571. (#573)

* Add DevSkim scanning (#576)

* Examples in fixed-point conversion functions.

* API review April 2022 (#561)

* API review April 2022

* Apply suggestions from code review

Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>

* Update api-design-2022-04.md

* Update api-design-2022-04.md

Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>

* Fixes #580. (#581)

* Address reviewer's feedback.

Co-authored-by: Angela Burton <anjbur@users.noreply.github.com>
Co-authored-by: Mariia Mykhailova <mamykhai@microsoft.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers Kind-Bug Something isn't working Pkg-Standard Issue relates to the Microsoft.Quantum.Standard package. tracking This label will trigger gh-sync to create or update a mirror internal ADO issue.
Projects
None yet
Development

No branches or pull requests

2 participants