On Sun, Nov 03, 2024 at 09:38:47AM +0700, hahahahacker2009 wrote:
> Hello,
> OpenBSD bc(1) is unable to calculate very big number,
> for example, (1024*1024)^(1024*1024) run for an hour and still cannot
> give me the result.
> It just use about 11M of memory and 100% CPU.
> Gavin Howard's bc port do it in 2 minutes
> GNU bc on Linux do it in 5 minutes.
>
> I'm sending this email from a phone, apologize for poor formatting and
> no full dmesg.
> cpu0: Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz, 3192.89 MHz
> Dell Inc. OptiPlex 9020
> spdmem0 at iic0 addr 0x50: 2GB DDR3 SDRAM PC3-12800
> spdmem1 at iic0 addr 0x51: 2GB DDR3 SDRAM PC3-12800
> spdmem2 at iic0 addr 0x52: 2GB DDR3 SDRAM PC3-12800
> spdmem3 at iic0 addr 0x53: 2GB DDR3 SDRAM PC3-12800
bc uses dc which does a simple exponentation computation, which is
basically doing repeated multiplications. I'm sure there are smarter
methods, it's not just implemented that way.
-Otto
No comments:
Post a Comment