1# The include statement below is a temp one for tests that are yet to
2#be ported to run with InnoDB,
3#but needs to be kept for tests that would need MyISAM in future.
4--source include/force_myisam_default.inc
5
6--source include/big_test.inc
7
8--disable_warnings
9drop procedure if exists sp1;
10--enable_warnings
11
12#
13#-- 2. Adding (one millionth) one million times should be the same as
14#-- adding 1. So a stored procedure with many iterations will show if
15#-- small errors accumulate.
16#
17
18delimiter //;
19#
20CREATE PROCEDURE sp1()
21BEGIN
22  DECLARE v1, v2, v3, v4 DECIMAL(28,12);
23  DECLARE v3_2, v4_2 DECIMAL(28, 12);
24  DECLARE counter INT;
25
26  SET v1 = 1;
27  SET v2 = 2;
28  SET v3 = 1000000000000;
29  SET v4 = 2000000000000;
30  SET counter = 0;
31
32  WHILE counter < 100000 DO
33   SET v1 = v1 + 0.000000000001;
34   SET v2 = v2 - 0.000000000001;
35   SET v3 = v3 + 1;
36   SET v4 = v4 - 1;
37   SET counter = counter + 1;
38  END WHILE;
39
40  SET v3_2 = v3 * 0.000000000001;
41  SET v4_2 = v4 * 0.000000000001;
42
43  SELECT v1, v2, v3, v3_2, v4, v4_2;
44END//
45#
46call sp1()//
47#-- should return
48#   -- v1=1.0000001
49#   -- v2=1.999999900000
50#   -- v3=1.0000001
51#   -- v4=1.999999900000
52#
53delimiter ;//
54#
55drop procedure sp1;
56