Restrict Math answer box to integer input

Is it possible to restrict Math answer box to integer input

My first thought is that you could use patterns to do this.

1 Like

You can’t restrict it per se, but you can set warnings, using patterns as @Jeff_Holcomb suggests, or seeing if this.numericValue=numericValue(`round(${this.numericValue})`)

I think perhaps Jeff’s is more flexible. If I enter something like 7/2-1/2 it would agree with its rounded value too.

True. In the past, I think I included countNumberUsage:

checkInt= this.numericValue=numericValue(`round(${this.numericValue})`)
and countNumberUsage(this.latex)=1
2 Likes

I’m using Jeff’s approach but had hoped to see an “isInteger” function appear in the intervening years?