473,379 Members | 1,216 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

float data type question...

how would i print a number in float value without negative numbers?
thanks for any advice...

Jul 19 '05 #1
3 2615

"Dmitrii PapaGeorgio" <ja*****@woh.rr.comNOSPAM> wrote in message
news:nI***************@fe2.columbus.rr.com...
how would i print a number in float value without negative numbers?
thanks for any advice...

if(!(float_value < 0))
std::cout << float_value << '\n';

-Mike
Jul 19 '05 #2
Mike Wahler wrote:
"Dmitrii PapaGeorgio" <ja*****@woh.rr.comNOSPAM> wrote in message
news:nI***************@fe2.columbus.rr.com...
how would i print a number in float value without negative numbers?
thanks for any advice...


if(!(float_value < 0))
std::cout << float_value << '\n';

-Mike

i need to "convert" it to a positive number...

Jul 19 '05 #3
Dmitrii PapaGeorgio wrote:
Mike Wahler wrote:
"Dmitrii PapaGeorgio" <ja*****@woh.rr.comNOSPAM> wrote in message
news:nI***************@fe2.columbus.rr.com...
how would i print a number in float value without negative numbers?
thanks for any advice...



if(!(float_value < 0))
std::cout << float_value << '\n';

-Mike

i need to "convert" it to a positive number...


#include <cmath>

std::abs(float_value);

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Christian Christmann | last post by:
Hi, just a general question. Which data type is more precise for large values: float or double? Thank you. Chris
4
by: music4 | last post by:
Greetings, I psinfo_t struct, pr_pctcpu is ushort_t type with comment: "pr_pctcpu is 16 bit binary fractions in the range 0.0 to 1.0 with the binary point to the right of the high-orfer bit...
6
by: Dave win | last post by:
Hi all: I'm confused with the expression "(float *())". Book says that this is a cast. But, I have no idea of this expr. why could this expr ignore the variable??? Thanx!!!
10
by: pavithra.eswaran | last post by:
Hi, I would like to convert a single precision hexadecimal number to floating point. The following program seems to work fine.. But I do not want to use scanf. I already have a 32 bit hexadecimal...
3
by: Neils Christoffersen | last post by:
Hey all, I wrote on Friday asking for some help moving a common subclass field up to the base class (original post and followup included below). This entails storing whole numbers inside float...
8
by: avsrk | last post by:
Hello Folks , General C data types question , more geared up towards embedded folks . I have a positive float quantity with a fractional part (one decimal point) which occupies 4 bytes ....
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
13
by: Shirsoft | last post by:
I have a 32 bit intel and 64 bit AMD machine. There is a rounding error in the 8th digit. Unfortunately because of the algorithm we use, the errors percolate into higher digits. C++ code is...
6
by: Jeff Kish | last post by:
Greetings. I need to convert some columns of type numeric(12, 0) to hold floating point information scale and precision I can't determine in advance (customer data can vary wildly) so I wanted...
0
by: Timothy Grant | last post by:
That's because s IS a string. It's not been converted to a float. In : s = '3.1415' In : n = float(s) In : type(s) Out: <type 'str'> In : type(n) Out: <type 'float'> Why are you avoiding...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.