Search:

Type: Posts; User: thames

Search: Search took 0.01 seconds.

  1. Replies
    18
    Views
    14,724

    Many thanks. I overlooked that.

    Many thanks. I overlooked that.
  2. Replies
    18
    Views
    14,724

    Ok, I coded a simple representation of an...

    Ok, I coded a simple representation of an extended Atof:



    #include <stdio.h>
    #include <string.h>
    #include <ctype.h>
    #include <stdlib.h>
    #include <math.h>
  3. Replies
    18
    Views
    14,724

    I will search for it. edit: Can you show...

    I will search for it.

    edit:

    Can you show me a good link about the algorithm process?



    I see, you're completely right.
  4. Replies
    18
    Views
    14,724

    what I wrote so far. I almost got a...

    what I wrote so far.

    I almost got a scientific notation:



    Please enter a double: -0.00012345
    The double value in scientific notation is -12345e-8
  5. Replies
    18
    Views
    14,724

    I solved the final problem (convert a number like...

    I solved the final problem (convert a number like 125.5 to 1.255e+2) using sprintf. However my array got a lot of junk.

    edit:

    I still didn't fix the output of a number like -125.5



    gdb...
  6. Replies
    18
    Views
    14,724

    I decided, for now, to put every necessary...

    I decided, for now, to put every necessary function inside the main source because is easier to handle everything that way. Why is 0.050000000000000003 the value of val when I input 0.05 as a string...
  7. Replies
    18
    Views
    14,724

    Now I'm only testing numbers like 0.05. ...

    Now I'm only testing numbers like 0.05.



    #include "../Headers/conversion.h"
    #include <stdlib.h>

    void itoa(int n, char* s)
    {
    int sign, i;
  8. Replies
    18
    Views
    14,724

    Sorry for that. From now on, I'll comment the...

    Sorry for that. From now on, I'll comment the codes with certain level of complexity.



    I thought I could do that because of itoa's code snippet:



    do {
    s[i++] = abs(n % 10) + '0';
  9. Replies
    18
    Views
    14,724

    strsci = strcat("e+",strnpow); ...

    strsci = strcat("e+",strnpow);

    Conversion/atof.c:39:6: warning: passing argument 2 of ‘strcat’ makes pointer from integer without a cast [enabled by default]

    why did I get pointer from integer...
  10. Replies
    18
    Views
    14,724

    Atof with scientific notation

    Good afternoon. I'm trying to code a program which converts a string in a double and in a string again but with scientific notation.

    The exercise is from KnR:

    Extend atof to handle scientific...
Results 1 to 10 of 10