One bug of mpf

穆彤东 lifetermity at icloud.com
Sat Oct 3 03:27:49 UTC 2015


GNU mp group:
    GNU mp is a good mp library, I want to say thanks to you nice people. 

iPhone 4
IOS7.0.1 
clang 3.5.0
gmp6.0.0

program:
#include <gmp.h>
#include <stdio.h>
void main()
{
    char* s1,*s2;
    mp_exp_t exp1,exp2;
    mpf_t f1,f2;
    mpf_init_set_str(f1,"220",16);
    mpf_init_set_str(f2,"12",16);
    s1=mpf_get_str(0,&exp1,2,0,f1);
    s2=mpf_get_str(0,&exp2,2,0,f2);
    printf("0x220 -> %s\n0x12 -> %s",s1,s2);
}

Output is:
0x220 -> 10001
0x12 -> 1001

Zeros at the end lost.

发自我的 iPhone


More information about the gmp-bugs mailing list