Here is a test case below.

In short, it's appending the same number to an array, but after 2500 loops 
or so the value changes.

package main
import (
    "fmt"
    "github.com/ncw/gmp"
    // "math/big"
)
func test_gmp_array() {
    index := 0
    output_array := []gmp.Int{}
    for index < 5000 {
        var newnum gmp.Int
        
newnum.SetString("27928410756179523138881080989986005991789933932188228018115755918494634799929873910027825747854697455979387110847058629350347288500624884424807086906801594642406392448568530327829083514883524712985492538589993807582131300292739787897589360129490451849769622648595726892334513355855504557741514903175075958458960111055024641406976670602678887952234068019841236549447926340755063903373950684252611325596552928912480285833159841819645546289989159869982214159616531691638376958340264087137749469269647555189450117026947774590910035240238694361652478067361121651905941283054193444516391789652433009672685099320489013369511",
 10)
        output_array = append(output_array, newnum)
        fmt.Println("array_size: ", len(output_array))
        fmt.Println(&output_array[0])
        index += 1
    }
}

func main() {
    test_gmp_array();
}


On Sunday, May 14, 2017 at 7:53:51 AM UTC-4, Damian Gryski wrote:
>
>
>
> On Sunday, May 14, 2017 at 4:01:26 AM UTC+2, Elise Xue wrote:
>>
>> We're using gmp (library found at https://github.com/ncw/gmp) to run on 
>> large inputs, and we have arrays with thousands of elements at a time in 
>> our code. When we write these arrays to files, we find that the values of 
>> some of the elements have changed.
>>
>>
>> We tested our by code by reading in an input file of large numbers, 
>> casting them to gmp.Int, storing them in an array, and writing them to an 
>> output file. This works for an array of ~1400 numbers, but if the array 
>> gets any larger than that the values in the array change.
>>
>> Below we print the first element of our array each time a new element 
>> gets appended. As the size goes past 1435, the value of the first value 
>> changes, and it changes again when the size goes past 1437:
>>
>>
>>
> Can you provide example code that demonstrates the issue?
>
> Damian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to