| [1413] | 1 | /* $Id: 858-64bitmath.c 1413 2004-05-01 04:03:54Z bird $ */ | 
|---|
|  | 2 | /** @file | 
|---|
|  | 3 | * | 
|---|
|  | 4 | * Testcase for 64-bit math error. | 
|---|
|  | 5 | * | 
|---|
|  | 6 | * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net> | 
|---|
|  | 7 | * | 
|---|
|  | 8 | * | 
|---|
|  | 9 | * This file is part of InnoTek GCC. | 
|---|
|  | 10 | * | 
|---|
|  | 11 | * InnoTek GCC is free software; you can redistribute it and/or modify | 
|---|
|  | 12 | * it under the terms of the GNU Lesser General Public License as published | 
|---|
|  | 13 | * by the Free Software Foundation; either version 2 of the License, or | 
|---|
|  | 14 | * (at your option) any later version. | 
|---|
|  | 15 | * | 
|---|
|  | 16 | * InnoTek GCC is distributed in the hope that it will be useful, | 
|---|
|  | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
|  | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
|  | 19 | * GNU Lesser General Public License for more details. | 
|---|
|  | 20 | * | 
|---|
|  | 21 | * You should have received a copy of the GNU Lesser General Public License | 
|---|
|  | 22 | * along with InnoTek GCC; if not, write to the Free Software | 
|---|
|  | 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
|---|
|  | 24 | * | 
|---|
|  | 25 | */ | 
|---|
|  | 26 |  | 
|---|
|  | 27 | #include <stdio.h> | 
|---|
|  | 28 | int main() | 
|---|
|  | 29 | { | 
|---|
|  | 30 | unsigned long long x = 4481699234003649253LL; | 
|---|
|  | 31 | unsigned long long y = 448169923400364923LL; | 
|---|
|  | 32 | unsigned long long z = x / y; | 
|---|
|  | 33 | printf("858-64bitmath: %llu / %llu = %llu\n", x, y, z); | 
|---|
|  | 34 | if (z != 10) | 
|---|
|  | 35 | { | 
|---|
|  | 36 | printf("858-64bitmath: failed\n"); | 
|---|
|  | 37 | return 1; | 
|---|
|  | 38 | } | 
|---|
|  | 39 | printf("858-64bitmath: succeeded\n"); | 
|---|
|  | 40 | return 0; | 
|---|
|  | 41 | } | 
|---|
|  | 42 |  | 
|---|