Searching \ for 'Looking for a signed addtion routine' in subject line. ()
Help us get a faster server
Search entire site for: 'Looking for a signed addtion routine'.

Truncated match.
'Looking for a signed addtion routine'
2000\04\10@163737 by

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:    schaeferelektronik21.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)

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

-dave

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

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"
speffinterlog.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...