- Visual C++源码
- Visual Basic源码
- C++ Builder源码
- Java源码
- Delphi源码
- C/C++源码
- PHP源码
- Perl源码
- Python源码
- Asm源码
- Pascal源码
- Borland C++源码
- Others源码
- SQL源码
- VBScript源码
- JavaScript源码
- ASP/ASPX源码
- C#源码
- Flash/ActionScript源码
- matlab源码
- PowerBuilder源码
- LabView源码
- Flex源码
- MathCAD源码
- VBA源码
- IDL源码
- Lisp/Scheme源码
- VHDL源码
- Objective-C源码
- Fortran源码
- tcl/tk源码
- QT源码
div.c
资源名称:leda.tar.gz [点击查看]
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:1k
源码类别:
数值算法/人工智能
开发平台:
MultiPlatform
- /* dieses Programm belegt einen Fehler in der integer division */
- #include <iostream.h>
- #include <math.h>
- #include <LEDA/bigfloat.h>
- void binout (ostream &,integer);
- int main (void)
- {
- integer a=integer(26118786) << 32;
- a=a + 3762119088;
- integer b=17;
- double a_dbl=26118786;
- a_dbl=a_dbl * pow(2,32);
- a_dbl=a_dbl + 3762119088;
- double b_dbl=17;
- char *out;
- // ieee_flags("set","direction","tozero",&out);
- cout << "a: " << a << "n";
- cout << "b: " << b << "n";
- /* wir haben hier die bigfloat Konvertierung vorgenommen, um vergleichbare
- Ausgaben zu erreichen */
- cout << "a_dbl: " << bigfloat(a_dbl).tointeger() << "n";
- cout << "b_dbl: " << b_dbl << "n";
- cout << "a/b: " << (a/b) << "n";
- cout << "a_dbl/b_dbl: " << bigfloat(a_dbl/b_dbl).tointeger() << "n";
- cout << "das ganze in Binaerstellen:n";
- cout << "a/b= ";
- binout(cout,bigfloat(a/b).get_significant());
- cout << "n";
- cout << "a_dbl/b_dbl= ";
- binout(cout,bigfloat(a_dbl/b_dbl).get_significant());
- cout << "n";
- }