mpf_div changes value on a variable which doesn't participate in the division.

Magnus Dicander magnusdicander at gmail.com
Sun Jan 8 10:50:44 CET 2012


I have written a big program which uses groups of 3 mpf_t number which i
call three-d-bignums. I have written a function to print
three-d-bignums. I have 2 division-functions for three_d_bignums, but
they only call mpf_div three times each. When i run my big program,
mpf_div changes the value on a variable which doesn't participate in the
division. How to replicate this bug:
1: Compile and run my program.
2: Say n to the question.
3: Search the program and the output for the text-string
"afterdiv" (without the brackets).
4: You will see that the variable
"electronepointers[0]->velocity_pointer" has different value after the
division compared with before the division, despite the fact that it
does not participate in the division.

The program sets precision to 1000 bits.
I use gmp 5.02.
I have tried this program on 2 Linux PC:s. One 64-bit-PC and one
32-bit-PC. Both changes the value of the variable which does not
participate in the division.

Please tell me if you need more information about this bug.

-- 
Magnus Dicander
Adress:
Sernanders väg 2/714
75261 Uppsala
Tel: 018-4444003
Epost: magnus at dicander.com
Hemsida: http://www.dicander.com/magnus
Skypeid: magnusdicander


-------------- next part --------------
A non-text attachment was scrubbed...
Name: elektronkrafter.c
Type: text/x-csrc
Size: 37308 bytes
Desc: not available
URL: <http://gmplib.org/list-archives/gmp-bugs/attachments/20120108/84e69043/attachment-0001.bin>


More information about the gmp-bugs mailing list