Results 1 to 5 of 5

Thread: [RESOLVED] [2.0] Float

Hybrid View

  1. #1
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Float

    "float" is an alias for Single. If you don't specify otherwise, any literal number with a decimal point in it is a Double. You cannot implicitly convert a Double to a Single because it is a narrowing conversion, i.e. data could be lost. If your method is expecting floats then you need to pass floats to it. To force a literal to type float you use an "F" suffix:
    C# Code:
    1. c1.set(12.34f, 23.0f);
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  2. #2

    Thread Starter
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up Re: [2.0] Float

    Quote Originally Posted by jmcilhinney
    "If your method is expecting floats then you need to pass floats to it. To force a literal to type float you use an "F" suffix
    Thanks sir
    It's working fine now.Can you give the list of more suffix in C# , that we have need to use in the code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width