This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 7937 - Incorrect casts from unsigned int
: Incorrect casts from unsigned int
Status: RESOLVED DUPLICATE of bug 7938
Product: Runtime
Classification: Mono
Component: generics
: unspecified
: Other Linux
: --- normal
: ---
Assigned To: Bugzilla
:
:
:
:
  Show dependency treegraph
 
Reported: 2012-10-23 05:29 EDT by Thomas Klose
Modified: 2012-11-07 11:08 EST (History)
4 users (show)

See Also:
Tags:
Test Case URL:
External Submit: ---


Attachments

Description Thomas Klose 2012-10-23 05:29:02 EDT
Casts from unsigned integer to double result in incorrect values.


Steps to reproduce: Start Mono shell (csharp).

  pi@raspberrypi ~ $ csharp 
  Mono C# Shell, type "help;" for help

  Enter statements below.
  csharp> uint u = 10;
  csharp> double d = u;
  csharp> d;
  -4.45320438302588E-07
  csharp>               
  csharp> double d = (double)u;
  csharp> d;                    
  -4.45320438302588E-07
  csharp> u;
  10

(the same occurs in actual (compiled) csharp programs.)

Actual results: unsigned integer 10 is castet to a negative double value

Expected results: unsigned interger 10 should be castet to double value 10.0

Platform:
  Hardware platform: ARM (RaspberryPi)
  Mono Version: 2.10.8.1 (Debian 2.10.8.1-5)  in Raspbian (Wheezy)
  Linux kernel: Linux raspberrypi 3.2.27+ #160 PREEMPT Mon Sep 17 23:18:42 BST
2012 armv6l GNU/Linux

Does not occur on other hardware platforms (x86, x86-64) with same Mono version
Comment 1 Zoltan Varga 2012-10-23 20:51:28 EDT
I can't reproduce this using mono master, whats the output of mono --version ?
Comment 2 Thomas Klose 2012-11-05 09:31:03 EST
pi@raspberrypi ~ $ mono --version
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-5)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors.
www.mono-project.com
    TLS:           __thread
    SIGSEGV:       normal
    Notifications: epoll
    Architecture:  armel,vfp
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            Included Boehm (with typed GC and Parallel Mark)
Comment 3 Zoltan Varga 2012-11-07 00:22:21 EST
Probably a dup of 
https://bugzilla.xamarin.com/show_bug.cgi?id=7938
Comment 4 Thomas Klose 2012-11-07 05:14:18 EST
Yes, it seems so. The problem does not occur on Debian Wheezy with softfp.
Comment 5 Zoltan Varga 2012-11-07 11:08:04 EST

*** This bug has been marked as a duplicate of bug 7938 ***

Note You need to log in before you can comment on or make changes to this bug.