+ 1

What can I do to increase the calculation accuracy in c ++? Can you give me an example?

By Using unit_32 for a variable input of datatype float

14th Oct 2020, 2:22 PM
Faezeh Alinejad
Faezeh Alinejad - avatar
15 Respuestas
+ 3
Here's the very basic usage (read input and write to standard output stream). #include <iostream> #include <cstdint> int main() { uint32_t my_var; std::cin >> my_var; std::cout << my_var << "\n"; return 0; }
14th Oct 2020, 4:39 PM
Ipang
+ 4
Loads of maths XD Not my cup of tea Good luck anyways bro! 👍
14th Oct 2020, 5:32 PM
Ipang
+ 3
Ipang It was OK. Thank you for your response, Baby
14th Oct 2020, 5:09 PM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 3
You're welcome! But what about the float numbers? did you solve it?
14th Oct 2020, 5:11 PM
Ipang
+ 3
Ipang https://code.sololearn.com/cQ1s8a2rDBtf/?ref=app Honestly, I asked the above question for the following program, but I have some difficulty in implementing its function. (It calculate the angle between two geographical coordinates. Take the pairs with a comma and return the angle between .)
14th Oct 2020, 5:17 PM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 3
I don't understand what you meant by that.
15th Oct 2020, 10:49 AM
Sonic
Sonic - avatar
+ 3
here you can do these things intmain() { uint32_t my_var; std::cin >> my_var; std::cout << my_var << "\n"; return 0; }
16th Oct 2020, 3:57 AM
Abhijeet Kumar Verma
Abhijeet Kumar Verma - avatar
+ 2
Can you please be more descriptive here? not getting what is being cslculated, nor how uint32_t can help improve accuracy. The better you describe the question, the better (more relevant) the incoming responses would be.
14th Oct 2020, 3:14 PM
Ipang
+ 2
Ipang We need to receive a few float number , and store them in memory. You are right . I had better ask the question like this: How do I use the unit32_t injunction for variables to be necessarily 4 bytes? I hope it was clear.
14th Oct 2020, 3:35 PM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 2
Faezeh Alinejad I'm trying to understand ... 1. You are asked to read some floatng point values. 2. And you are asked to convert thr floating point values to 32bit unsigned integer (not sure about this one). Did I get your description right? I'm not native English either TBH
14th Oct 2020, 3:58 PM
Ipang
+ 2
@lpang I just want an example of instruction unit32_t in cpp Idont know how to use it? See the link below http://www.cplusplus.com/reference/cstdint/
14th Oct 2020, 4:31 PM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 2
Is the use of doubles instead of floats an option?
15th Oct 2020, 10:47 AM
Sonic
Sonic - avatar
+ 2
Sonic yas,is there the problem?
15th Oct 2020, 10:48 AM
Faezeh Alinejad
Faezeh Alinejad - avatar
+ 1
Abhijeet I changed several compilers, but my compiler gives uint32_t an error. I finally adjusted the accuracy with the setprecisin() command
16th Oct 2020, 5:05 AM
Faezeh Alinejad
Faezeh Alinejad - avatar
0
Sonic When we define a variable double , we do not need to calculate it accurately with another command And in this question, the accuracy of the calculation was important to me.
15th Oct 2020, 11:02 AM
Faezeh Alinejad
Faezeh Alinejad - avatar