From: "Eugene Ostapets" <eostapets@gmail.com> To: "ALT Linux Community" <community@lists.altlinux.org> Subject: Re: [Comm] c language question Date: Sat, 4 Nov 2006 20:30:19 +0200 Message-ID: <e12fd2db0611041030j20b8baf0ub10c649878c15b0@mail.gmail.com> (raw) In-Reply-To: <454CDAD0.6020805@iop.kiev.ua> 04.11.06, Andrey Rybak<ra iop.kiev.ua> написал(а): > > >> (Или atof гарантированно возвращает, в данном > >> примере, либо .16 либо 15.99999... ? > ----------------------- для меня важно это в контексте вашего ответа > >> Тогда с дирекшионом проблем нет) > >> И чем эти функции отличаются от ceil & floor? Опять-таки не избежать > >> явного приведения типов (int) > >> Это я к тому - а что ж я плохо понимаю тогда? > >> > > Разницу между > > a=0.16 > > a=0.2*0.8 > > В первом случае сохранится 0.16, а во втором - 0.1599999999999... > > Округлять приходится всегда, а уже потом заниматься приведением > > типов... > > > Хорошо - уточню часть моего вопроса. > Перед округлением обязательно направление округления определять? Т.е. > определить ближайшие целые (они с обеих сторон), а потом в зависимости > от того, кто ближе выбирать направление округления? Обычно направление округления определяется задачей... Для большинства случаев подходит правило a<0.5 - a=0, a>=0.5 - a=1, и это делает round, но для бухгалтерии такой варант не подходит - там свои заморочки когда и где окргулять к ближайшему целому, а когда к ближайшему большему целому... Так что метод округления зависит от полной задачи... > _______________________________________________ > Community mailing list > Community@lists.altlinux.org > https://lists.altlinux.org/mailman/listinfo/community -- С уважением, Евгений Остапец uin: 23747217 jid: eugene_ostapets@jabber.ru
next prev parent reply other threads:[~2006-11-04 18:30 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-11-04 16:14 Andrey Rybak 2006-11-04 16:18 ` Eugene Ostapets 2006-11-04 17:39 ` Хихин Руслан 2006-11-04 17:59 ` Eugene Ostapets 2006-11-04 18:41 ` Хихин Руслан 2006-11-04 18:55 ` Michael Holzman 2006-11-04 19:17 ` Хихин Руслан 2006-11-04 20:32 ` Michael Holzman 2006-11-04 17:44 ` Andrey Rybak 2006-11-04 17:53 ` Eugene Ostapets 2006-11-04 18:24 ` Andrey Rybak 2006-11-04 18:30 ` Eugene Ostapets [this message] 2006-11-04 18:51 ` Andrey Rybak
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=e12fd2db0611041030j20b8baf0ub10c649878c15b0@mail.gmail.com \ --to=eostapets@gmail.com \ --cc=community@lists.altlinux.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
ALT Linux Community general discussions This inbox may be cloned and mirrored by anyone: git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 community community/ http://lore.altlinux.org/community \ mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com public-inbox-index community Example config snippet for mirrors. Newsgroup available over NNTP: nntp://lore.altlinux.org/org.altlinux.lists.community AGPL code for this site: git clone https://public-inbox.org/public-inbox.git