Overriding the math.Log() method

  • Thread starter Thread starter almurph
  • Start date Start date
A

almurph

Hi,

I'm trying to alter the C# Math.Log() method to accept a float (at
the moment it will only accept a type double) and to return a double.

Can anyone help me override this please? Would really appreciate any
comments/code-samples/suggestions that you may have.

Thank you,
Al.
 
Hi,

Since float variables can be implicitly converted to double, You don't have
to do anything, just pass in Your float variable to Log.

Hope You find this useful.
-Zsolt
 
I'm trying to alter the C# Math.Log() method to accept a float (at
the moment it will only accept a type double) and to return a double.

Can anyone help me override this please? Would really appreciate any
comments/code-samples/suggestions that you may have.

What leads you to believe you need anything at all?

C:\tmp>type x.cs
using System;

class Program
{
static void Main(string[] args)
{
double d = Math.Log( 3f );
Console.WriteLine( "{0}", d );
}
}

C:\tmp>csc x.cs
Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.

C:\tmp>x
1.09861228866811

C:\tmp>
 
Back
Top