oracle (number) V.S. db2 (decimal)

oracle中的number(16,2) 与 db2中的decimal(16,2)
1. oracle中number(16,2)会四舍五入。

2. db2的decimal(16,2)直接截掉有效位数后面的数字,不进行四舍五入。


http://cache.baidu.com/c?m=9d78d513d99516fe03b2c7201a16a6651d4380123cc0d06429848449e3644f060738ece161645213d2b6617a51f11409fdf04171330237b7ec99d515c0e7c9727cd57b6f2a4fdb4219d91cb8cd4426c1248d0ab7f24cfafbb661d5f583cedc5750cd59077084fa8b580316c16ff41230e4a09c43115a0d&p=93759a46d0c114f312be9b745f52cd&user=baidu&fm=sc&query=DECIMAL%2816%2C+2%29+db2&qid=b79ff15c0453a2a5&p1=1

 

sqlplus uid/pass[@dbname(不在一同机器上)]能正常登录,用于验证oracle的基本运行环境;

运行proc 命令校验oracle 开发环境是否能用及其版本号

 

dbaccess (或isql工具)进行数据库连接,用于验证informix的运行环境;

运行esql –V验证esql是否能用及其版本号;

 

运行db2 connect DBNAME [user uid using password]命令连接数据库,验证DB2环境是否能用;

运行db2 prep验证db2开发环境是否已安装;

转载于:https://www.cnblogs.com/qingxia/archive/2012/09/12/2682067.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
import decimal def calculate_pi(): decimal.getcontext().prec = 35 pi = decimal.Decimal() k = while True: term = decimal.Decimal((-1) ** k) * (decimal.Decimal(2) ** (decimal.Decimal(5) * decimal.Decimal(k))) / (decimal.Decimal(4 * k + 1) * decimal.Decimal(math.factorial(k)) ** 2 * decimal.Decimal(396 ** (4 * k))) pi += term if abs(term) < decimal.Decimal(1e-35): break k += 1 return pi * decimal.Decimal(2 ** 6) def calculate_tan(x): decimal.getcontext().prec = 35 tan = decimal.Decimal() k = while True: term = decimal.Decimal((-1) ** k) * decimal.Decimal(2 ** (2 * k + 1)) * decimal.Decimal((2 ** (2 * k + 1) - 1)) * decimal.Decimal(x ** (2 * k + 1)) / decimal.Decimal(math.factorial(2 * k + 1)) tan += term if abs(term) < decimal.Decimal(1e-35): break k += 1 return tan def calculate_pi_with_tan(): decimal.getcontext().prec = 35 pi = decimal.Decimal() k = while True: term = decimal.Decimal((-1) ** k) * (decimal.Decimal(2) ** (decimal.Decimal(5) * decimal.Decimal(k))) / (decimal.Decimal(4 * k + 1) * decimal.Decimal(math.factorial(k)) ** 2 * decimal.Decimal(396 ** (4 * k))) * calculate_tan(decimal.Decimal(1) / decimal.Decimal(239)) pi += term if abs(term) < decimal.Decimal(1e-35): break k += 1 return pi * decimal.Decimal(2 ** 6) def kahan_sum(numbers): decimal.getcontext().prec = 35 sum = decimal.Decimal() c = decimal.Decimal() for number in numbers: y = number - c t = sum + y c = (t - sum) - y sum = t return sum pi = calculate_pi_with_tan() pi = kahan_sum([pi] * 10) print(pi) 这段代码有一些缺漏,请补充以便它计算出pi的值
最新发布
03-10
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值