What does floating point error -1.#J mean?
来源:互联网 发布:卡盟系统源码 编辑:程序博客网 时间:2024/04/24 22:34
What does floating point error -1.#J mean?
Recently, sometimes (rarely) when we export data from our application, the export log contains float values that look like "-1.#J". I haven't been able to reproduce it so I don't know what the float looks like in binary, or how Visual Studio displays it.
I tried looking at the source code for printf, but didn't find anything (not 100% sure I looked at the right version though...).
I've tried googling but google throws away any #, it seems. And I can't find any lists of float errors.
1 Answer
It can be either negative infinity or NaN (not a number). Due to the formatting on the field printf does not differentiate between them.
I tried the following code in Visual Studio 2008:
double a = 0.0;printf("%.3g\n", 1.0 / a); // +infprintf("%.3g\n", -1.0 / a); // -infprintf("%.3g\n", a / a); // NaN
which results in the following output:
1.#J-1.#J-1.#J
removing the .3 formatting specifier gives:
1.#INF-1.#INF-1.#IND
so it's clear 0/0 gives NaN and -1/0 gives negative infinity (NaN, -inf and +inf are the only "erroneous" floating point numbers, if I recall correctly)
- What does floating point error -1.#J mean?
- what does boinc mean?
- what does "ERP" mean
- What does "V"mean
- What does "Vanilla" mean ?
- What does "Error: L6248E: cannot have address type relocation" mean?
- What does 2>&1 mean?
- What does _imp_<Function> mean?
- What does operator “dot” (.) mean?
- Something what you should know (floating point)
- What does mean RSS, Atom, OPML...?
- What does Keyword-Driven Testing mean?
- What does TCP Zero Window mean?
- What does (Aborted) mean in HttpWatch?
- What does "#! /usr/bin/ksh" mean?
- What does $NON-NLS-1$ mean?
- java classpath: what does it mean?
- In Javascript, what does this underscore mean?
- JAVA WEB_JSP的初步(6)
- 面试中的海量数据处理问题
- Cursor的moveToFirst和moveToNext
- 程序员们 不要想一辈子靠技术混饭吃
- 各大公司的java面试题
- What does floating point error -1.#J mean?
- C51存储器类型 MCS-51单片机物理存储器区域
- 逆向工程
- Qt 出现“undefined reference to `vtable for”原因总结
- 关于STM32 MDK中USE_STDPERIPH_DRIVER问题的解释
- 且行且珍重
- TI DAVINCI开发原理(总共5部分)
- 关于数据中选择无重复数
- jquery DWZ富客户端框架