Mailinglist Archive: opensuse-programming-de (119 mails)
| < Previous | Next > |
Re: Mehrdimensionale dynamische Arrays in C++
- From: Martin Oehler <martin.oehler@xxxxxxx>
- Date: 18 Nov 2002 12:38:24 +0100
- Message-id: <1037619505.1694.29.camel@assassin>
Hi!
Am Mon, 2002-11-18 um 02.50 schrieb Ralf Corsepius:
Na ja.
http://gcc.gnu.org/fom_serv/cache/49.html
#include <iostream>
int main()
{
double min = 0.0;
double max = 0.5;
double width = 0.01;
std::cout << static_cast<int>(((max - min) / width) - 1) << std::endl;
return 0;
}
~> g++ -o testprog test.cc
~> ./testprog
48
~> g++ -O -o testprog test.cc
~> ./testprog
49
~> g++ -ffloat-store -O -o testprog test.cc
~> ./testprog
48
Strange...
CU,
Martin
Am Mon, 2002-11-18 um 02.50 schrieb Ralf Corsepius:
Am Son, 2002-11-17 um 10.50 schrieb Sebastian Huber:
also mir ist das immer noch nicht klar, wie numerische Ungenauigkeiten und
Optimierung zusammenhaengen.
Garnicht.
Na ja.
http://gcc.gnu.org/fom_serv/cache/49.html
#include <iostream>
int main()
{
double min = 0.0;
double max = 0.5;
double width = 0.01;
std::cout << static_cast<int>(((max - min) / width) - 1) << std::endl;
return 0;
}
~> g++ -o testprog test.cc
~> ./testprog
48
~> g++ -O -o testprog test.cc
~> ./testprog
49
~> g++ -ffloat-store -O -o testprog test.cc
~> ./testprog
48
Strange...
CU,
Martin
| < Previous | Next > |