[sac-user] print function alternatives?

Carl A Joslin caj at sac-home.org
Fri Aug 6 00:25:13 CEST 2010


One item Nil forgot to mention is that after adding the files to your
stdlib you will need to recompile your standard lib.  You should not
need to reconfigure your stdlib.

Carl

On 05/08/10 19:31, Nil Karavadara wrote:
> Dear Michael,
> 
> Necessary changes has been made in order to provide format support in printing.
> In order to enable this on your machine you need to follow this steps:
> 
> 1) Replace file "ArrayIO.sac" in "stdlib/world/stdio"
> 2) Replace file "PrintArray.c" in "stdlib/world/stdio/src/ArrayIO"
> 3) Compile the standard library (stdlib)
> 
> Please find ArrayIO.sac, PrintArray.c attached.
> 
> After this you will be able to provide format string as a parameter to
> print function call,
> 
> use Array:all;
> use StdIO:all;
> int main()
> {
>  x = 0.07;
>  z = tod(reshape([5,5],iota(25)));
>  print(x);
>  print(z);
>  print("%30.20f",z);
>  return(0);
> }
> 
> As you can see there is two way you can print now, if no format string
> provided then it prints using default format (line 7,8), or you can
> specify the format string (line 9). The output of example is attached.
> 
> 
> If you have any further comments or queries please do not hesitate to
> contact me.
> 
> 
> 
> On Mon, Aug 2, 2010 at 5:20 PM, Bullington, Michael
> <michael.bullington at ttu.edu> wrote:
>> To whom it shall concern:
>>
>>
>>
>> I was tracing some logic errors on a program that would perform Singular
>> Value Decomposition (SVD) and was using the print function to print values
>> in tracking the logic errors.  However, I had to resort to more “standard”
>> printf functions using %30.15f format strings (up to 15 decimal places) to
>> discover I had computation round-off errors.  The round-off errors became
>> extremely deceptive when the print function was used in tracking the errors
>> because the rounding gave output the appearance of correctness.  The print
>> function in SAC seems to just use the “standard” %f format string which has
>> a default of 6 decimal places.
>>
>>
>>
>> Is there an alternative (overloaded) form of the print function in SAC where
>> I can control some of the output formatting and not have to resort to
>> printf?
>>
>>
>>
>> _______________________________________________
>> sac-user mailing list
>> sac-user at sac-home.org
>> http://lists.sac-home.org/mailman/listinfo.cgi/sac-user
>>
>>
> 
> 
> 
> 
> 
> _______________________________________________
> sac-user mailing list
> sac-user at sac-home.org
> http://lists.sac-home.org/mailman/listinfo.cgi/sac-user



More information about the sac-user mailing list