all groups > vj# > february 2004 >
You're in the

vj#

group:

Problem while defining constants


Problem while defining constants Reshma
2/19/2004 10:16:05 PM
vj#:
In C# for defining decimal constants we use suffix M
For Example
ShowDecimalGetBits( 10000000000000000000000000000M )
ShowDecimalGetBits( 100000000000000.00000000000000M )
ShowDecimalGetBits( 1.0000000000000000000000000000M )
ShowDecimalGetBits( 0.123456789M )
ShowDecimalGetBits( 0.000000000123456789M )
ShowDecimalGetBits( 0.000000000000000000123456789M )
ShowDecimalGetBits( -7.9228162514264337593543950335M )
where ShowDecimalGetBits is a method which takes argumant as decimal
What is the equivalent for M in J#?If we write M in J#, it gives error

Re: Problem while defining constants Lars-Inge Tønnessen
2/20/2004 9:48:02 PM
/**
* Summary description for Class1.
*/
public class Class1
{
private final double one = 1.0000000000000000000000;
private final double two = 100000000000000.00000000000000;
private final double three = 1.0000000000000000000000000000;
private final double four = 0.123456789;
private final double five = 0.123456789;
private final double six = 0.000000000123456789;
private final double seven = 0.000000000000000000123456789;
private final double eight = -7.9228162514264337593543950335;

public Class1()
{
ShowDecimalGetBits( one );
ShowDecimalGetBits( two );
ShowDecimalGetBits( three );
ShowDecimalGetBits( four );
ShowDecimalGetBits( five );
ShowDecimalGetBits( six );
ShowDecimalGetBits( seven );
ShowDecimalGetBits( eight );
}

public void ShowDecimalGetBits( double numb )
{
System.Console.WriteLine("[out] ->"+numb );
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
new Class1();
}
}

--
Regards,
Lars-Inge Tønnessen
http://emailme.larsinge.com
http://www.larsinge.com

RE: Problem while defining constants mikegreonline NO[at]SPAM microsoft.com
2/20/2004 11:49:44 PM
There is no equivalent to C#'s M in J#. You should be able to just be able
to specify the decimal constant.

Thanks,

Michael Green
Microsoft Developer Support



--------------------
| Thread-Topic: Problem while defining constants
| thread-index: AcP3eQWscbKFGz0bTkSsZ/cGGWNtQQ==
| X-Tomcat-NG: microsoft.public.dotnet.vjsharp
| From: =?Utf-8?B?UmVzaG1h?= <anonymous@discussions.microsoft.com>
| Subject: Problem while defining constants
| Date: Thu, 19 Feb 2004 22:16:05 -0800
| Lines: 13
| Message-ID: <A132B8D2-D80B-4918-9FCA-4797EB7A095F@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.vjsharp
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.vjsharp:5495
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.vjsharp
|
| In C# for defining decimal constants we use suffix M.
For Example,
ShowDecimalGetBits( 10000000000000000000000000000M );
ShowDecimalGetBits( 100000000000000.00000000000000M );
ShowDecimalGetBits( 1.0000000000000000000000000000M );
ShowDecimalGetBits( 0.123456789M );
ShowDecimalGetBits( 0.000000000123456789M );
ShowDecimalGetBits( 0.000000000000000000123456789M );
ShowDecimalGetBits( -7.9228162514264337593543950335M );
where ShowDecimalGetBits is a method which takes argumant as decimal.
What is the equivalent for M in J#?If we write M in J#, it gives error.

Thanks
|
AddThis Social Bookmark Button