[Vienna-pm] Selsames Anzeigergebnis.

Patrick Meidl patrick at pantheon.at
Wed Mar 29 06:10:21 PST 2006


On Wed, Mar 29 2006, Nagy Wilhelm <wilhelm.nagy at umweltbundesamt.at> wrote:

> koennt ihr mir bitte mal was kurz auf einem euere Kisten ausprobieren
> 
> $sValue = 0.0001;
> $sValue *= 0.75;
> print $sValue;
> 
> bei mir kommt seltsamer weise 
> 
> 7.5e-005
> 
> heraus, was ja ansich richtig ist aber...
> ich erwarte 0.000075
> was so glaube ich bis jetzt geschehen ist.

vielleicht ist das der clue:

$ perl -e 'print 0.000075."\n"'
7.5e-05

$ perl -e 'print "0.000075\n"'
0.000075

d.h. einmal castest du implicit als float, das andere mal als string.

HTH

    patrick

-- 
Patrick Meidl ........................... +44-7770-526961 (mobile)
20 Guest Road ........................... +44-1223-514058 (home)
Cambridge CB1 2AL ....................... patrick at pantheon.at
England, UK ............................. http://pmeidl.homelinux.net/
--



More information about the Vienna-pm mailing list