Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8459 > unrolled thread
| Started by | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| First post | 2012-02-10 11:02 +0000 |
| Last post | 2012-02-10 11:02 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Mod and QuotientRemainder are inconsistent Bob Hanlon <hanlonr357@gmail.com> - 2012-02-10 11:02 +0000
| From | Bob Hanlon <hanlonr357@gmail.com> |
|---|---|
| Date | 2012-02-10 11:02 +0000 |
| Subject | Re: Mod and QuotientRemainder are inconsistent |
| Message-ID | <jh2tg6$sl$1@smc.vnet.net> |
To get exact results use exact numbers
Mod[12, 1/10]
0
Mod[12, Rationalize[0.1]]
0
Bob Hanlon
On Thu, Feb 9, 2012 at 5:35 AM, Szabolcs <szhorvat@gmail.com> wrote:
>
> Mod[12, 0.1] gives 0.1 despite 120*0.1 == 12. I expect this is because 0.1 is not representable in binary.
>
> QuotientRemainder[12, 0.1] gives {120, 0.} however, which is inconsistent with the result above.
>
> Quotient[12,0.1] gives 120 which is also inconsistent with Mod.
>
> Is this a bug or is it by design? It seems it is not safe to assume that
>
> QuotientRemainder[a,b] == {Quotient[a,b], Mod[a,b]}
>
> or that
>
> Quotient[a,b]*b + Mod[a,b] == a
>
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web