Post
Topic
Board Development & Technical Discussion
Re: Is bitcoin v0.10's new libsecp256k1 safe & without mathematical backdoors?
by
Pieter Wuille
on 05/02/2015, 06:48:35 UTC
Code:
void print_number(double x) {
    double y = x;
    int c = 0;
    if (y < 0.0) y = -y;
    while (y < 100.0) {
        y *= 10.0;
        c++;
    }
    printf("%.*f", c, x);
}
Why 100?

I guess some comments here would help. It's just guaranteeing a print of 3 significant digits, so it counts how many places to shift the comma by to bring the number between 100 and 999.....