code8825 / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

Print::printFloat should print "inf" when appropriate #961

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Further to bug report 946 ...
2. Set a float to infinity (eg. 1.0/0.0 )
3. Print it
4. See 0.00000000

What is the expected output? What do you see instead?

I expect to see "inf" but I see zero. Issue 946 now prints nan rather than zero 
(for 0.0/0.0), but I suggest that 1.0/0.0 should print "inf" and not zero.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?

IDE 1.0.1
OS/X.
Board not relevant.

Please provide any additional information below.

Suggest changing Print::printFloat to add, near the start:

  if (isinf (number))
    return print ("inf");

Original issue reported on code.google.com by n...@gammon.com.au on 22 Jun 2012 at 11:11

GoogleCodeExporter commented 9 years ago
https://github.com/arduino/Arduino/commit/71a615c65d9422c202c86fbe3290c2e529a8f2
96

Original comment by dmel...@gmail.com on 23 Jun 2012 at 3:39