ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: thecrux@gmail.com
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: Re: [devel] [JT] Вопрос про работу ceil() из ANSI C, баг или не баг?
Date: Wed, 19 Oct 2011 13:33:02 +0400
Message-ID: <20111019093302.GA28852@mail.truecrux.org> (raw)
In-Reply-To: <CAJXf7QPmWHVjVG=mGzo2jbkLzxe-woLBWDBSbxgmV9riohOrwA@mail.gmail.com>

On Wed, Oct 19, 2011 at 12:16:49PM +0300, Igor Zubkov wrote:
> 2011/10/19 Anatoly Lyutin:
> > 19.10.2011 13:11, Denis  Medvedev пишет:
> >>
> >> Все нормально.
> >> Результат целочисленного деления 5/2 = 2
> >> ceil(2)=2
> >> Результат плавающего деления 5.0/2 =2.5
> >> ceil(2.5)=3
> >
> > Да, точно, перегрелся.
> > Если сделать ceil(5/2.0), то всё работает правильно, конечно.
> 
> В ruby так же:
> ruby-1.8.7-p352 :001 > 5/2
>  => 2
> ruby-1.8.7-p352 :002 > 5/2.0
>  => 2.5
> ruby-1.8.7-p352 :003 >

а Perl ведёт себя так, только если использовать прагму integer

say 5/2;    # 2.5

use integer;
say 5/2;    # 2


а в python даже придумали оператор //

>>> 5//2.0
2.0

-- 
Vladimir Lettiev aka crux ✉ theCrux@gmail.com


      reply	other threads:[~2011-10-19  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19  9:19   ` [devel] " Anatoly Lyutin
2011-10-19  9:16     ` Igor Zubkov
2011-10-19  9:33       ` thecrux [this message]

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=20111019093302.GA28852@mail.truecrux.org \
    --to=thecrux@gmail.com \
    --cc=devel@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 Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/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 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git