Mercurial > projects > decimal
view src/decimal/math.d @ 1:a984d3056cc4
Incorporated Boost License
author | Paul (paul.d.anderson@comcast.net) |
---|---|
date | Sat, 13 Mar 2010 18:51:22 -0800 |
parents | 42cf4db6be32 |
children | b37c218c1442 |
line wrap: on
line source
/** * A D programming language implementation of the * General Decimal Arithmetic Specification, * Version 1.70, (25 March 2009). * * by Paul D. Anderson * * Boost Software License - Version 1.0 - August 17th, 2003 * * Permission is hereby granted, free of charge, to any person or organization * obtaining a copy of the software and accompanying documentation covered by * this license (the "Software") to use, reproduce, display, distribute, * execute, and transmit the Software, and to prepare derivative works of the * Software, and to permit third-parties to whom the Software is furnished to * do so, all subject to the following: * * The copyright notices in the Software and this entire statement, including * the above license grant, this restriction and the following disclaimer, * must be included in all copies of the Software, in whole or in part, and * all derivative works of the Software, unless such copies or derivative * works are solely in the form of machine-executable object code generated by * a source language processor. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. **/ module decimal.math; import decimal.decimal; import decimal.context; public: //-------------------------------- // // CONSTANTS // //-------------------------------- /** * Returns the value of e to the default precision. */ Decimal e() { Decimal result; return result; } /** * Returns the value of e to the specified precision. */ Decimal e(uint precision) { Decimal result; return result; } /** * Returns the value of pi to the default precision. */ Decimal pi() { Decimal result; return result; } /** * Returns the value of pi to the specified precision. */ Decimal pi(uint precision) {; Decimal result; return result; } /** * Returns the square root of the argument to the default precision. */ Decimal sqrt(Decimal arg) { Decimal result; return result; } /** * Returns the square root of the argument to the specified precision. */ Decimal sqrt(Decimal arg, uint precision) { Decimal result; return result; } //-------------------------------- // // EXPONENTIAL AND LOGARITHMIC FUNCTIONS // //-------------------------------- /** * Decimal version of std.math function. * Required by General Decimal Arithmetic Specification * */ Decimal exp(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * 2^x */ Decimal exp2(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * exp(x) - 1 */ Decimal expm1(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * Required by General Decimal Arithmetic Specification * */ Decimal log(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * log(1 + x) */ Decimal log1p(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * Required by General Decimal Arithmetic Specification * */ Decimal log10(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * Required by General Decimal Arithmetic Specification * */ Decimal log2(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * Required by General Decimal Arithmetic Specification * */ Decimal pow(Decimal op1, Decimal op2) { Decimal result; return result; } //-------------------------------- // // TRIGONOMETRIC FUNCTIONS // //-------------------------------- /** * Decimal version of std.math function. * */ Decimal sin(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal cos(Decimal arg) { Decimal result; return result; } /** * Replaces std.math function expi * */ Decimal[] sincos(Decimal arg) { Decimal[] result; return result; } /** * Decimal version of std.math function. * */ Decimal tan(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal asin(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal acos(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal atan(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal atan2(Decimal y, Decimal x) { Decimal result; return result; } //-------------------------------- // // HYPERBOLIC TRIGONOMETRIC FUNCTIONS // //-------------------------------- /** * Decimal version of std.math function. * */ Decimal sinh(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal cosh(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal tanh(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal asinh(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal acosh(Decimal arg) { Decimal result; return result; } /** * Decimal version of std.math function. * */ Decimal atanh(Decimal arg) { Decimal result; return result; } //-------------------------------- // // General Decimal Arithmetic Specification Functions // //-------------------------------- /** * part of spec * * TODO: implement */ Decimal compare(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal compareSignal(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal compareTotal(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal divideInteger(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal fma(Decimal op1, Decimal op2, Decimal op3) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal ln(Decimal op1) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal log10(Decimal op1) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal max(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal maxMagnitude(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal min(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal minMagnitude(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal nextMinus(Decimal op1) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal nextPlus(Decimal op1) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal nextToward(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal power(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal remainder(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal remainderNear(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * NOTE: performs both round-to-integral-exact and * round-to-integral-value * * TODO: implement */ Decimal rint(Decimal op1, Decimal op2) { Decimal result; return result; } // logical operations /** * part of spec * * TODO: implement */ Decimal and(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal or(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal xor(Decimal op1, Decimal op2) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal invert(Decimal op1) { Decimal result; return result; } /** * part of spec * * TODO: implement */ Decimal compareTotal(Decimal op1, Decimal op2) { Decimal result; return result; }