Re: Help calculating large modulus
From: Gordon (elf_ster_at_hotmail.com)
Date: 12/08/03
- Next message: CJ: "TCL and Exuberant C Tags"
- Previous message: Bryan Oakley: "Re: Problem with freewrap for Linux"
- In reply to: Gordon: "Help calculating large modulus"
- Next in thread: Helmut Giese: "Re: Help calculating large modulus"
- Reply: Helmut Giese: "Re: Help calculating large modulus"
- Reply: Kevin Kenny: "Re: Help calculating large modulus"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Dec 2003 11:32:32 -0800
Thank you all for your answers. I'm working on 8.3.2.
Kevin Kenny of these newsgroups also previously posted this great
solution(compatible with 8.3.2)
set newmac 123456abcdef
set top 0x[string range $newmac 0 5]
set bottom 0x[string range $newmac 6 11]
set x [expr {$top*pow(2.,24)+$bottom}]
set y [expr {floor($x/999979.)}]
set modulus [expr {int($x-999899.*$y)}]
Thanks again!
Gordon
elf_ster@hotmail.com (Gordon) wrote in message news:<4a2e9945.0312071332.1caf497d@posting.google.com>...
> I'm a newbiew trying to get the modulus of a 32-bit number.
>
> (0x123456abcdef)mod(999899)
>
> I expected to do: set mod [expr 0x123456abcdef%999899] but I receive
> "integer value too large to represent".
>
> Any help greatly appreciated! TIA.
>
> Gordon
- Next message: CJ: "TCL and Exuberant C Tags"
- Previous message: Bryan Oakley: "Re: Problem with freewrap for Linux"
- In reply to: Gordon: "Help calculating large modulus"
- Next in thread: Helmut Giese: "Re: Help calculating large modulus"
- Reply: Helmut Giese: "Re: Help calculating large modulus"
- Reply: Kevin Kenny: "Re: Help calculating large modulus"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|