MATLAB Answers

0

How does round work?

Asked by Tyler Murray on 10 Nov 2016
Latest activity Answered by Walter Roberson
on 10 Nov 2016
I was trying to figure out how the function round worked. I know the format and everything, I am talking about the actual source code. I tried typing in EDIT round but only instructions came up. The only thing that I can think of is if you have a number like 3.14 you would have to convert that number to a string to determine what character the decimal point is at. From there you can take the number to the right and continue with the appropriate rounding. I just don't understand how MATLAB determines where the decimal is located. Any guesses?

  0 Comments

Sign in to comment.

2 Answers

Steven Lord
Answer by Steven Lord
on 10 Nov 2016

We do not distribute the source code for the built-in round function. If you want to see it you will need to start here.
You may be interested in the general procedures described on Wikipedia.

  1 Comment

Tyler Murray on 10 Nov 2016
I'm not asking for a source code, I am just asking people how they think it is programmed. Just curious.

Sign in to comment.


Walter Roberson
Answer by Walter Roberson
on 10 Nov 2016

Hardware instructions. For example,

  0 Comments

Sign in to comment.