erlug
[Top] [All Lists]

Re: [Erlug] Perl bug nella Debian?

To: erlug@xxxxxxxxxxxxxx
Subject: Re: [Erlug] Perl bug nella Debian?
From: Maurizio Lemmo - Tannoiser <tannoiser@xxxxxxxxxxx>
Date: Tue, 21 Dec 2004 12:04:02 +0100
* martedì 21 dicembre 2004, alle 11:49, Nando Santagata scrive:
> > mizio@hal:~$ perl -e 'print sprintf("%.3f", 1.0051), "\n"'
> > 1.005
> > mizio@hal:~$ perl -e 'print sprintf("%.3f", 1.0055), "\n"'
> > 1.006
> 
> Ho deciso che e` un baco del Perl Cookbook: la sprintf non garantisce
> niente in C [1], quindi secondo me e` scorretto consigliarla per
> l'arrotondamento.

In effetti cosi` la interpreto anche io.

> [1] Ho un libro sullo Standard C, scritto da due chairmen dell'X3J11 (il
> comitato ANSI che ha standardizzato il C) su cui e` scritto che "%.2f"
> fa un "arrotondamento", ma non specifica l'algoritmo. Dovrei leggermi i
> documenti ufficiali, ma non ne ho voglia :-)

Credo che la mail del Sini[1], sia la piu` chiara ed esaustiva sulla
questione.


[1]
Cio` non toglie che "Sinigaglia e` un gonzo".

-- 
                          Maurizio - Tannoiser - Lemmo
                 Founder Member of ERLUG http://erlug.linux.it
-------------------------------------------------------------------------------
BOFH excuse #395:

Redundant ACLs.

<Prev in Thread] Current Thread [Next in Thread>