Does anyone know whether there is a way to run gnuplot with quadruple arithmetic precision? E.g. When you want to plot a line and you want to subtract a value like "2.3403800935287029218841060098446498" from values that vary only right hand to the 16th digit from this value.

Any input on this problem is much appreciated.

  • Can you show example input of the data, and possibly the commands you want to use. Do you want to perform the subtraction at the input data level or later? – AdminBee Sep 23 at 9:36

If all of the first 16 digits always truly match, why not write a kludge text editor that converts all of the matching digits in both terms to 0's and then use double precision to get the difference term that can be used in the input.

Might be a quick, but not very general & maybe not what you are looking for. Don't know the specifics about input. But as an example, leaving comments out of the actual file, values.txt):

  • file values.txt

  • file junk.csh

    awk 'BEGIN{last="XXX";} \
                       { gsub(/[0-9]/," & "); split($0,a," "); \
                          if (last!~/XXX/) {split(last,b," "); \
                          i=1; minlen=(length(a)<length(b))? length(a):length(b); \
                          while  ((a[i]==b[i])&&(i<minlen)) { if ((a[i]!=".") && (a[i]!="-")){a[i]=0; b[i]=0; }; i++; };}; \
                          last=$0; } \
                     END{ for(i=0; i<length(b); i++) printf("%s",b[i]); printf("\n");    \
                          for(i=0; i<length(a); i++) printf("%s",a[i]); printf("\n"); }' \
               | awk 'BEGIN{last="XXX"} { if (last!="XXX") printf("%38.35f\n",last-$0); last=$0 } '
  • Run as

    $ cat values.txt | source junk.csh
| improve this answer | |
  • 1
    jmf you appear to have two accounts. Please consider merging them so you can then edit your own answer(s). – roaima Sep 23 at 20:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.