fb_HAG - mkraska/meclib GitHub Wiki
Hypotenuse too long or too short?
fb_HAG(H, A, G)
H
hypothenuseA
,G
kathetes
Returns a string with feedback text, to be displayed in a feedback branch, where the variables have been checked already using fb_vars.
The values are displayed using float()
and any stars *
are replaced by small spaces. It is not recommended to have more than one symbolic variable in the expressions. This variable must have a declared sign (e.g. assume(a>0)
).
fb_HAG(%_H, %_A, %_G):=block([fpprintprec:3,txt:""],
if %_H <= max(%_G, %_A) then txt: sconcat(
" Die Hypotenuse (\\(", float(%_H),
"\\)) muss größer als die größte der beiden Katheten (\\(",
float(%_A), ", ", float(%_G),"\\)) sein."),
if %_H >= %_G+%_A then txt: sconcat(
" Die Hypotenuse (\\(", float(%_H),
"\\)) muss kleiner als die Summe der beiden Katheten (\\(",
float(%_A), "+", float(%_G),"=",float(%_G+%_A),"\\)) sein."),
ssubst("\\,", "*", txt)
);
PRT Node
If you don't need the result of the test elsewhere, then you just put the function call where you want the feedback.
{@fb_HAG(H, A, G)@}