r exam type num: answer Inf

112 views Asked by At

I have an moodle exercise where the numerical answer is Infinity. The xml file is generated without issues, however, when importing the question to moodle an R occurred.

Here is a simplified version of the exercise.

```{r data generation, echo = FALSE, results = "hide"}
sol<-Inf
```

Question
========

blblblbl


Solution
========

$x=\infty$

Meta-information
================
extype: num
exsolution: `r fmt(sol, 4)`
extol: 0.0001
exname: prob complemento 2

Is it possible to have infinity answer in moodle numerical type question?

It is important to conserve the numerical type since in some numerical rng instances the answer could be different to infinity

1

There are 1 answers

0
Achim Zeileis On BEST ANSWER

My understanding is that there is no proper way to do this in Moodle. Possibly you have already seen this discussion: https://moodle.org/mod/forum/discuss.php?d=406703.

Personally, I would avoid the problem by making sure that the data-generating process always yields a finite result.

Or if you want to have infinity as a possible answer, transform the exercise to single choice (schoice) and make infinity one of the answer options. For turning numeric into single-choice questions, see this R/exams tutorial: http://www.R-exams.org/tutorials/static_num_schoice/.