## Numerical Service Extension |
Ver. 1.02 Contributed by Lijun Yang |

** What**

n_cst_numerical

** Why **

- Add functions for data conversion among binary, hexadecimal and decimal
- Change decimal data type from long to ulong in order to correct errors in data conversion and bitwise operations
- Rewrite bitwise operations in order to increase performance as well as to correct errors in data conversion and bitwise operations. As a result, the extended bitwise operations are 7 times faster than the original pfc’s. It is quite efficient to use this n_cst_numerical for encryption and decryption.

** How**

- Add of_hex (as_binary), of_hex (aul_decimal), of_binary (as_hex), and of_decimal(as_data, ai_datatype)
- For individual bits, use PB script equivalents in place of bitwise operations as follows:

Bitwise Operation |
PB script |

a && b | a*b |

a || b | int ((a+b+1)/2) |

a XOR b | mod(a+b, 2) |

!a | 1-a |

Usage :

- For binary to decimal conversion, call of_decimal (as_data, 0)
- for binary to hexadecimal conversion, call of_hex (as_binary)
- For hexadecimal to decimal conversion, call of_decimal (as_data, 1)
- For hexadecimal to binary conversion, call of_binary(as_hex)
- For decimal to hexadecimal conversion, call of_hex (aul_decimal)

Download the | About the extension contributor |

Revision
History |
||

08/19/1997 | Initial Revision | Ver. 1.00 |

10/13/1997 | Changed the A XOR B bitwise operation from abs(a-b) to mod(a+b, 2) | Ver. 1.01 |

03/14/1998 | Corrected an error in binary-hexadecimal conversion | Ver. 1.02 |

Interested in contributing material to this web site? Send an email to submit@pfcguide.com, but don't forget to check the contribution guidelines first.

**For information or suggestions about
this web site please contact ****webmaster@pfcguide.com**

**PFCGuide is
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a
contract or a liability against Dynamic
Technology Group.**