This is a list of commonly used functions in the code portion of the Editor. If you have any questions about how they operate feel free to email us.
Function name | Description | Argument type | Return type | Example | Default answer | Alternate answer(s) |
---|---|---|---|---|---|---|
oRandom(min1,max1,min2,max2,sigfig,def) | Returns a number either between min1 and max1 or min2 and max2 with the specified number of significant digits | numbers | double | oRandom(1, 1.5, 3, 3.5, 3, 1) | 1 | 1.25, 3.3, many others |
randomStep(min,max,step,def) | Generates a random number | numbers | double | randomStep(1, 5, 1, 3) | 3 | 1, 2, 4, 5 |
reducedFrac(a,b) | Reduces a/b to simplest form | int or double | char* | reducedFrac(12,6) | 2 | |
roundoff(num, precision) | Rounds off a number Note: drops trailing zeros | numbers | string or double | roundoff(4.056, 3) x=4.02 roundoff(x, 2) | 4.06 4 | |
sigfig(num, precision) | Rounds off a number. | numbers | string | sigfig(4.056, 3) x=4.02 sigfig(x, 2) | 4.06 4.0 | |