Add NdArray Mean function#15
Merged
Merged
Conversation
Member
|
Thanks for contributing this function. |
Nucs
added a commit
that referenced
this pull request
Jun 6, 2026
…cs (Phase 1 F3a) NumSharp promoted every integer input to float64 for the float-producing unary ufuncs (sqrt/cbrt/exp/log/trig/...), regardless of input width. NumPy NEP50 uses WIDTH-BASED promotion: bool/int8/uint8 -> float16, int16/uint16 -> float32, int32/uint32/int64/uint64 -> float64 (float/complex preserved). FUZZ_FINDINGS #7. Fix: new DefaultEngine.ResolveUnaryFloatReturnType implements the width-based rule; the 20 transcendental Default.<Op>.cs files (ACos/ASin/ATan/Cbrt/Cos/Cosh/Deg2Rad/ Exp/Exp2/Expm1/Log/Log10/Log1p/Log2/Rad2Deg/Sin/Sinh/Sqrt/Tan/Tanh) now call it instead of ResolveUnaryReturnType (which widened to float64 via GetComputingType). The int->Half / int->Single unary kernels already existed, so this is a pure result-dtype routing change; int32/int64 are unaffected (already float64). The dtype-PRESERVING ufuncs (square/floor/ceil/trunc/round/reciprocal) are intentionally left on the old resolver pending F3b (they need integer identity / x*x / int-reciprocal kernels to preserve the integer dtype). Verification: * 364 of 494 unary dtype divergences clear bit-exact; the remaining 130 are the F3b-pending preserve-dtype ops, now scoped in MisalignedRegistry so a transcendental promotion regression fails the gate (not silently excused). * Half/Single transcendental values stay within 2 ULP of NumPy's float16/float32 libm (documented algorithm difference, same class as complex-divide ULP). * DtypeCoverageTests.Sqrt_IntegerDtypes updated: it asserted the old uniform float64 (codified the bug); now asserts the NumPy width-based dtype per input. * Full net10.0 suite green: 9422 passed / 0 failed; FuzzMatrix 17/17. Clears the transcendental half of FUZZ_FINDINGS #7 (and #15 dtype for those ops).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.