Searching \ for 'Looking for a signed addtion routine' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=looking+signed+addtion
Search entire site for: 'Looking for a signed addtion routine'.

Truncated match.
PICList Thread
'Looking for a signed addtion routine'
2000\04\10@163737 by Martin SchŠfer

flavicon
face
part 0 767 bytes content-type:application/octet-stream;In http://www.piclist.com/faq was no routine that treats this problem.

In AN701 you find an algorithm to calculate the integral part of an
PID-control. But there Brett Duane
dont proof the overflow !!

Any suggestions?

Martin


;**********************************************
;**   name:      Martin Schaefer             **
;**   company:   elektronik 21 GmbH, Germany **
;**   e-mail:    spam_OUTschaeferTakeThisOuTspamelektronik21.de    **
;**********************************************
<<Martin SchŠfer.vcf>>

Content-Type: application/octet-stream;
       name="Martin SchŠfer.vcf"
Content-Disposition: attachment;
       filename="Martin SchŠfer.vcf"

Attachment converted: definition:Martin Sch=fer.vcf 1 (????/----) (0000E3F7)

2000\04\10@170027 by David E Arnold

picon face
hi,

some micros have an additional flag bit indicating overflow for signed number
math
operations.

I think the atmel at90s has this but I'm unsure
about PICs

-dave

2000\04\10@184023 by Spehro Pefhany

picon face
At 10:49 PM 4/10/00 +0200, you wrote:
>If one wants to add two numbers, this is really simple - even in 32 Bit :-)
>But I'm looking for a 2th complement signed routine (8,16,24 bit). The
>difficulty
>there is to see an overflow. The carry-flag is not indicating an overflow
>(add 0x7F and 0x7F) !

One way:

1)      If the numbers have different signs, no overflow is possible,
       you don't need to check it.

2)      If the numbers have the same sign, and the sign of the result
       is different, then there has been an overflow.

Tres simple, non?

Best regards,

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Spehro Pefhany --"it's the network..."            "The Journey is the reward"
.....speffKILLspamspam@spam@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Contributions invited->The AVR-gcc FAQ is at: http://www.bluecollarlinux.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...