You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C also displays it as 'nan' if I'm not mistaken. I always remember seeing 'NaN' in Javascript tbh and Rust seems to follow that. Either way, 'NaN' always seemed weird to me, either capitalize em all or don't, why is a being left out like that? No respect for poor a.
Edit: Seems like the situation is trickier when Wikipedia has an entire subsection dedicated to how NAN is displayed.
Yes! Take a look at float's repr function. This calls another function to handle formatting for the different values that might be passed in. Take a look there and try and find out which case Nan/Inf fall under and what you'd need to do.
Hey @Codemonk-adi, not sure what you mean here. Are you looking inside the implementation of repr for PyFloat? You can always fire up a debugger and get through stepping your way until the end (it takes some getting used to but its worth it).
@DimitrisJim I am sorrry to bother you again, but I am unable to use the debugger, when I run the debug option on vscode it opens an rust python interpreter, and I do enter debugging mode in vscode but the buttons are disabled.
Activity
ShadowJonathan commentedon Sep 10, 2021
(TIL NaN is lowercase in repr in python)
DimitrisJim commentedon Sep 10, 2021
C also displays it as
'nan'if I'm not mistaken. I always remember seeing'NaN'in Javascript tbh and Rust seems to follow that. Either way,'NaN'always seemed weird to me, either capitalize em all or don't, why isabeing left out like that? No respect for poora.Edit: Seems like the situation is trickier when Wikipedia has an entire subsection dedicated to how NAN is displayed.
Codemonk-adi commentedon Sep 15, 2021
@DimitrisJim I would like to work on it
would you pls guide me a bit?
DimitrisJim commentedon Sep 15, 2021
Yes! Take a look at float's
reprfunction. This calls another function to handle formatting for the different values that might be passed in. Take a look there and try and find out which caseNan/Inffall under and what you'd need to do.Codemonk-adi commentedon Sep 16, 2021
RustPython/Lib/reprlib.py
repr(float('nan'))
returns the builtin repr function called with float('nan')
I am stuck here...
DimitrisJim commentedon Sep 16, 2021
Hey @Codemonk-adi, not sure what you mean here. Are you looking inside the implementation of
reprforPyFloat? You can always fire up a debugger and get through stepping your way until the end (it takes some getting used to but its worth it).Codemonk-adi commentedon Sep 16, 2021
@DimitrisJim I am sorrry to bother you again, but I am unable to use the debugger, when I run the debug option on vscode it opens an rust python interpreter, and I do enter debugging mode in vscode but the buttons are disabled.
DimitrisJim commentedon Sep 16, 2021
@Codemonk-adi hop on over to gitter if you can. This way I can help you further w/o notifying watchers.
DimitrisJim commentedon Sep 22, 2021
closed with #3103