Re: [PD] expr modulo negative

2008-10-14 Thread Frank Barknecht
Hallo,
Hans Roels hat gesagt: // Hans Roels wrote:

 Hello,
 
 If you want to calculate the modulo of a negative number, you get a 
 different result if you use the 'mod' object or 'expr' with %.
 
 -1  4
 ||
 mod
 |
 3
 
 -1 4
 |   |
 expr $f1 % $f2
 |
 -1
 
 I guess this is a bug in expr ?

Not really: Pd also has a builting [% ] object, which behaves like the
% in expr. 

Ciao
-- 
 Frank Barknecht _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread IOhannes m zmoelnig
Hans Roels wrote:
 Hello,
 
 If you want to calculate the modulo of a negative number, you get a 
 different result if you use the 'mod' object or 'expr' with %.
 
 -1  4
 ||
 mod
 |
 3
 
 -1 4
 |   |
 expr $f1 % $f2
 |
 -1
 
 I guess this is a bug in expr ?


you also get a different result if you use [mod] or [%].
it's a feature.

fgmasdr
IOhannes



 
 Hans r
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list
 


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread cyrille henry
you can use pd [mod] object or [%] object.
it's not the same for negative umber.

expr % is the same than pd %.
so i don't see any bug.

Cyrille


Hans Roels a écrit :
 Hello,
 
 If you want to calculate the modulo of a negative number, you get a 
 different result if you use the 'mod' object or 'expr' with %.
 
 -1  4
 ||
 mod
 |
 3
 
 -1 4
 |   |
 expr $f1 % $f2
 |
 -1
 
 I guess this is a bug in expr ?
 
 Hans r
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list
 
 

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread Andy Farnell

[%] and [mod] treat the sign differently. [mod] is monotonic 
but [%] is symmetrical about zero.

On Tue, 14 Oct 2008 13:45:50 +0100
Hans Roels [EMAIL PROTECTED] wrote:

 Hello,
 
 If you want to calculate the modulo of a negative number, you get a 
 different result if you use the 'mod' object or 'expr' with %.
 
 -1  4
 ||
 mod
 |
 3
 
 -1 4
 |   |
 expr $f1 % $f2
 |
 -1
 
 I guess this is a bug in expr ?
 
 Hans r
 
 
 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management - 
 http://lists.puredata.info/listinfo/pd-list


-- 
Use the source

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread Max
maybe someone could explain _what_ the difference is?
that would be enlightening vor everybody.

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread Hans Roels
ok, so there is no expr function identical to the 'mod' object?

Hans r

At 13:09 14/10/2008, Frank Barknecht wrote:
Hallo,
Hans Roels hat gesagt: // Hans Roels wrote:

  Hello,
 
  If you want to calculate the modulo of a negative number, you get a
  different result if you use the 'mod' object or 'expr' with %.
 
  -1  4
  ||
  mod
  |
  3
 
  -1 4
  |   |
  expr $f1 % $f2
  |
  -1
 
  I guess this is a bug in expr ?

Not really: Pd also has a builting [% ] object, which behaves like the
% in expr.

Ciao
--
  Frank Barknecht _ __footils.org__

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


[PD] expr modulo negative

2008-10-14 Thread Hans Roels
Hello,

If you want to calculate the modulo of a negative number, you get a 
different result if you use the 'mod' object or 'expr' with %.

-1  4
||
mod
|
3

-1 4
|   |
expr $f1 % $f2
|
-1

I guess this is a bug in expr ?

Hans r


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread Kyle Klipowicz
I think that since Miller is a self-described math geek, the difference is
that [mod] behaves like the mathematical (mod n). [%] is the modulo operator
used by computer science.

If my memory serves me, in number theory and abstract algebra, the m (mod n)
notation is used to define a subset of the integers (called a congruence
class) which contains n-1 elements.

For example, 5 (mod 3) == 2. Likewise, -5 (mod 3) == -2 (mod 3) == 1 (mod 3)
== 1. Note that my use of == here represents congruence and not necessarily
equality.

See http://en.wikipedia.org/wiki/Modular_arithmetic for a much more informed
discussion of this topic.

~Kyle

On Tue, Oct 14, 2008 at 7:40 AM, Max [EMAIL PROTECTED] wrote:

 maybe someone could explain _what_ the difference is?
 that would be enlightening vor everybody.

 ___
 Pd-list@iem.at mailing list
 UNSUBSCRIBE and account-management -
 http://lists.puredata.info/listinfo/pd-list




-- 
-

    -
  - --
http://perhapsidid.wordpress.com
http://myspace.com/kyleklipowicz
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list


Re: [PD] expr modulo negative

2008-10-14 Thread Max

thank you andy.
i guess it is a bug anyway, not in the objects, but in the  
documentation. both open the same helppatch with no mention about the  
difference.


max

Am 14.10.2008 um 14:32 schrieb Andy Farnell:



[%] and [mod] treat the sign differently. [mod] is monotonic
but [%] is symmetrical about zero.

On Tue, 14 Oct 2008 13:45:50 +0100
Hans Roels [EMAIL PROTECTED] wrote:


Hello,

If you want to calculate the modulo of a negative number, you get a
different result if you use the 'mod' object or 'expr' with %.

-1  4
||
mod
|
3

-1 4
|   |
expr $f1 % $f2
|
-1

I guess this is a bug in expr ?

Hans r


___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - http://lists.puredata.info/ 
listinfo/pd-list



--
Use the source

___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - http://lists.puredata.info/ 
listinfo/pd-list




PGP.sig
Description: Signierter Teil der Nachricht
___
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management - 
http://lists.puredata.info/listinfo/pd-list