android - 为什么大于 FLT_MAX 的 float 在 android NDK 上不是无穷大?

标签 android android-ndk

在我的 linux 机器上,评估大于 FLT_MAX 的 float 会导致无穷大,如下所示:

sacha@sacha-XPS13:~$ gdb 
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) p 1e39f
$1 = inf
(gdb)

问题:为什么用android NDK不一样?正如您在下面看到的,它环绕而不是返回无穷大:

sacha@sacha-XPS13:~$ ~/lib/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb
GNU gdb (GDB) 7.3.1-gg2
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-linux-android".
For bug reporting instructions, please see:
<http://source.android.com/source/report-bugs.html>.
(gdb) p 1e39f
$1 = -5.5173927e-39
(gdb) 

最佳答案

7.6 之前的股票 gdb 有同样的问题,直到它被这个 patch 修复.在 NDK 中修复 gdb-7.3.x 被跟踪 here

关于android - 为什么大于 FLT_MAX 的 float 在 android NDK 上不是无穷大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23401170/

相关文章:

android - Neura 中的事件标识符是什么?

android - 如何将属性添加到我的 android 应用程序,通过它我可以从设置菜单中设置服务 URL

android - 如何使用api 29向Android中的元素添加阴影

debugging - Android - 如何启用 CheckJni 进行 NDK 开发?

android - 如何用双簧管正确播放解码后的内存 PCM?

android - 在我的 Nexus S 上调试 JNI 代码

android - setResult(int,intent)在 Android 中不起作用

安卓 : How to bypass Do Not Disturb So that it plays notification audio in background

android - 如何在 Android 上为 ImageMagick 编译 Ghostscript?

android - 如何将 Mat 数组从 JNI 返回到 Java