Search code examples
cmddecimalbitcoin

Can't multiply decimals


I'm trying to make a Dogecoin to Bitcoin Converter to see if you get more bitcoin with Litecoin or Dogecoin in CMD, but it won't multiply numbers with decimals!

@echo off
title Dogecoin to Bitcoin
goto start

:math
set/a BTC=DOGE*DtB
set/a LTC=DOGE*DtL*LtB
goto end

:start
set/p DtB="Dogecoin to Bitcoin? :"
set/p DtL="Dogecoin to Litecoin? :"
set/p LtB="Litecoin to Bitcoin? :"
set/p DOGE="How many Dogecoin? :"
goto math

:end
echo Doge: %DOGE%
echo Bitcoin with Dogecoin: %BTC%
echo Bitcoin with Litecoin: %LTC%
pause

Did i do something wrong or is it just CMD?


Solution

  • SET /A performs integer calculations only:

    Any SET /A calculation that returns a fractional result will be rounded down to the nearest whole integer.

    (source)


    Why don't you just use a spreadsheet?