www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/30/06:17:28

From: Oon Lin <Oon DOT Lin AT jcu DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Testing for float or int
Date: Thu, 30 Apr 1998 16:34:44 +1000
Organization: University of Queensland
Lines: 19
Message-ID: <35481B84.167E@jcu.edu.au>
NNTP-Posting-Host: cuda.jcu.edu.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi ,

I had been surfing around Delorie's lib C online reference for a
function that can test whether an input is in float or int.

For example , let's say I have a float variable named foo.

When I get the input using

cin << foo ;

I'd like to test is if the input was convertable to an int without loss
of precision. For example , if the input given was 6.0000 , then
converting it to an int would give 6. But if the input was 6.1234 , then
conversion should not take place.
 

Thanks for reading this !
Kean

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019