Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Rounds a number away from zero
ResourceFunction["RoundAwayFromZero"][n] rounds n away from 0. | |
ResourceFunction["RoundAwayFromZero"][n,a] rounds n away 0 but to a multiple of a. |
Round a number:
| In[1]:= |
| Out[1]= |
Round a negative number:
| In[2]:= |
| Out[2]= |
RoundTowardsZero is Listable:
| In[3]:= |
| Out[3]= |
Round 'outwards' to a multiple of 0.25:
| In[4]:= |
| Out[4]= |
The opposite (rounding towards zero) can be achieved using IntegerPart:
| In[5]:= | ![]() |
| Out[5]= | ![]() |
| In[6]:= |
| Out[6]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License