/* $Id: t_bdSimple.c $ */ /* A very simple test of some "bd" functions */ /***** BEGIN LICENSE BLOCK ***** * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) 2001-15 David Ireland, D.I. Management Services Pty Limited * . All rights reserved. * ***** END LICENSE BLOCK *****/ /* * Last updated: * $Date: 2015-10-22 10:23:00 $ * $Revision: 2.5.0 $ * $Author: dai $ */ #include #include "bigd.h" int main(void) { BIGD u, v, w; /* Display the BigDigits version number */ printf("BigDigits version=%d\n", bdVersion()); /* Create new BIGD objects */ u = bdNew(); v = bdNew(); w = bdNew(); /* Compute 2 * 0xdeadbeefface */ bdSetShort(u, 2); bdConvFromHex(v, "deadbeefface"); bdMultiply(w, u, v); /* Display the result */ bdPrintHex("", u, " * "); bdPrintHex("0x", v, " = "); bdPrintHex("0x", w, "\n"); /* and again in decimal format */ bdPrintDecimal("", u, " * "); bdPrintDecimal("", v, " = "); bdPrintDecimal("", w, "\n"); /* Free all objects we made */ bdFree(&u); bdFree(&v); bdFree(&w); return 0; }