[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why do some math functions return -0
- From: Philipp Janda <siffiejoe@...>
- Date: Mon, 20 Sep 2010 16:42:01 +0200
Am 20.09.2010 16:12, schrieb bb:
>
> JavaScript-C 1.8.0 pre-release 1 2009-02-16 : -7%-9 = -7, 9%-7 = 2, 7%-9
> = 7
>
> Ch Standard edition, version 6.3.0.14091: -7%-9 = -7, 9%-7 = 2, 7%-9 = 7
>
> java version "1.6.0_0" OpenJDK Runtime Environment (build 1.6.0_0-b11):
> -7%-9 = -7, 9%-7 = 2, 7%-9 = 7
>
> Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) [GCC 4.3.2] on linux2 :
> -7%-9 = -2, 9%-7 = -5, 7%-9 = -2
>
> Lua 5.1.3 : -7%-9 = -2, 9%-7 = -5, 7%-9 = -2
>
> [...]
>
> May be a Lua-code for a function for a c-like handling of the %-operator
> might be useful? So the user might have "religious freedom".
That's what math.fmod is for:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> = -7%-9, 9%-7, 7%-9
-7 -5 -2
> = math.fmod(-7,-9), math.fmod(9,-7), math.fmod(7,-9)
-7 2 7
>
> Regards BB
>
Philipp
- References:
- Re: Why do some math functions return -0, HyperHacker
- Re: Why do some math functions return -0, KHMan
- Re: Why do some math functions return -0, HyperHacker
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Tony Finch
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Tony Finch
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Tony Finch
- Re: Why do some math functions return -0, David Kastrup
- Re: Why do some math functions return -0, Roberto Ierusalimschy
- Re: Why do some math functions return -0, bb