王佳 Posted April 18 Report Share Posted April 18 Please give me some advice and help, thanks guys! Quote Link to comment
Neil Pate Posted April 18 Report Share Posted April 18 This question can be interpreted a bunch of ways. Can you explain with a bit more detail? Maybe show us some pictures? Quote Link to comment
王佳 Posted April 20 Author Report Share Posted April 20 On 4/19/2024 at 5:09 AM, Neil Pate said: This question can be interpreted a bunch of ways. Can you explain with a bit more detail? Maybe show us some pictures? Firstly thank you very much for your reply! My idea is simple, input a fixed point number and how to output its integer part separately from its decimal part. For example, if the input is 1.5, the output will be 1 and 0.5.🤪 Quote Link to comment
王佳 Posted April 22 Author Report Share Posted April 22 On 4/19/2024 at 5:09 AM, Neil Pate said: This question can be interpreted a bunch of ways. Can you explain with a bit more detail? Maybe show us some pictures? I seem to have implemented this feature. Using the module round toward-infinity. That should do it, right?🤨 Quote Link to comment
infinitenothing Posted April 23 Report Share Posted April 23 No, that probably doesn't work how you expect for negative numbers. Fortunately, for fixed point numbers, the decimals are just the least significant bits. The cool thing about that approach is that the code is just a wiring operation and thus uses ~0 resources and 0 time to calculate. Quote Link to comment
王佳 Posted April 23 Author Report Share Posted April 23 7 hours ago, infinitenothing said: No, that probably doesn't work how you expect for negative numbers. Fortunately, for fixed point numbers, the decimals are just the least significant bits. The cool thing about that approach is that the code is just a wiring operation and thus uses ~0 resources and 0 time to calculate. If my requirement does not include the case of negative numbers, can I use the procedure I wrote above. Quote Link to comment
infinitenothing Posted April 23 Report Share Posted April 23 Yes, I think that should work fine for positive numbers. It's probably less efficient than my method though. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.