dbTalk Databases Forums  

How does your MOD() function work?

comp.databases comp.databases


Discuss How does your MOD() function work? in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Robert Klemme
 
Posts: n/a

Default Re: How does your MOD() function work? - 06-12-2010 , 12:45 PM






On 11.06.2010 12:39, Jasen Betts wrote:
Quote:
On 2010-06-11, Lennart Jonsson<erik.lennart.jonsson (AT) gmail (DOT) com> wrote:
On 2010-06-11 01:03, --CELKO-- wrote:
[...]
Otherwise, the result is the unique non-negative exact numeric value r with scale zero such
that

1)r has the same sign as n.

For negative n should r be positive or negative?
Amazing: either the standard is self contradictory or we must assume
that only positive n are allowed. Why did they make it so complicated
and error prone? Talk about design by committee...

Rereading the criteria I believe they accidentally inserted
"non-negative" in the sentence above. Otherwise it would not make any
sense to include 1 and talk about an "absolute value" in 2.

So, finally to answer Lennart's question I believe the _intention_ of
the standard was that for negative n r should be negative as well.

Quote:
from the above I think that version of the standard only allows for whole number n
Which "whole numbers" do you mean?

http://en.wikipedia.org/wiki/Whole_number

:-)

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Reply With Quote
  #22  
Old   
LC's No-Spam Newsreading account
 
Posts: n/a

Default Re: How does your MOD() function work? - 06-16-2010 , 09:28 AM






nobody has yet mentioned MySQL 5.1.14

Quote:
MOD (12, 5) = 2
MOD(-12, 5) = -2
MOD (-12, -5) = -2
MOD (12, -5) = 2
MOD (NULL, 5) = NULL
MOD (NULL, NULL) = NULL
MOD (12, NULL) = NULL
MOD (12, 0) = NULL
MOD (-12, 0) = NULL
MOD (0, 5) = 0
MOD (0, -5) = 0
MOD (0, 0) = NULL

--
----------------------------------------------------------------------
nospam (AT) mi (DOT) iasf.cnr.it is a newsreading account used by more persons to
avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.