Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:17:59+00:00 2026-06-13T21:17:59+00:00

I am programming in the c language on mac os x. I am using

  • 0

I am programming in the c language on mac os x. I am using sqrt, from math.h, function like this:

int start = Data -> start_number;
double localSum;

for (start; start <= end; start++) {
    localSum += sqrt(start);
}

This works, but why? and why am I getting no warning? On the man page for sqrt, it takes a double as parameter, but I give it an int – how can it work?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:18:01+00:00Added an answer on June 13, 2026 at 9:18 pm

    Type conversions which do not cause a loss in precision might not throw warnings. They are cast implicitly.

    int --> double //no loss in precision (e.g 3 became 3.00)
    double --> int //loss in precision (e.g. 3.01222 became 3)
    

    What triggers a warning and what doesn’t is depends largely upon the compiler and the flags supplied to it, however, most compilers (atleast the ones I’ve used) don’t consider implicit type-conversions dangerous enough to warrant a warning, as it is a feature in the language specification.


    To warn or not to warn:

    C99 Rationale states it like a guideline

    One of the important outcomes of exploring this (implicit casting) problem is the understanding that high-quality compilers might do well to look
    for such questionable code and offer (optional) diagnostics, and that
    conscientious instructors might do well to warn programmers of the
    problems of implicit type conversions.

    C99 Rationale (Apr 2003) : Page 45

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which programming language would you recommend to learn about data structures and algorithms in?
In any sane programming language, from C to Javascript, an expression such as a
Which programming language or a library is able to process infinite series (like geometric
I'm trying to find a programming language I feel really comfortable learning and using
I am running an example from The C Programming Language by Kernighan and Ritchie.
I'm going to start building operating system and I don't know which programming language
In programming language like C#, java if a condition has multiple expressions with AND(&&)
I know this programming language is pretty obsolete, but my company still uses it
I'd like to pull a stream of PCM samples from a Mac's line-in or
In the Java Programming language the private keyword is used for data hiding -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.