Java Scientific Calculator

Links

Home ·
Download ·
Design and operation ·
Modes ·
Accuracy of calculations ·
Numbers and arithmetic ·
Roots, powers and logs ·
Trigonometric functions ·
Factorials and combinations ·
Logical functions ·
Memory ·
Statistical calculations ·
Variable expressions ·
Graphing functions ·
Other features and functions ·
Modifying the code ·
Testing the code ·
Known issues ·
Similar projects ·

Logical or Boolean functions

The calculator has three logical functions: and, or and exclusive-or (xor) built in. These calculate values bitwise, almost literally comparing the ieee-754 representations of numbers bit by bit. These operations act on binary representations of numbers, where the bits are the binary digits. They only really make sense if you are using binary, octal or hexadecimal representation of a number and so they are not available (directly) for decimals. They also don’t make much sense for anything other than nonnegative integers, but since the functions can be defined consistently for any complex number, they are.

The and function

This function (and button, ‘&’ key) computes the bitwise and of two numbers: for digits d and f, d and f = 1 whenever d = f = 1. So for example, in binary, 10101010 and 00111100 = 00101000.

The or function

This function (or button, ‘|’ key) computes the bitwise inclusive or (Latin vel) of two numbers: for digits d and f, d or f = 1 whenever d = 1 or f = 1. So for example, in binary, 10101010 and 00111100 = 10111110.

The xor function

This function (xor button, ‘X’ key) computes the bitwise exclusive or (Latin aut) of two numbers: for digits d and f, d xor f = 1 whenever df. So for example, in binary, 10101010 and 00111100 = 10010110.

Other logical functions

The unary logical functions not and bitwise complement are not implemented because I haven’t found an unambiguous way to decide what they mean when applied to a complex number in ieee-754 representation.


Last modified: Sat 31 May 2008 01:10 pm

SourceForge.net Logo