DecimalTest
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DecimalTest{ class Program { static void Main(string[] args) { decimal x; double y; x = 3.14159265358979323m; x = x / 3; y = (double)x; Console.WriteLine("x={0}", x); Console.WriteLine("y={0}", y); Console.ReadKey(); } }}注意:定义 Decimal 变量时, 数字后面应该带有 m 或 M。
结果:
x=1.0471975511965977433333333333
y=1.0471975511966
诚品服饰 英伦男装 无条件退换
页:
[1]