Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Why do I see numbers past the decimal place when the result is actually a whole number?

Featured Replies

I cannot get my head around this. Can someone at least tell me the name of what is happening here so I can Google it for further reading? I know it has something to do with how memory of a computer works but I want to get my head around it.

Thank you so much in advance for your help!

 

Screenshot 2020-04-03 at 11.18.49.png

  • Author

Hi @NOCK. Thank you for your reply. I am using the extra time I have at home to study and I am taking CS50, Harvard's Introduction to Computer Science. get_float comes from a library they wrote to make learning easier at the start, it is imported on line one of the above code.

Here it is on GitHub https://github.com/cs50/libcs50/blob/develop/src/cs50.h

and here is the code from the file, for that method:

/**
* Prompts user for a line of text from standard input and returns the
* equivalent float as precisely as possible; if text does not represent
* a float or if value would cause underflow or overflow, user is prompted
* to retry. If line can't be read, returns FLT_MAX.
*/

float get_float(const char *format, ...) __attribute__((format(printf, 1, 2)));

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.