Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

arithmetic operations

Status
Not open for further replies.

masr

Programmer
Joined
Jul 15, 2003
Messages
1
Location
US
a = 0xfff10100(32 bit)-negative b = 0x90001234(32 bit) - negative
x = 0x1234(16 bit)
The basic expression is (a*x)+b
a*x*2 result is fffeef063400 - but only the upper
32 bit result is used
so fffeef06 + 90001234 = ffff8ffdf040
result + b
I do this like this
set prod[expr {((1 << 1) * double($a) * double($a))}]
set prod1 [expr {floor ($prod/(1 << 16))}]
set sum [expr {double($prod1) + double($b)}]
My question is:
Is there a way to represent the result $sum like this
ffff8ffdf040
whenever I try to use format to convert $sum to HEX it says integer too large to represent...
any tips on how to do this...
thanks
 
I think you are looking after the &quot;l&quot; modifier:
Code:
  puts [format %lx -1]
->
ffffffffffffffff
HTH

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top