EuroAssembler Index Manual Download Source Macros


Sitemap Links Forum Tests Projects

eurocalc.htm
EuroCalc
EuroCalc for Linux
EuroCalc for Windows

  EuroCalc is a calculator from the collection EuroTool which computes input expression consisting of numbers, operators, functions, and priority parentheses. It calculates mathematical expressions from the command line or interactively in a window.

EuroCalc treats all numbers internally as floating point numbers and it works with 96-bit mantissa and 32-bit exponent.

The input expression can be entered at the command line, for instance
eurocalc 12.345 * (-6.78) + 0x9ABC, optionally followed by equal sign =. EuroCalc will convert all numbers to decimal, remove unnecessary spaces, repeat the corrected assignment and print the calculated result on a new line:


C:\>eurocalc 12.345 * (-6.78) + 0x9ABC= 12.345*(-6.78)+39_612 = 39_528.300_9 C:\>

When EuroCalc is run without arguments, it displays a (pseudo)graphic window and it can be used interactively.

Numbers can be entered in decimal, hexadecimal, octal, or binary form and their notation may be mixed in one expression. Accepted notations:

  1. Integer numbers
  2. Floating-point numbers

Parsing algorithmus can distinguish between 123E4h (hexadecimal number 0x123E4) and 123E4 (decimal number 123*104=1230000).

The number format of EuroCalc is compatible with EuroAssembler but it is not limited to 63 bits.
Operations and functions
Operation OperatorArity PriorityExample
FnEul EUL Function Euler's number with 0 operand15eul = 2.718_281_828_459_045_235_360_288
FnPi PI Function Ludolf's number with 0 operand15pi = 3.141_592_653_589_793_238_462_644
FnPlus + Unary operation12+2 = 2
FnMinus - Unary operation12-2 = -2
FnFactorial ! Reversed operation143 ! = 6
FnAdd + Binary operation 22 + 3 = 5
FnSubtract - Binary operation 22 - 3 = -1
FnMultiply * Binary operation 42 * 3 = 6
FnDivide / Binary operation 43 / 2 = 1.5
FnPower ^ Binary operation 62 ^ 3 = 8
FnSin SIN Function sine with 1 operand10sin (pi / 6) = 0.5
FnCos COS Function cosine with 1 operand10cos (pi / 6) = 0.5
FnTan TAN Function tangent weurocalcith 1 operand10tan (pi / 4) = 1
FnCot COT Function cotangent with 1 operand10cot (pi / 4) = 1
FnSec SEC Function secant with 1 operand10sec pi = -1
FnCsc CSC Function cosecant with 1 operand10csc (pi/2) = 1
FnExp EXP Function exponent with 1 operand10exp 1 = 2.718_281_828_459_045_235_360_288
FnLn LN Function natural logarithm with 1 operand10ln eul = 1
FnLg LG Function decimal logarithm with 1 operand10lg 100 = 2

Operation with higher priority are performed first, but the priority may be altered with parenthesis.

All operators and number modifiers are case insensitive. All elements (numbers, operators, parenthesis) may be separated with spaces. The number notation can be enhanced with underscores _ for better readability.
Arguments of trigonometric functions are entered in radians.

Example of using EuroCalc to calculate a SINE function table for angles 0°, 10°, 20°,...90° in Windows:

C:\> FOR /L %a IN (0,10,90) DO @eurocalc.exe SIN (%a * PI/180) sin(0*pi/180) = 0 sin(10*pi/180) = 0.173_648_177_666_930_348_851_716_63 sin(20*pi/180) = 0.342_020_143_325_668_733_044_099_6 sin(30*pi/180) = 0.5 sin(40*pi/180) = 0.642_787_609_686_539_326_322_643_4 sin(50*pi/180) = 0.766_044_443_118_978_035_202_392_6 sin(60*pi/180) = 0.866_025_403_784_438_646_763_723_2 sin(70*pi/180) = 0.939_692_620_785_908_384_054_109_3 sin(80*pi/180) = 0.984_807_753_012_208_059_366_743 sin(90*pi/180) = 1 C:\>
↑ EuroCalc
This linker script is a common configuration and argument processing for both Linux and Windows version.

Both programs in this source file have the name eurocalc . The linked executable file for Linux has the name eurocalc.x and the version for Windows has the name eurocalc.exe.

Both executables will be built with the command euroasm eurocalc.htm.
         EUROASM CPU=X64, Unicode=No, NoWarn=0563
         INCLUDE "argument.htm" ; Assemble the module argument.htm.
         INCLUDE "calcmain.htm" ; Assemble the module calcmain.htm (common for both OS).
↑ EuroCalc for Linux

Linux GUI version works with ANSI terminal in character pseudo graphic mode.

         INCLUDE "calclinc.htm" ; Assemble the module calclinc.htm (Linux console subsystem).
         INCLUDE "calcling.htm" ; Assemble the module calcling.htm (Linux pseudographic subsystem).
eurocalc PROGRAM Format=ELFX, Width=64, Entry=MainCon                 ; Executable Linux file eurocalc.x.
          LINK calclinc.obj, calcling.obj, calcmain.obj, argument.obj ; Program EuroCalc for Linux has four modules.
         ENDPROGRAM eurocalc
↑ EuroCalc for MS Windows
         INCLUDE "calcwinc.htm" ; Assemble the module calcwinc.htm (Windows console subsystem).
         INCLUDE "calcwing.htm" ; Assemble the module calcwing.htm (Windows graphic subsystem).
eurocalc PROGRAM Format=PE, Width=64, Entry=MainCon, IconFile=eurocalc.ico ; Executable Windows file eurocalc.exe.
          LINK argument.obj, calcmain.obj, calcwinc.obj, calcwing.obj      ; Program EuroCalc for Windows has four modules.
         ENDPROGRAM eurocalc

▲Back to the top▲