@problem@
	@problemtype@
		embedded
	@;problemtype@
	@name@
		tutorial_4_floating_point_numbers
	@endname@
	@preamble@
		y = randfloat(10,20,4)
	@;preamble@
	@content@
		If an approximate answer is acceptable, then it is often preferable to randomly generate appropriate decimal numbers instead of integers. In order to create a random number between 'a' and 'b' with 'k' decimal places, you can use the function call 'randfloat(a,b,k)'. In the above example, the variable 'y' is assigned a random number with 3 decimal places between 10 and 20.
		@pb;@
		In contrast to integers (which will always be shown in their base-10 representation), there are multiple ways to represent a floating point number. Generally, the 'num' command can be used to transform numbers into a readable string of symbols.
		@pb;@
		By default, the command "num(y)" will attempt to represent 'y' as a fraction. This representation, however, will require the use of TeX (cf. Tutorial 10). The command "num(y,keepFloat=True)", on the other hand, will yield a decimal representation; for example y = @num(y,keepFloat=True)@. For an exam problem, the string representation via 'num' should be shown to the student, while the actual numerical value must be used for determining the correct answer (in the 'numericalans' function).
		@lb;@
		Find x such that x + @num(y,keepFloat=True)@ = 42.
		@lb;@
		x = @numericalans(100,42-y)@.
		@pb;@
		In order to show only a maximum number 'n' of decimal places, you can also specify "keepFloat=k" as a named parameter for the 'num' function. For example, z = @num(y,keepFloat=2)@ is an approximation of 'y' up to the second decimal place. The default representation of floating point numbers can also be changed via the configuration (cf. Tutorial 7).
	@;content@
@;problem@