Fortran output



>     Judah> 1. On Fortran output, is there a way to cause floats to come out with a
>     Judah>    "d0" at the end? Some compilers really do want this.
> 
> What happens, then, if you really wanted single-precision floats?

> What happens, then, if you really wanted single-precision floats?  I
> think maxima has historically always done everything in
> double-precision, so all number are doubles.

Hi,

[did you mean "all numbers are singles"?]
If you really want single-precision, but append "d0", there's no problem
from an execution point of view, although I suppose in some cases it
could cost you performance. Just speculating.

The other way around however will produce unexpected results with some
compilers. Example, with g77 (gcc 3.2) on a PIII:

      program buggy
      double precision pi,pibug
      pi=3.14159265358979d0
      pibug=3.14159265358979
      write (6,*) pi,pibug
      end

Prints two versions of pi, differing in the 8th significant digit:

f77 buggy.f
./a.out
  3.14159265  3.14159274

Some compilers don't do this, some do, either way it's legal Fortran 77,
so you have to plan for the worst.

Maybe the "d0" could be an switchable option.
For now I'm just postprocessing the output with a simple Python script;
eventually I'll build up the courage to try it in Lisp.

Judah