Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#304694 - 03/12/2007 22:06 Large number subtraction via a DOS batch file?
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31601
Loc: Seattle, WA
C:\temp>set /a 100-24
76

Works!


C:\temp>set /a 36295495680-2743
Invalid number. Numbers are limited to 32-bits of precision.


Woops, too big.

I google for "subtract.bat" which nets me this
http://members.cox.net/tglbatch/batch/subtract.bat

But I can't make that work, I save it to my disk and try to run it and it barfs on me. I'm not sure why. Something's wrong with it, perhaps it was written for an older version of DOS and won't work on Vista or Server2003 (the environments I need to perform the subtraction in). Or perhaps its formatting is screwed up and I can't figure out how to fix it. And anyway, it was written to accept only 8 characters so it's not really useful anyway.

I suppose I could go to a higher level language, but I love solving things in simple batch files when I can.

Anyone got other ideas?

NOTE: Calling out to a windows EXE or some other kind of EXE to get results is fine, as long as that EXE ships with windows by default.
_________________________
Tony Fabris

Top
#304695 - 03/12/2007 23:02 Re: Large number subtraction via a DOS batch file? [Re: tfabris]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Quote:
I love solving things in simple batch files when I can

Masochist.

Just use VBScript or JScript if it has to work with only what Windows provides by default.
_________________________
Bitt Faulk

Top
#304696 - 04/12/2007 02:11 Re: Large number subtraction via a DOS batch file? [Re: wfaulk]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31601
Loc: Seattle, WA
You could very well be right. Both about the masochist thing and about just using vbscript.
_________________________
Tony Fabris

Top
#304697 - 04/12/2007 10:25 Re: Large number subtraction via a DOS batch file? [Re: tfabris]
Roger
carpal tunnel

Registered: 18/01/2000
Posts: 5683
Loc: London, UK
Quote:
Anyone got other ideas?


PowerShell. All the fun of batch files with all the simplicity of .NET.

I kid. It's actually pretty cool.
_________________________
-- roger

Top
#304698 - 04/12/2007 19:46 Re: Large number subtraction via a DOS batch file? [Re: tfabris]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31601
Loc: Seattle, WA
I ended up rewriting it in VBScript.

Yeah, it's better that way, but I'm so disappointed that I was unable to find a clever math solution in DOS Batch language.
_________________________
Tony Fabris

Top
#304699 - 04/12/2007 20:06 Re: Large number subtraction via a DOS batch file? [Re: tfabris]
wfaulk
carpal tunnel

Registered: 25/12/2000
Posts: 16706
Loc: Raleigh, NC US
Quote:
C:\>set /a 3*(8/3)
6

Still want to use it?
_________________________
Bitt Faulk

Top
#304700 - 04/12/2007 20:20 Re: Large number subtraction via a DOS batch file? [Re: tfabris]
Phoenix42
veteran

Registered: 21/03/2002
Posts: 1424
Loc: MA but Irish born
Could BSRPDNSC work? Scroll down a little bit to "Tool 3". Sure it is not exactly friendly, but it is geekie!

Granted it doesn't meet the "ships with windows" requirement.

Top
#304701 - 04/12/2007 20:28 Re: Large number subtraction via a DOS batch file? [Re: Phoenix42]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31601
Loc: Seattle, WA
Quote:
C:\>set /a 3*(8/3)
6


Heh. Of course, no one said Set /a would do floating point math, but I see your point.

Quote:
Could BSRPDNSC work? Scroll down a little bit to "Tool 3". Sure it is not exactly friendly, but it is geekie!

Very geeky! Cute trick.
_________________________
Tony Fabris

Top