how to calculate with commas (division)

  • Thread starter Thread starter Ragnar
  • Start date Start date
R

Ragnar

I want to do divisions in a dos box getting results with
commas (or dots).

like: 7 / 2 = 3,5
or even 7,5 / 2 = 3,75
More than 2 numbers after the comma arent necessary

with "set /a ST=7/2" and "expr.exe 7 / 2" (from unix utils)
i always get it rounded to 3

Is there a way or a commandline tool where i can work with
commas as variables?
 
Ragnar said:
I want to do divisions in a dos box getting results with
commas (or dots).

like: 7 / 2 = 3,5
or even 7,5 / 2 = 3,75
More than 2 numbers after the comma arent necessary

with "set /a ST=7/2" and "expr.exe 7 / 2" (from unix utils)
i always get it rounded to 3

Is there a way or a commandline tool where i can work with
commas as variables?
Conset from Frank P. Westlake will do what you want.
http://gearbox.maem.umr.edu/fwu/

conset /?
Version 1.4, Copyright (C)2001, 2002, Frank P. Westlake.
Displays, sets, or deletes cmd.exe environment variables,
modifies console parameters, and performs floating point
mathematics.

HTH
 
I want to do divisions in a dos box getting results with
commas (or dots).

like: 7 / 2 = 3,5
or even 7,5 / 2 = 3,75
More than 2 numbers after the comma arent necessary

with "set /a ST=7/2" and "expr.exe 7 / 2" (from unix utils)
i always get it rounded to 3

Is there a way or a commandline tool where i can work with
commas as variables?

Under 4NT the command "SET /A ST=7/2" shows the expected correct result.

AFAIK "SET /A" is not available under 4DOS, where JPSoft's native method
for calculations, the built-in function @EVAL, can be used. It sports a
pretty rich set of operations - see <http://jpsoft.com/help/f_eval.htm>.
4DOS is free, 4NT is not.
 
Ragnar said:
I want to do divisions in a dos box getting results with
commas (or dots).

like: 7 / 2 = 3,5
or even 7,5 / 2 = 3,75
More than 2 numbers after the comma arent necessary

with "set /a ST=7/2" and "expr.exe 7 / 2" (from unix utils)
i always get it rounded to 3

Is there a way or a commandline tool where i can work with
commas as variables?

You don't want to calculate with commas, you want to be able to extend
integer math to include real numbers. Integer math is generally handled
quite adequately by the SET/A command (except that it chokes on numeric
values like 08 and 09), however, it has no knowledge whatsoever of real,
decimal, or fractional values.

I would recommend you consider doing what you want to do using WSH and
vbscript or jscript, both of which have the numerical capabilities you seek.

/Al
 
Michael said:
Under 4NT the command "SET /A ST=7/2" shows the expected correct result.

AFAIK "SET /A" is not available under 4DOS

It is, actually; it just isn't documented.
 
Back
Top