Archive

Posts Tagged ‘bug’

The One where I spent a morning because -0.5 turned to be parsed as 1/2

September 5th, 2010 Serabe No comments

This summer, I have been doing some amazing stuff for GeoGebra. First of all, I would like to thank two people: Miguel, my mentor, who guided me through all that really advanced mathematical stuff; and Heinz Kredel, JAS creator and developer, who answered all my questions and implemented my suggestions as quickly as I could write them.

This story is about a problem we found in JAS. It was really subtle, so I may need a brief introduction to the project I worked on: LocusEqu. That project retrieves the equation of “any” geometrical locus. If you don’t know what a locus is, Wolfram Math World defines it as “the set of all points (usually forming a curve or surface) satisfying some condition” . LocusEqu generates a few EquationExpression, and then, by using a EquationTranslator, it generates a GenPolynomial<BigRational> object.

For translating doubles, it calls the BigRational constructor whose only argument is a String. This is the code:

Can you spot the bug? Look at the 21st line. If s is “-0.5″, then n is new BigInteger(“-0″), and that’s what makes “-0.5″ be parsed as 1/2.

article clipper The One where I spent a morning because  0.5 turned to be parsed as 1/2
 
share save 171 16 The One where I spent a morning because  0.5 turned to be parsed as 1/2

Ay, Serabe, que no haces nada ni tan siquiera regular.

May 18th, 2008 Serabe 3 comments

Hoy me he tirado unas cuatro horas para encontrar un bug, uno de estos puñeteros bichos que te atrapan y te dejan cosas como estas:
black Ay, Serabe, que no haces nada ni tan siquiera regular.
Para que os hagáis una idea, tenía que ser esto:
really black Ay, Serabe, que no haces nada ni tan siquiera regular.
Como se puede apreciar, son sensiblemente diferentes. Así que cuatro horas de mi vida han transformado lo primero, en lo segundo.

El problema venía en que, tal y como Tom (mi mentor del GSoC) propuso, se ha cambiado la clase PixelPacket de forma que ahora trabaja con enteros. El problema, mejor no os lo cuento que es más aburrido que lo anterior.

En fin, que hoy me voy a la cama con un ego más grande que el de Enrique Dans.

article clipper Ay, Serabe, que no haces nada ni tan siquiera regular.
 
share save 171 16 Ay, Serabe, que no haces nada ni tan siquiera regular.