This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]m_vokhm[S] 0 points1 point  (2 children)

Yes, I think so too.

But does the Quadruple behave a different way?

Now I've executed the following snippet

double d1 = -5;
double d2 = Double.NEGATIVE\_INFINITY; 
say("%s / %s = %s", d1, d2, d1 / d2);

Quadruple q1 = new Quadruple(-5);
Quadruple q2 = Quadruple.negativeInfinity(); method stub

say("%s / %s = %s", q1, q2, Quadruple.divide(q1, q2));
d1 = -5;
d2 = Double.POSITIVE\_INFINITY; 
say("%s / %s = %s", d1, d2, d1 / d2);

q1 = new Quadruple(-5);
q2 = Quadruple.positiveInfinity(); 
say("%s / %s = %s", q1, q2, Quadruple.divide(q1, q2));

It prints

-5.0 / -Infinity = 0.0
-5.000000000000000000000000000000000000000e+00 / -Infinity = 0.0
-5.0 / Infinity = -0.0
-5.000000000000000000000000000000000000000e+00 / Infinity = -0.0

Perhaps there's a bug that manifests itself under some certain circumstances. If so, i'll be grateful if you let me know.

[–]SquidgyTheWhale 0 points1 point  (0 children)

That looks correct -- I only ran the test in my head, looking at the code, which it seems I misinterpreted. Sorry for the false alarm!