10

Currently, I use the standard Windows 7 calculator in "Programmer" mode, and it's great. It does everything I need... except it has no support for unsigned integers. Which is all well and good if you are dealing with 8, 16, or 32 bit integers; just leave it in quad word mode and you won't have any two's compliment problems, but there is no way to represent an unsigned 64 bit integer.

To be clear, I am looking for a windows program, not a chrome extension or simply "use google". The software must support bitwise operators and handle unsigned/signed integers of at least 64 bits in size, and at least hexadecimal, binary, and decimal display. Support for floating point numbers is not necessary, but would be awesome.

3
  • Like BinCalc but supporting 64 bits... Nov 5, 2015 at 12:50
  • Like Penjee Calc but offline... Nov 5, 2015 at 12:57
  • This is an old question, but still a valid request. Anyone out there come across a good Programmers Calculator that can handle 128 bit (or larger) integers, signed or otherwise?
    – LarryF
    Jul 22, 2022 at 1:05

2 Answers 2

5

Wolframalpha (Paid,Cross-Platform)

SpeedCrunch (Free, Cross-Platform)

Both of these are great. Exactly what you are looking for. Hope this resolves your issue!!! cheers!!

10
  • Can you explain how WolframAlpha supports unsigned integers? Nov 5, 2015 at 10:00
  • 1
    In WA you can import any file with a sequence of 64-bit unsigned integers and can also export a list of integers in the range (0, 2^64-1) to a binary file.
    – Mohit Garg
    Nov 5, 2015 at 10:45
  • 2
    Awesome, it looks like SpeedCrunch is essentially what I was looking for. It'll get the job done perfectly! +1 Nov 5, 2015 at 22:23
  • 1
    @CodesInChaos: definitely. It took me a while to get to the repo page (bitbucket.org/heldercorreia/speedcrunch.git), where I could get the source to build it on Linux. Speedcrunch seems to be what I was looking for: something that works like bc -l or calc, but with better support for developing bithacks in fixed-size integers, not arbitrary-precision. It unfortunately opens it's own terminal-like window, instead of just running in an existing terminal, though. Jul 11, 2016 at 21:01
  • 1
    @PeterCordes both perl and powershell are available on Linux, support unsigned 64-bit int and can run in the current terminal in interactive mode
    – phuclv
    Apr 11, 2020 at 2:43
1

PowerShell can solve all of your problems. Not only does it has a 64-bit unsigned type (and 128-bit signed/unsigned types since PowerShell Core 7.0) but it also has an arbitrary-precision integer type. Some math examples:

  • Arbitrary integer and floating-point math

    1.56 + 0.23/[math]::Pow([math]::Sqrt([math]::Log(20) + [math]::Sin([math]::PI/3)), 4)
    
  • Math on decimal type (128-bit): 1.23d * 3.45d / 28

  • Bitwise operations

    [uint64]::MaxValue/3 + (-bnot 20) + (1L -shl 22) + (0x23 -band 0x34)
    
  • Big integer math: [bigint]::Pow([uint64]::MaxValue, 20)

  • 128-bit signed/unsigned math (new since .NET Core 7.0 Preview 5)

PowerShell sample

PowerShell is like a front-end to the .NET framework, so any .NET or Win32 functions (or even Linux functions in *.so files) can be called from PowerShell. The math functions above are mainly from the .NET Math class and Numerics namespace. Here are some other things that may be useful to programmers:

  • Calculate file or object sizes: Use number suffixes 12.5GB + 5.8MB + 1392KB for binary units and 12.5e9 + 5.8e6 + 1392e3 for decimal units (G = 1e9, M = 1e6, K = 1e3)

  • Convert to/from base64: [Convert]::ToBase64String and [Convert]::FromBase64String

  • Date/time manipulation. For example convert from raw Epoch values to datetime and vice versa

      [datetime]::FromFileTime(0x01d15614cbaee92c)
      [datetime]::ParseExact("08-12-2012","dd-MM-yyyy", `
              [Globalization.CultureInfo]::InvariantCulture) 
    
  • String formatting and base conversion. Anything that String.Format in .NET supports will work. For more information read about the formatting operator. You can also do advanced string and regex manipulation. Some examples:

      'somestring'.Substring(4) * 3 -replace 'ings', 'eet'
      '{0:X}' -f (0x12 + 34)
      [convert]::ToString(0x12 + 34, 16)
      'This is an emoji' + [char]::ConvertFromUtf32(0x1F60A)
    
  • Direct XML and JSON manipulation

  • Call functions in DLL files directly

  • GUI programming. Yes PowerShell is powerful enough for that and many people do write WinForm apps in PowerShell. Here's a small sample clipboard history app

Clipboard history app in PowerShell

For more information you can read

or follow Dr Scripto's blog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.