~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/t/type_newdecimal-big.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--source include/big_test.inc
 
2
 
 
3
--disable_warnings
 
4
drop procedure if exists sp1;
 
5
--enable_warnings
 
6
 
 
7
#
 
8
#-- 2. Adding (one millionth) one million times should be the same as
 
9
#-- adding 1. So a stored procedure with many iterations will show if
 
10
#-- small errors accumulate.
 
11
#
 
12
 
 
13
delimiter //;
 
14
#
 
15
CREATE PROCEDURE sp1()
 
16
BEGIN 
 
17
  DECLARE v1, v2, v3, v4 DECIMAL(28,12);
 
18
  DECLARE v3_2, v4_2 DECIMAL(28, 12);
 
19
  DECLARE counter INT;
 
20
 
 
21
  SET v1 = 1;
 
22
  SET v2 = 2;
 
23
  SET v3 = 1000000000000;
 
24
  SET v4 = 2000000000000;
 
25
  SET counter = 0;
 
26
  
 
27
  WHILE counter < 100000 DO
 
28
   SET v1 = v1 + 0.000000000001;
 
29
   SET v2 = v2 - 0.000000000001;
 
30
   SET v3 = v3 + 1;
 
31
   SET v4 = v4 - 1;
 
32
   SET counter = counter + 1; 
 
33
  END WHILE;
 
34
 
 
35
  SET v3_2 = v3 * 0.000000000001;
 
36
  SET v4_2 = v4 * 0.000000000001;
 
37
 
 
38
  SELECT v1, v2, v3, v3_2, v4, v4_2;
 
39
END//
 
40
#
 
41
call sp1()//
 
42
#-- should return 
 
43
#   -- v1=1.0000001
 
44
#   -- v2=1.999999900000
 
45
#   -- v3=1.0000001
 
46
#   -- v4=1.999999900000
 
47
#
 
48
delimiter ;//
 
49
#
 
50
drop procedure sp1;