Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

document that we do machine arithmetic #2085

Closed
StefanKarpinski opened this issue Jan 18, 2013 · 10 comments
Closed

document that we do machine arithmetic #2085

StefanKarpinski opened this issue Jan 18, 2013 · 10 comments
Labels
docs This change adds or pertains to documentation performance Must go faster

Comments

@JeffBezanson
Copy link
Member

Fixed in 016823a

@waldyrious
Copy link
Contributor

Wouldn't it be relevant to also add some notes on why machine arithmetic is used? Specifically something along these lines (with some polishing):

Julia is able to produce code that runs faster in part because Julia represents problems using units of computation like integer and floating point arithmetic that are hardcoded by modern chips. Lots of other dynamic languages are less efficient because they invest a lot of computational resources in hiding the underlying machine from the user. Julia's approach is very different from what other dynamic languages take, and is much closer to C. C, Assembly, etc. don't check memory registers for overflow after every operation. Julia promotes manual checking after certain operations that the programmer, not the language, deems "suspect". This is exactly how languages such as Assembly and C have done things for decades.

@johnmyleswhite
Copy link
Member

+1 for this text

-- John

On Apr 18, 2013, at 7:46 AM, Waldir Pimenta [email protected] wrote:

Wouldn't it be relevant to also add some notes on why machine arithmetic is used? Specifically something along these lines (with some polishing):

Julia is able to produce code that runs faster in part because Julia represents problems using units of computation like integer and floating point arithmetic that are hardcoded by modern chips. Lots of other dynamic languages are less efficient because they invest a lot of computational resources in hiding the underlying machine from the user. Julia's approach is very different from what other dynamic languages take, and is much closer to C. C, Assembly, etc. don't check memory registers for overflow after every operation. Julia promotes manual checking after certain operations that the programmer, not the language, deems "suspect". This is exactly how languages such as Assembly and C have done things for decades.


Reply to this email directly or view it on GitHub.

@jiahao
Copy link
Member

jiahao commented Apr 18, 2013

Can users check for overflow explicitly in Julia? I can understand if the default behavior is to not check explicitly, but it would be very important to check for some applications. Is there an overflow flag that is set that can be tested for, without some clunky test like checking if a positive integer suddenly turned negative? I see some people mentioning this but didn't see a clue of whether such a thing existed.

jiahao added a commit that referenced this issue Apr 18, 2013
[x] Fixes typos, minor formatting and grammar issues and uses check marks
[x] Better cross-referencing
[x] Adds explanation of how primitive numeric types map onto machine arithmetic (#2085)
@StefanKarpinski
Copy link
Member Author

Open issue for arithmetic overflow checking: #855.

@StefanKarpinski
Copy link
Member Author

I like @Waldir's text above. What's the source of the text?

@JeffBezanson
Copy link
Member

Performance is really the only reason. It's not that we think tediously manually checking everything is good. In fact we will provide options to do more automatic checks.

@jiahao
Copy link
Member

jiahao commented Apr 18, 2013

@StefanKarpinski The first part appears to come from @johnmyleswhite in the first discussion thread you posted.

I've added a paragraph to similar effect to the beginning to the numbers section, but am wondering now if the specific sentence about "hiding the underlying machine from the user" should have been put in as well.

@waldyrious
Copy link
Contributor

What's the source of the text?

It's a shortened version of a selection of quotes from this thread, which I originally posted here. These are the same links as those you used in the opening comment of this issue.

@andrioni
Copy link
Member

If a overflow flag is to be developed, it'd be good if it were extensible enough to also work with the MPFR flags. I'm trying to think of a good way to expose them in BigFloat, but have yet to find it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This change adds or pertains to documentation performance Must go faster
Projects
None yet
Development

No branches or pull requests

6 participants