justin = { main feed , music , code , askjf , pubkey };
Ask Justin Frankel
No reasonable question unanswered since 2009!

Suggested topics: programming, music, sleep, coffee, etc.

Note: please do not ask questions about REAPER features, bugs or scheduling, use the forums instead.


Name: Ask: Human (enter yes):
[back to index] | [unreplied] | [replied] | [recent comments] | [all]

Question: In some programming languages, like C#, Python etc. We can't directly take int/float as input from user. Instead, we take string from user as input, and typecast that input into integer or float. Why can't we directly take int/float as input from user?
Asked by error at 0x123456789 (223.190.14.x) on December 29 2022, 2:26pm
Reply on December 29 2022, 5:04pm:
    I suppose that's a decision made by the developers of the language! I mean, in theory you could take raw bytes from the user and interpret them as IEEE-754 floating point, too? I guess the default mode of inputting anything is a string, and then converting that using the cast (which implies parsing the bytes as a floating point string...) makes a certain amount of sense?


Comments:
  • Posted by Abhi (182.68.132.x) on December 31 2022, 5:24pm:
    But AFAIK, we can directly take int as input in C & C++. Correct me if I am wrong?

  • Posted by Abhi (182.68.132.x) on December 31 2022, 5:24pm:
    But AFAIK, we can directly take int as input in C & C++. Correct me if I am wrong?


Comment:
    Your Name:   -- Site Owner's Name:  (for human-verification)

    Comment:    

    
  
[back to index] | [unreplied] | [replied] | [recent comments] | [all]
Copyright 2024 Justin Frankel. | RSS