Converted everything to orgmode

converted everything to orgmode and added solution to the README files
This commit is contained in:
2025-03-31 08:37:19 +02:00
parent 3013d7ad47
commit 311cb8434c
25 changed files with 319 additions and 502 deletions

View File

@@ -5,13 +5,13 @@
Consider a parabola \((\m{P})\) defined as \(y = g(x)\), with \(g(x) = 0.9 \cdot x^2 + 1.3 \cdot x - 0.7\).
Write a program that determines if a point \((x,y)\) lies on parabola \((\m{P})\) or not. The input is provided by two decimal numbers in the sequence \(x,y\). The program must output `yes`, if the point lies on the parabola, otherwise `no`. Use datatype `double` for all variables and numbers used in the calculation of \(g(x)\).
Write a program that determines if a point \((x,y)\) lies on parabola \((\m{P})\) or not. The input is provided by two decimal numbers in the sequence \(x,y\). The program must output =yes=, if the point lies on the parabola, otherwise =no=. Use datatype =double= for all variables and numbers used in the calculation of \(g(x)\).
You will notice that a straight forward approach (comparing for equality) does not work, i.e., for some points that clearly should be on parabola $g$ such an approach returns result `no`.
You will notice that a straight forward approach (comparing for equality) does not work, i.e., for some points that clearly should be on parabola $g$ such an approach returns result =no=.
/Hint/: Look at the difference between the exact values of the function and the values that your program calculates. Change the program so that it works properly for all points the submission system uses as test input without hard-coding the points. Expect an epsilon within the range \([ 10^{-6}, 10^{-3}]\)$. Experiment yourself to find the epsilon required to pass the test cases.
**Note**: Output only with `std::cout << "no" << std::endl;` or `std::cout << "yes" << std::endl;`, as the autograder will only accept output that exactly matches `yes\n` or `no\n`. For all other messages, use `std::cerr` as in:
**Note**: Output only with =std::cout << "no" << std::endl;= or =std::cout << "yes" << std::endl;=, as the autograder will only accept output that exactly matches =yes\n= or =no\n=. For all other messages, use =std::cerr= as in:
#+begin_src cpp
std::cerr << "This is a test message\n"

View File

@@ -3,7 +3,7 @@
* Task
Implement the following rounding function that rounds a 64-bit floating point number (type `double`) to the nearest 32-bit integer (type `int`). You may assume that the type `double` complies with the IEEE standard 754. The function is only required to work correctly if the nearest integer is in the value range of the type `int`, otherwise, the return value of the function is undefined.
Implement the following rounding function that rounds a 64-bit floating point number (type =double=) to the nearest 32-bit integer (type =int=). You may assume that the type =double= complies with the IEEE standard 754. The function is only required to work correctly if the nearest integer is in the value range of the type =int=, otherwise, the return value of the function is undefined.
**Note: Usage of library rounding functions (standard or others) is not allowed.**
@@ -14,9 +14,9 @@ Implement the following rounding function that rounds a 64-bit floating point nu
int round_number(double x);
#+end_src
Write your solution in `rounding.h`.
Write your solution in =rounding.h=.
/Hint/: In `C++`, when you convert a `float` or `double` to an `int`, the fractional part gets cut off (truncated). Think about how you can use the truncated number to solve the exercise.
/Hint/: In =C++=, when you convert a =float= or =double= to an =int=, the fractional part gets cut off (truncated). Think about how you can use the truncated number to solve the exercise.
* Solution