gpt4 book ai didi

C# 短错误 : Negating the minimum value of a twos complement number is invalid

转载 作者:可可西里 更新时间:2023-11-01 08:15:45 29 4
gpt4 key购买 nike

我在我的项目中遇到过这个错误,该项目涉及使用数字音频信号。

所以我一直在获取振幅值,最近遇到了这个错误。调试时遇到的振幅值为“-32768”时会出现这种情况。我将这些值存储在一个 short[] 数组中。

我有一种预感,它与最大值/最小值有关(我使用 Math.Abs​​),但我不确定如何处理它。

有人可以帮忙吗?谢谢!

最佳答案

16 位有符号整数(short)取值介于 -32,768 和 32,767 之间。

在 16 位有符号整数中不可能对 -32768 求反或获取绝对值。该值 (32,768) 大于最大可能的正值 (32,767)。

在不了解您正在使用的算法的更多细节的情况下,我不会建议您如何解决问题。

关于C# 短错误 : Negating the minimum value of a twos complement number is invalid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6265381/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com