console formatter should format 'nan' as 'NaN'

RESOLVED FIXED in Firefox 47

Status

()

Firefox
Developer Tools: Console
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: Corey Farwell, Assigned: bgrins)

Tracking

44 Branch
Firefox 47
Points:
---

Firefox Tracking Flags

(firefox47 verified)

Details

(Whiteboard: [console-spec])

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

2 years ago
For some reason, Firefox formats "not a number" value as 'nan' sometimes in the console. For the sake of consistency, this should probably be styled as 'NaN'.

https://github.com/whatwg/console/blob/master/NOTES.md#float-formatter


Firefox:

```
console.log("%f", "fo")
nan
```

Chrome:

```
console.log("%f", "fo")
NaN
```
(Assignee)

Updated

2 years ago
Whiteboard: [console-spec]
(Assignee)

Comment 1

2 years ago
Created attachment 8712345 [details] [diff] [review]
console-nan.patch

Andrea, this fixes the problem but I'm not sure if it's the best option.  Switching to AppendFloat instead of AppendFormatString also fixes it but then I don't think we can keep the `mantissa` functionality.  FWIW the mantissa syntax isn't supported by Chrome or in the lastest spec: https://console.spec.whatwg.org/#formatting-no-ui
Attachment #8712345 - Flags: feedback?(amarchesini)
Attachment #8712345 - Flags: feedback?(amarchesini) → feedback+
(Assignee)

Comment 2

2 years ago
Comment on attachment 8712345 [details] [diff] [review]
console-nan.patch

Review of attachment 8712345 [details] [diff] [review]:
-----------------------------------------------------------------

Alright, flagging for review.  Here's a try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=38c25d87584d
Attachment #8712345 - Flags: review?(amarchesini)
(Assignee)

Comment 3

2 years ago
Created attachment 8712712 [details] [diff] [review]
console-nan.patch

Actually, switched to AppendFloat for nan case to get rid of hardcoded string.  I'm assuming this behavior is defined across platforms, I guess try will show
Attachment #8712345 - Attachment is obsolete: true
Attachment #8712345 - Flags: review?(amarchesini)
Attachment #8712712 - Flags: review?(amarchesini)
Attachment #8712712 - Flags: review?(amarchesini) → review+

Comment 5

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/24320d1e9d99
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox47: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 47
(Assignee)

Updated

2 years ago
Assignee: nobody → bgrinstead
I have reproduced this bug on Nightly 46.0a1 (2016-01-13) on ubuntu 14.04 LTS, 32 bit!

The bug's fix is now verified on Latest Developer Edition 47.0a2!

Build ID: 20160323004040
User Agent: Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0
QA Whiteboard: [bugday-20160323]
status-firefox47: fixed → verified

Comment 7

2 years ago
I have reproduced this bug with Firefox nightly 46.0a1(build id:20160113030208)on
windows 7(64 bit)

I have verified this bug as fixed with Firefox aurora 47.0a2(build id:20160323004040)
User Agent: Mozilla/5.0 (X11; Linux i686; rv:47.0) Gecko/20100101 Firefox/47.0
You need to log in before you can comment on or make changes to this bug.