It's UWAweek 44 (2nd semester, 1st exam week)

help2002

This forum is provided to promote discussion amongst students enrolled in CITS2002 Systems Programming.
Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.
Displaying the 4 articles in this topic
Showing 4 of 820 articles.
Currently 2 other people reading this forum.


 UWA week 35 (2nd semester, week 6) ↓
SVG not supported

Login to reply

👍?
helpful
4:03pm Wed 28th Aug, Christopher M.

"Junyu Zhang" <24*6*1*2@s*u*e*t*u*a*e*u*a*> wrote:
> Any clarifications about it, like a BNF? The syntax of float point value in C is more than numbers and a dot, as the link below shows. Thanks a lot. > https://learn.microsoft.com/en-us/cpp/c-language/c-floating-point-constants?view=msvc-170
There's no need to do all this work yourself, as we have standard functions such atof and even strtof to help us.


SVG not supported

Login to reply

👍?
helpful
5:31pm Wed 28th Aug, Junyu Z.

Could we make this more clear or simplified? If we accept any representations, the situation may be a little bit complicated: 1. "1.5e4F" -> Some characters like ".eF" must be grabbed when tokenizing a real number. 2. "- 4" -> A space-separated minus may not be an operator, but the sign of a real number. 3. ".123" -> Not all real numbers start with or end with digits. Although APIs like atof or strtof can check and parse potential real number tokens very well, knowing characters in real number token is necessary when splitting words. Another solution may be simply the syntax of real number, that will make life easier. For example, all real numbers will be like '[+-]([0-9]*)[.]([0-9]*)'.


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported

Login to reply

👍?
helpful
1:49am Thu 5th Sep, ANONYMOUS

Adding to this, should we accept a number formatted as 1. or should we only accept 1 (no decimal if it is a whole number) or 1.0, 1.00, etc


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
8:50pm Wed 11th Sep, Joshua N.

ANONYMOUS wrote:
> Adding to this, should we accept a number formatted as 1. or should we only accept 1 (no decimal if it is a whole number) or 1.0, 1.00, etc
Hey guys, ml accepts whole numbers, there is no example in the ml file where there is a decimal point after a whole number, e.g. 2.0 would just appear as 2 in the ml file. I'm assuming as more decimal places are required they will be added e.g. 2.546. I wouldn't worry about how exactly numbers appear as you are guaranteed that expressions are valid, there won't be invalid decimal numbers. So you should be able to directly copy the numbers into the C file and let C do the work for you.

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy