Questions tagged [bcd]

A binary-coded decimal (BCD) is a method of representing each decimal digit of a number with a fixed number of bits.

Though binary-coded decimal is less efficient memory-wise than 2's complement there are some advantages that result in BCD still being in use today, particularly in databases and applications where monetary and similarly sensitive data types are stored and manipulated.

194 questions
0
votes
0 answers

IEEE-754 decimal256 implementation?

I'm trying to implement this type but I cant seem to find any documentation on it. The binary-256 format reserves 236 bits for the mantissa and the remaining 20 for the sign & exponent. IEEE-754 BCD formats, on the other hand, use the two bits…
user12387207
0
votes
0 answers

Converted BCD coded hexa Decimal value into readable date time

I have hexadecimal value like - 160413031849, which needs to be converted to valid Date time (something readable) like - April 13, 16th, 3:18:49. So how I can do it with JS in nodeJS.
Rahul Raj
  • 349
  • 1
  • 2
  • 10
0
votes
1 answer

How to read BDC time with reversed endianess in java?

So I have this byte array: // tvltmp[0] = 0x21; // tvltmp[1] = 0x63; // tvltmp[2] = 0x84; And this represents "12:36:48" in what I called "reversed endianess BDC". To decode that, one just have to follow this manual: LSD | MSD byte0 2|1 …
filippo
  • 5,583
  • 13
  • 50
  • 72
0
votes
0 answers

Java Timestamp to Packed Decimal

I am looking to parse a timestamp in the following format yyyymmddhhmmss to BCD (Packed) How would I go about implementing it? I understand that we'd use 4 bits for each decimal digit but I am a bit at a loss on how to proceed with the…
nmarques
  • 151
  • 12
0
votes
1 answer

BCD Timer in VHDL

Just started out in VHDL not long ago,out of curiosity. So I was trying to write BCD timer on spartan 3 board and Somehow I couldn't find out why it keeps showing 'unexpected with' error. So if I want to have such function as shown in the link of…
CmYang
  • 3
  • 3
0
votes
4 answers

Converting from Decimal to BCD

// C++ program to convert a decimal // number to binary number #include using namespace std; // function to convert decimal to binary void decToBinary(int n) { // array to store binary number int binaryNum[1000]; // counter…
300SRT
  • 59
  • 2
  • 5
0
votes
2 answers

C# NModbus get String form byte[]

I using NModbus4.dll to communicate with modbus device. I read this register: Register: 0257-0288 Number of registers:32 Variable name: monitor buffer area Data type: BCD Description: readable Using this code: byte slaveId = byte.Parse…
DjuricS.
  • 36
  • 10
0
votes
2 answers

In what format do I supply a BCD field for camel-sap?

I would like to develop an interface that transfers a data record via camel-sap to an SAP function module. The data table contains a BCD field. What is the representation of the BCD field in camel-sap-format (XML)?
Yannick
  • 663
  • 1
  • 10
  • 33
0
votes
0 answers

Integer Addition on current generation CPUs (2017)

First of, this is a genuine question and not poking fun at anyone. I am trying to learn C++ after many years of not touching it and I found a very old article (last updated July, 96) while trying to remember how implement BCD addition. Even though…
user480184
0
votes
0 answers

What is wrong with this vhdl code for bcd addition?

The following code is for bcd addition of two numbers. Whenever I input some values, the output for most significant 4-bits comes out to be incorrect(X). I don't know where I am wrong in this. library ieee; use ieee.std_logic_1164.all; use…
user4032054
0
votes
2 answers

Convert BCD byte array to a NSDecimalNumber

Given a 6 byte array from a specific TLV tag: unsigned char bytes[] = { 0x00, 0x00, 0x00, 0x01, 0x23, 0x45 }; NSData * data = [NSData dataWithBytes:bytes length:6]; How could one convert it to the decimal number with value of: 12345 I tried…
Said Sikira
  • 4,482
  • 29
  • 42
0
votes
2 answers

How do I get the same result as I get with bcdedit /enum ALL using wmi?

I'm trying to get the same information as I get with the bcdedit command "bcdedit /enum ALL" but using wmi and C#. I know how to get the bootmgr entries (see code) but I can't get all entries, especially the device options is the information I'm…
Luzius
  • 164
  • 2
  • 10
0
votes
4 answers

How to convert Binary Coded Decimal to int in C++

Given a hex value of 0x80 (supplied as a uint16_t) in c++ how would I extract the digits into an int variable. I don't want to convert the hex to int, rather I want to extract the digits as an int, so for example, for 0x80 i want an int of 80, not…
Matt Brailsford
  • 2,209
  • 3
  • 28
  • 40
0
votes
1 answer

How to convert an EBCDIC zoned decimal to a decimal in MS SQL Server 2014?

Hi everyone this is major chunk for me I have been trying lot but not getting success there is data in db as [AH_TRAN_CV] of length 9 as Integer. and I want that in varchar with 9 char and 2 decimals. I guess this whole code may be wrong as I…
0
votes
1 answer

9's complement of a 4-bit binary number

I don't understand how to calculate the 9's complement of a binary number. I can apply it to decimal ones, example 15 = (9-1)(9-5) ) 84 then I thought to proceed with a binary -> decimal -> 9's complement -> binary conversion but I guess it's not…
user3595871
  • 1
  • 1
  • 1
  • 3