在我的 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)
最佳答案
关于android - 为什么大于 FLT_MAX 的 float 在 android NDK 上不是无穷大?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23401170/