• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

One thing I don't get though is why high schools are teaching stuff like derivatives and integrals without ever touching the basics like very simple logic/discrete math. It's the foundation of everything and for me it made math click (it's also more universally useful than dang gosh integrals, where most of the difficulty is just familiarizing with spoon-fed formulas)
Because calculus is introductory college mathematics for the quantitative sciences and engineering. It's a basic literacy in those fields. Logic and discrete math are so special case and niche that they benefit no one but the mathematician and computer scientist. They are also harder for a lot of people than calculus is.
 

Somnid

Member
But why even bother testing it when anyone with the means to do so on a large enough scale would be better served solving important problems in their field of study? We can test what would happen if we started using the lunar calendar instead of the gregorian calendar too, but what exactly are we hoping to gain, aside from centuries of confusion going forward when trying to read any historical document ever.

What exactly is so broken about using Greek letters that it warrants invalidating thousands of years of mathematical literature? Because some undergraduates are confused? Come on.

We already overturn a lot of traditional, cultural things especially recently, because we've grown to understand that there are invisible problems with it. The way we use pronouns can hurt people who don't subscribe to those labels, the way using objective data for profiling can hurt minorities, the way stupid little jokes comments push women out of sciences. These were never "problems" in the sense that people knew about them, they had to study it to learn that the people most effected by it were the ones who had absolutely no voice in it and even then people acted with apathy because "it's how it's always been done." My thought is, if we've been continually fucking it up and ignorant of the consequences in other areas maybe we should look to see if we're not doing it elsewhere. Are we creating barriers because we refuse to self evaluate?

tfp401i.jpg

I'm actually totally on board with this. I don't particularly like the English bias in programming languages but also you can probably get very expressive while still keeping some brevity if you actually went all in on this idea. Specifically I think about how could you write applications with just a touchscreen. It's an idea that seems stupid because we have keyboards and that's how it's always been done, but does that make the most sense? Also, some of the most impoverished areas people will own phone, not computers. How do you make it accessible both from a language and resource perspective.
 

Koren

Member
We can most definitely swap "Δ" with "change" and it doesn't make a difference to what you are doing but one is much more immediately understandable to someone who hasn't taken an upper-level math class.
Maybe (I'm not even sure)

But when you have four or five different "change", things get harder.

I mean, Δx, dx, δx and ∂x all mean "a variation/change/small quantity of x", but all have a VERY different meaning, especially in physics. I wouldn't want to try to find a name to describe all those meanings.

You can always re-explain basic maths in natural language, but it's SO MUCH more understandable and precise with dedicated notations that I don't see how you would get rid of this. It has nothing to do with trying to annoy beginners or being a language for a small group.

To me, getting rid of those is like getting rid of numbers. Why not replace 5 by "the number of fingers on a hand"? Or 5 dots?

I'm actually totally on board with this.
You would have to replace int, class, var and other things with emoticons, first.

It exists, btw (there's even have been several attempts)

Screen-Shot-2015-06-24-at-13.29.14.png
 

V_Arnold

Member
But seriously, folks..... DELTA being elitist? Against novices?

Novices meet delta. Literally 4 seconds later they find out what delta is commonly used for.

And now novices have ALL the power to realize, undersand and think with delta for the rest of their lives, IN ALL EXISTING PROGRAMS as well as future ones.

Why change this, again?

I proprose reassigning the unique identifiers of e, phi and pi while we are at it. Lets make old and new literature on math incompatible, because why not? My proposal is a randomly generated emoji for every new mention of PI.
 

Somnid

Member
Maybe (I'm not even sure)

But when you have four or five different "change", things get harder.

I mean, Δx, dx, δx and ∂x all mean "a variation/change/small quantity of x", but all have a VERY different meaning, especially in physics. I wouldn't want to try to find a name to describe all those meanings.

You can always re-explain basic maths in natural language, but it's SO MUCH more understandable and precise with dedicated notations that I don't see how you would get rid of this. It has nothing to do with trying to annoy beginners or being a language for a small group.

To me, getting rid of those is like getting rid of numbers. Why not replace 5 by "the number of fingers on a hand"? Or 5 dots?

Replacing them with words does nothing to reduce the meaning, it would simply be more verbose while carrying less cognitive load. In software we already don't use those, some of it related to unicode support and keyboards, but also that it's not seen a particularly necessary to heavily condense (d3.js tried it but abandoned it just recently). Such a proposal would not remove the idea of standardization but rather to rebuild using an evidence-base methodology rather than a tradition-base one. I realize your number question is meant to be rhetorical but it's a good question and you should understand it as such. Does a traditional roman number system really provide the best possible representation? I can't conclusively say but considering it was built thousands of years ago without that in mind I have my doubts.

But seriously, folks..... DELTA being elitist? Against novices?

Novices meet delta. Literally 4 seconds later they find out what delta is commonly used for.

And now novices have ALL the power to realize, undersand and think with delta for the rest of their lives, IN ALL EXISTING PROGRAMS as well as future ones.

Why change this, again?

I proprose reassigning the unique identifiers of e, phi and pi while we are at it. Lets make old and new literature on math incompatible, because why not? My proposal is a randomly generated emoji for every new mention of PI.

There's no substantive argument here, just rhetorical questions I will unironically throw back at you as real questions. How you personally feel about it has no relevance on it's real effects. We'd have to know that it's already fully optimized otherwise it cannot be called a solved problem. In regards to compatibility, much as this is a programming topic conversion from one system to another is pretty trivial, you could easily convert equations from one to another. The assumption is that if you found an improved system, new learning material would supercede older ones, literature would become historical and translated, and current implementations are likely software programs already. If no better proposal occurs, then the current system stands.
 

Koren

Member
Replacing them with words does nothing to reduce the meaning, it would simply be more verbose while carrying less cognitive load.
In many situation, verbosity decrease the readability of formula, though.

Beside, if you choose words, you can either:
- chose brand new "words", and I don't see the difference with symbols, except they're longer (also, which characters? That's cultural, also)
- chose existing words, and you have an increased cultural bias

If you use symbols, I don't see how changing them will help in any way.

I realize your number question is meant to be rhetorical but it's a good question and you should understand it as such. Does a traditional roman number system really provide the best possible representation? I can't conclusively say but considering it was built thousands of years ago without that in mind I have my doubts.
It wasn't totally rhetorical, but it's just a shape associated to a quantity. Would a different shape be better? I doubt it, and the benefit would be marginal at best, with a huge cost.

If no better proposal occurs, then the current system stands.
You're welcome to try devising a better system, but I can't see how you'll succeed.

Readability for beginners count for nothing, when you balance a couple hours to get used to symbols, to a life made easier using them.


Changes can be done, obviously. It happened a lot. Usually, they replaced words by symbols, and everything were easier and clearer. Have you ever read books from Newton, Leibniz or Huygens? They used words for maths, it's just utterly unreadable, even if you exactly now what they're talking about.

Leibniz notation have been seen as a huge step in the right direction, and I don't think many people would like to go back.
 

vypek

Member
I'm in school and like programming, but have no idea what I want to do with it in terms of career. I need to make a decision.

For you guys working in related fields how did you decide?

As in what area to focus in or you want to know what kind of jobs most CS majors go to?
 

ricki42

Member
Replacing them with words does nothing to reduce the meaning, it would simply be more verbose while carrying less cognitive load.
I think it would end up increasing cognitive load. Reading an equation that's spelled out in words makes it really hard for me to grasp the underlying math. On the other hand, an equation using common symbols is a lot easier to understand, to sort into components, and to work with.

I realize your number question is meant to be rhetorical but it's a good question and you should understand it as such. Does a traditional roman number system really provide the best possible representation? I can't conclusively say but considering it was built thousands of years ago without that in mind I have my doubts.

I'm pretty sure most people would agree that the roman system isn't optimal, which is why it's not in common use any more and we use arabic numbers instead. This system didn't just appear one day out of nowhere, it evolved along with our understanding of maths, and other systems that didn't work as well, like the roman system, were discarded. Same with the rest of mathematics, different systems were used and at some point converged to where we are now. I'm in physics, and sometimes reading older papers I see slightly different notations than what is commonly used these days. Some of that is because special characters and complicated equations were harder to typeset, some of it is because the older notation turned out to be less clear. This kind of refinement and improvement is an ongoing process.
 
I'm interested in making a website for a local cafe for practice because they have apparently been locked out of their own. I have the skills in terms of html/css/js, but I'm guessing they would want to be able to update their menu page every now and then. Does that mean I have to add some kind of Content Management System? Do I make that on my own or what?
 

Mr.Mike

Member
I remember at some point in high school chemistry we were using the variables m, M and mu all in the same equation/context. I thought that was kind of silly, to the point where it's stuck with me while I don't even remember what those equations were even for anyway.

The notation is largely arbitrary anyway, and perhaps that's something we ought to get across to kids. Teach them delta or whatnot is the convention but they could totally use whatever else they want. And beyond the use of certain symbols for variables expose them, just a little bit to get the point across, different notations for writing numbers and expressing operations, stuff like different bases, different symbols for digits, different orderings of "places", postfix and prefix ordering and so on. The hope here being that it'll help them really understand math, because I suspect most people's experience with mathematics consists of memorizing ways to manipulate symbols to get a good grade, and in the end achieving a really shallow understanding of math. This is perhaps the whole trope of "I was only good at math up to ..." comes from. (And the sentence "I was never good at math" is maybe really concerning since it's kind of an admission that they couldn't memorize some steps and follow pretty simply instructions ).
 

Chris R

Member
No reason to reinvent the wheel. CMS has been done before, find a solution that works for you and bake it in.

And they SAY they want to update their menu, I've seen very few restaurants that follow through with that though. It might be easier to point the menu to a PDF and have them just scan in the menu and replace the file every now and then :/
 

Mr.Mike

Member
Locked out of their website? The easiest route would probably be to help them get back into whatever their website situation is , or maybe the hardest, I guess it'd depend on how they are with computers.

Anyway, I disagree with the pdf menu thing. It'd work but a much better solution shouldn't really be that much more effort (well, shouldn't).
 
I think the people here arguing to reinvent math notation have never done a serious physics problem before.

Programming obviously is better and more readable when words and functions are used, which is a requirement unique to the field. In a mathematical context, however, one almost demands the concision afforded by symbolic notation, and the notation will always be familiar because 1) the reader is assumed to have familiarity and 2) symbols are always defined prior to use, anyway.
 

Koren

Member
anyone has a fast function for computing number of divisibles of k within a range including negative values laying around?
The number of divisorsof k?

You need to tell us a bit more. What is the "size" of k? Any examples of the interval? Will you compute this number for several k? Have you memory available?

A way would be to compute the prime factors of k (for example using the sieve of Atkin), then counting the divirons in the range (if I understood correctly what you want).

Obviously, using the sieve of Atkin will work better if you can do pre-computations and store the primes...
 

JesseZao

Member
The number of divisorsof k?

You need to tell us a bit more. What is the "size" of k? Any examples of the interval? Will you compute this number for several k? Have you memory available?

A way would be to compute the prime factors of k (for example using the sieve of Atkin), then counting the divirons in the range (if I understood correctly what you want).

Obviously, using the sieve of Atkin will work better if you can do pre-computations and store the primes...

Simplest is just brute force check all numbers from 2 -> sqrt(num) with modulo.
 

Skinpop

Member
The number of divisorsof k?

You need to tell us a bit more. What is the "size" of k? Any examples of the interval? Will you compute this number for several k? Have you memory available?

A way would be to compute the prime factors of k (for example using the sieve of Atkin), then counting the divirons in the range (if I understood correctly what you want).

Obviously, using the sieve of Atkin will work better if you can do pre-computations and store the primes...

given the integers a, b and k, count the number of integers from a to b that are divisible with k.

handling the case where a and b are positive at O(1) is easy but I'm not sure how to deal with negative ranges.

I'm using a placeholder with a loop but that obviously has horrible worst case complexity.
 
given the integers a, b and k, count the number of integers from a to b that are divisible with k.

handling the case where a and b > 0 at O(1) is easy but I'm not sure how to deal with negative ranges.

I'm using a placeholder with a loop but that obviously has horrible worst case complexity.

Use a sieve of eratosthenes combined with dynamic programming
 
You could try splitting the ranges into positive and negative collections.

Then convert the negative ones to positive and count them as normal.
Do the same to the positive collection (without inverting it).

Combine both counts to get the total sum??

Or just use one collection and use an if statement to check if negative, invert if so etc..

Not sure if they would work 100% just spit balling coming towards the end of a 12 hour shift so my idea could be wonky.

I could be a bit brain dead right now hah

EDIT:

Actually you probably don't need to invert anything. If you are checking if something is divisible using modulo operator then it won't matter if the number is positive or negative if it is divisible by the number without a remainder then the answer will be 0.

Simply count the numbers that are divisible?

If I'm not making sense or giving a naive answer then forgive me, 12 hour shifts are a hell of a drain on the brain.
 

Skinpop

Member
I tried that and other things. Actually, after some tinkering I think I might have it.
How does this look:

Code:
CountDivisors(int a, int b, int d)
{
	int amod = a % d;

	if (amod != 0)
	{
		if (a < 0)
		{
			a -= (amod);
		}
		else
		{
			a += (d - amod);
		}
	}

	int bmod = b % d;

	if (b < 0)
	{
		b -= (d + bmod);
	}
	else
	{
		b -= bmod;
	}

	return (b - a) / d + 1;
}
Seems to work like expected, hopefully I don't have any bugs.

Simply count the numbers that are divisible?
This is what my placeholder did but if I have a very large range and small k.. then it might take a while. Anyway hopefully the solution I came up with is correct.
 
No reason to reinvent the wheel. CMS has been done before, find a solution that works for you and bake it in.

And they SAY they want to update their menu, I've seen very few restaurants that follow through with that though. It might be easier to point the menu to a PDF and have them just scan in the menu and replace the file every now and then :/

That is what I was hoping you would say. After doing a little research I see that as far as I can tell there are some free and simple CMSes out there that I guess are downloadable clients that grab files from the server and looks for certain classes to let the cafe owner change the content. Not bad.

I will say that the reason they found out they are "locked out" was they went to add the address of their new location and update their menu so the need is there to an extent.

Locked out of their website? The easiest route would probably be to help them get back into whatever their website situation is , or maybe the hardest, I guess it'd depend on how they are with computers.

Anyway, I disagree with the pdf menu thing. It'd work but a much better solution shouldn't really be that much more effort (well, shouldn't).

Yeah I don't know how they are "locked out" or what that entails, because I spoke to the owners of the second location not the original owners. I wanted to check with yall about the CMS stuff before I went to the original place and offered to help. More than anything I like the place and don't want the second one to fail because no one knows about it.
 

Koren

Member
given the integers a, b and k, count the number of integers from a to b that are divisible with k.

handling the case where a and b are positive at O(1) is easy but I'm not sure how to deal with negative ranges.
I see...

I understand better, now.

The only problem with negatives is the way the mod or % is implemented, so it depends on the language if you're not careful.

If I'm not mistaken, this should work:
Code:
( abs(b-a) - (abs(a) % abs(d)) ) / abs(d) + 1

(you can replace abs(d) by d if d is positive)
 
I have an Android programming book that I really enjoyed back in December for the few chapters I got into, however there were a few things that were off even back then (really just with operation of Android Studio that had already underwent changes). It was the Big Nerd Ranch volume 2 I believe. Is that book probably too outdated now? And if so, got any better recommendations? I know Java.

Also I kind of prefer books to online tutorials. Does anyone else feel this way? I know books have limitations being locked in as print, but honestly most of my time trying to learn computer science stuff over the Internet with the exception of stack overflow and codecademy seems to be a mess or full of errors pointed out in the comments.
 

NetMapel

Guilty White Male Mods Gave Me This Tag
Today I finally got my Python script to run within a software :D what it does is that it copies the designated folder and its contained files to another designated folder. Then it renamed the folder and the containing files to something else I wanted. I was pretty happy about that and I want to make it even better. I work in a Windows environment so I wrote a code to check if the folder and files already exist in the designated area. If so, I want to delete it and copy it from source again so it works like a replace. However, I get the error that says files already in use so I os.remove() won't work. Any help you guys can provide on that? Thanks :)
 

Skinpop

Member
I see...

I understand better, now.

The only problem with negatives is the way the mod or % is implemented, so it depends on the language if you're not careful.

If I'm not mistaken, this should work:
Code:
( abs(b-a) - (abs(a) % abs(d)) ) / abs(d) + 1

(you can replace abs(d) by d if d is positive)
thanks!
This is so much nicer than my solution.
If anyone is wondering I'm using it to generate spaced lines in an offset view.

edit: it doesn't handle a == b though but that's trivial enough to fix. :)
 

Koren

Member
edit: it doesn't handle a == b though but that's trivial enough to fix. :)
I'm deeply sorry, I was tired yesterday, after looking at news channel till late in the night, and I've written something stupid. It's far worse than that: the formula simply doesn't work.

Long version (that I hope correct), assuming d>0:
Code:
int Count(int a, int b, int d) {
    if (a<b) {
        int n = (a-1)%d;
        if (n<0)  n+=d;         // To deal with different % in C
        return (b-a+n+1)//d;
    } else {
        int n = (b-1)%d;
        if (n<0)  n+=d;
        return (a-b+n+1)//d;
    }
}
% isn't completely defined in C for negative values, so that's tricky.

Or, shorter, assuming d>0:
Code:
int Count(int a, int b, int d) {
    if (a>b) return Count(b, a, d);
    int n = (a-1)%d;
    return (b-a+n+1)/d + (n<0?1:0);
}

Assuming a<=b and d>0:
Code:
int Count(int a, int b, int d) {
    int n = (a-1)%d;
    return (b-a+n+1)/d + (n<0?1:0);
}

Please test those formulas carefully, I woke up with a big headache this morning, and I can barely think. I'm probably as dumb as yesterday evening :/

Sorry again.

Man, Prolog is weird.
| ?- likes(Prolog, weird).
yes.

definitively.

However, I get the error that says files already in use so I os.remove() won't work. Any help you guys can provide on that? Thanks :)
Do you have an idea about who could use the file? How do you check whether the files exists?
 

Skinpop

Member
I'm deeply sorry, I was tired yesterday, after looking at news channel till late in the night, and I've written something stupid. It's far worse than that: the formula simply doesn't work.

Please test those formulas carefully, I woke up with a big headache this morning, and I can barely think. I'm probably as dumb as yesterday evening :/

Sorry again.

No need to apologize, I always make sure to test and understand whatever I use anyway. I'm thankful for your help especially considering you had a headache while doing it, hope you get better soon.
 
What's the best way to avoid arrowhead patterns in Scala when everything returns Futures and Options? All my methods seem to end with }}}}}}}}} all the time, no matter how much composition I try to use.
 

komplanen

Member
5.4
6.5
8.9
7.8

Those 4 float numbers, add them together and it's 28.6, divide by 4 and the average is 7.15. Now I use the term %.1lf in my printf to display it with just one decimal but %.1lf also rounds it so it shows as 7.2 but the expected result is 7.1 :-(

How do I display in printf the value of 7.15 as 7.1 without rounding?
 
5.4
6.5
8.9
7.8

Those 4 float numbers, add them together and it's 28.6, divide by 4 and the average is 7.15. Now I use the term %.1lf in my printf to display it with just one decimal but %.1lf also rounds it so it shows as 7.2 but the expected result is 7.1 :-(

How do I display in printf the value of 7.15 as 7.1 without rounding?

Code:
float f = 7.15f;
float f2 = truncf(f * 10.0f) / 10.0f;
printf("%0.1f", f2);

If you want you can write this function:

Code:
float truncf_n(float f, unsigned places) {
  float factor = pow(10.0f, places);
  return truncf(f * factor) / factor;
}

int main(int argc, char **argv) {
  printf("%0.1f", truncf_n(7.15f, 1));
}
 
5.4
6.5
8.9
7.8

Those 4 float numbers, add them together and it's 28.6, divide by 4 and the average is 7.15. Now I use the term %.1lf in my printf to display it with just one decimal but %.1lf also rounds it so it shows as 7.2 but the expected result is 7.1 :-(

How do I display in printf the value of 7.15 as 7.1 without rounding?
What you're asking for isn't going to be simple because it's incorrect and unexpected behavior. Truncating places demands rounding, otherwise you are misrepresenting the number. So that's why the typical formatting options round.

That said, you could multiply by 10, floor, and then divide by 10. That seems to be a simple way to do it.

Edit: Wrecked. Cppking the expert as usual.
 

komplanen

Member
Code:
float f = 7.15f;
float f2 = truncf(f * 10.0f) / 10.0f;
printf("%0.1f", f2);

If you want you can write this function:

Code:
float truncf_n(float f, unsigned places) {
  float factor = pow(10.0f, places);
  return truncf(f * factor) / factor;
}

What you're asking for isn't going to be simple because it's incorrect and unexpected behavior. Truncating places demands rounding, otherwise you are misrepresenting the number. So that's why the typical formatting options round.

That said, you could multiply by 10, floor, and then divide by 10. That seems to be a simple way to do it.

Edit: Wrecked. Cppking the expert as usual.

I ended up going the same route after making my post. Googled a bit and figured that multiplying by 10, casting as int and then dividing it by 10 is the only proper way to do it.

I honestly have no fucking clue why the expected result was different. I hate programming this summer course. Everything must be coded on their website without any intellisense or syntax highlighting. Nothing in the theory for this chapter or the task itself suggested I would have to use anything other than %.1lf in the printf line.
 

Koren

Member
I ended up going the same route after making my post. Googled a bit and figured that multiplying by 10, casting as int and then dividing it by 10 is the only proper way to do it.
Not sure it's even a proper way to do this, depending on what you're after...

Yes, it seems reasonable enough, but
Code:
printf("%.4f", truncf_n(0.2047, 4));
will for example display... 0.2046!

In some cases, printing the rounded value with an additional digit in a string, then removing the last char of the string may be safer/better, although ugly.
 

komplanen

Member
Not sure it's even a proper way to do this, depending on what you're after...

Yes, it seems reasonable enough, but
Code:
printf("%.4f", truncf_n(0.2047, 4));
will for example display... 0.2046!

In some cases, printing the rounded value with an additional digit in a string, then removing the last char of the string may be safer/better, although ugly.

Thanks for the reply. I'm still mostly just confused why the dumb task even expected to do anything like this. I'm actually confident I won't need to think about rounding like this ever again.

I'm almost going to just find a tutor teacher and mail them to ask what the heck was up with that task.
 

NetMapel

Guilty White Male Mods Gave Me This Tag
Do you have an idea about who could use the file? How do you check whether the files exists?
So the Python script I made is supposed to do the follow:
1) Copy source folder and its containing files
2) Move folder and containing files to destination location
3) Batch rename the destination folder and files

Of course, before so if any of that, I used os.exists and os.isfile to examine if the folder already exists. I have a little message box pops up right now that said the folder already exists otherwise it errors out. So I figure the easiest way to do this is to just use os.remove to remove the destination folder if it already exists. However, it is being used by another process so the remove operation cannot be performed :( anyways, hope this is more clear with what's happening. Any help would be appreciated! Thanks :)
 
Thanks for the reply. I'm still mostly just confused why the dumb task even expected to do anything like this. I'm actually confident I won't need to think about rounding like this ever again.

I'm almost going to just find a tutor teacher and mail them to ask what the heck was up with that task.

Programming is about encountering difficult problems and solving them. You can have something explained to you 100 times, but until you've encountered it yourself it doesn't really sink in.

Presumably your teacher has explained about imprecise represntation of floating point. Now you have an actual experience to back that up
 

Koren

Member
However, it is being used by another process so the remove operation cannot be performed :(
I see. But the issue is that Windows will forbid you to remove the file as long as there's someone "using" it. It can be an unclosed file descriptor somewhere, or something like this. There's no easy way around it, the first task would be to


Presumably your teacher has explained about imprecise represntation of floating point. Now you have an actual experience to back that up
Those rounding issues keeps bothering me. I keep getting issues with floats, or troubles trying to prove an algorithm work, and last time I wanted to write an algorithm that wouldn't work because of floats rounding issues, I discovered that the "banker's rounding" made the task impossible: the algorithm was working in all cases!

Should you can set up rounding "half-way" to up, I think that
Code:
printf("The percentage is %.1f", (value-0.05) )
would be the easiest solution. But evidently, we don't have the correct rounding here :/ It will work with 7.2 but not with 7.1...


A researcher friend of mine works on floating point issues, among other things. One of her recent research paper was about "how should you compute (a+b)/2" (obviously, for large values, a/2+b/2 is better, and for small values, (a+b)/2 is better, but finding where exactly are the boundaries is tricky).

Another example I ran into a couple months ago. Both snippets run on the same computer, just not the same Python interpreter:
Code:
Python 3.2.5 [GCC 4.8.3] on cygwin

>>> 1.0 + (2.0**-53 + 2.0**-64) == 1.0
True
Code:
Python 3.4.1 |Continuum Analytics, Inc.| on Windows (32 bits).

In [1]: 1.0 + (2.0**-53 + 2.0**-64) == 1.0
Out[1]: False

Both are actually "correct" according to the IEEE rules, if I'm not mistaken.
It's just because, I think, one of them use extended-80, the other not.
 
Top Bottom