-
Notifications
You must be signed in to change notification settings - Fork 646
Description
Link to doc page in question (if any): https://docs.streamlit.io/en/stable/api.html#streamlit.number_input
Name of the Streamlit feature whose docs need improvement: st.number_input
What you think the docs should say:
Hi folks! Found out when I was copy-pasting the integers generated by torch.seed() into st.number_input, that the last few digits went to zero after enter is pressed. There appears to be a limit for how long an integer input can be, which is something we don't deal with in Python, given its capability to natively handle big integers.
This appears to be floating point behaviour where the number ran out of significands. Digging around in the code base, seems that the Python side of the widget source code uses integers natively. Thus, I'm guessing that the limit to integer length is inherent to how Javascript stores the number internally before passing it to the Streamlit application. But I digress.
Anyway, I thought it would be worth mentioning number_input's limitation in handling big integers. As a workaround, users can use st.text_input and post-process the input values instead. This docs improvement should be relevant to folks building machine learning apps, where large ints can be involved in setting RNG seeds.
I'll put in a PR if the maintainers are OK w/ the proposed improvement.