🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.pl.comp.lang.csharp
Article #972

Re: konwersja int na double

#972
From: Aptu
Date: Mon, 19 Apr 2004 16:45
22 lines
1598 bytes
W wiadomości <c60rfg$9lf$1...@nemesis.news.tpi.pl>
Hubert R. Skrzypek napisał(a):

> Dobra, poradziłem sobie - skonwertowałem na String, dodałem 
> przecinek o zero i jeszcze raz skonwertowałem na double.

Gorzej już się chyba nie dało :-)
Taka konwersja jest niejawna gdyż int zawiera mniej informacji niż
double. Więc możesz zrobic to tak;
int i = 7;
doubje j = i;

A jeżeli chcesz jawnej konwersji to możesz tak
int i = 7;
double j = (double)i;

Jest jeszcze inny sposób z wykorzystaniem klasy Convert
int i = 7;
double j = Convert.ToDouble(i);

-- 
Email: aptu(at)maZapolis.pl zamień 'z' na 'g'
Technical Details
Message-ID: <upta3apcp.fsf@sygnatur.ce>
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!nntp.idg.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail
References: <c60n01$oeg$1@nemesis.news.tpi.pl> <c60rfg$9lf$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!nntp.idg.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail
From: Aptu <adres.w@sygnatur.ce>
Newsgroups: alt.pl.comp.lang.csharp
Subject: Re: konwersja int na double
Date: Mon, 19 Apr 2004 18:45:26 +0200
Organization: GNUS Power
Lines: 22
Message-ID: <upta3apcp.fsf@sygnatur.ce>
References: <c60n01$oeg$1@nemesis.news.tpi.pl> <c60rfg$9lf$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: ak250.internetdsl.tpnet.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1082392995 8881 80.53.168.250 (19 Apr 2004 16:43:15 GMT)
X-Complaints-To: use...@agora.pl
NNTP-Posting-Date: Mon, 19 Apr 2004 16:43:15 +0000 (UTC)
Cancel-Lock: sha1:pBe9100ry3GrbuVcU7wVPY5n3cQ=
X-User: aptu
X-PGP-Fingerprint: 6246 109F E92E 948A 322A  7CD6 D53C A35B 6AEE 8576
User-Agent: Gnus/5.110001 (No Gnus v0.1) Emacs/20.7 (windows-nt) Hamster/2.0.5.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit