Sponsored Content
Homework and Emergencies Homework & Coursework Questions Unix/Linux Math Decimal to Whole Number Format? Post 302549734 by Iceman69 on Tuesday 23rd of August 2011 11:12:15 PM
Old 08-24-2011
Yazu, sorry for line numbers, as far as code tags, I thought it was code tagged. This is my very first post, ever here for coding questions.

Im not an expert or even a novice, I'm a new beginner who didn't even want to take this class in the first place. So sorry If I make mistakes.

But anyway, what happens when I just use a 3 or a 6 is that when I type in lets say 2 for the first price and 2 for the second price when the calculation comes back it tells me the tax is $24 and my grand total is $28 dollars.
With the decimal's in place its .24 and the total 4.24

---------- Post updated at 11:12 PM ---------- Previous update was at 11:08 PM ----------

I know Frank, I don't know either, the program is fine, I have no clue on why this teacher wants us to use whole numbers in place of .03 for the tax. Like I mentioned I'm most likely going to just hand it in as is. I was just curious if you could do it as whole numbers.

Thank you kindly for your reply's. I'll find the thank button and click it. Because I am grateful.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Number format conversion in UNIX

Hi All, I want to convert Scientific number format into normal number format using unix script or using any command of unix. e.g 1.55397e+09 into 1553970000 Thanks in advance Kamal (1 Reply)
Discussion started by: kamal_418
1 Replies

2. Shell Programming and Scripting

format decimal in ksh

hi all, in ksh, how do i format a decimal number (e.g 3381.19) to integer (e.g 3381). This number is average time response for server in millisec and i wanted to display it in a more readable format i.e in seconds without any decimals. thanks in advance. (2 Replies)
Discussion started by: cesarNZ
2 Replies

3. Shell Programming and Scripting

Decimal format

Hello Friends, I have a file with below format... 1234,Hary,102.55 4567,Maria,250.40 78942,suzan,261.60 48965,Harun,179.32 And I want to check the last column. If the decimal value of the last column is below 50, I need that column else ignore that column. Can anyone help me out? (3 Replies)
Discussion started by: mziaullah
3 Replies

4. Shell Programming and Scripting

IP address to decimal format conversion

I have a file which consist of some class 4 IP address as 172.16.112.50 172.16.112.50 172.16.112.50 172.16.112.100 192.168.1.30 172.16.112.100 172.16.112.50 172.16.112.50 172.16.112.50 i want to store them in pure decimal notations instead of the given dotted decimal formats e.g.... (2 Replies)
Discussion started by: vaibhavkorde
2 Replies

5. Shell Programming and Scripting

number of digits after decimal

Hi All, I have a file of decimal numbers, cat file1.txt 1.1382666907 1.2603107334 1.6118799297 24.4995857056 494.7632588468 560.7633734425 ..... I want to see the output as only 7 digits after decimal (5 Replies)
Discussion started by: senayasma
5 Replies

6. Shell Programming and Scripting

Awk - Summation in Proper decimal Format

Hi I am executing below command to do summation on 46th coloumn. cat File1| awk -F"|" '{p += $46} END { printf"Column Name | SUM | " p}' I am getting output as Column Name | SUM | 1.01139e+10 Here I want output in Proper decimal format. Can someone tell me what change is required for same? (1 Reply)
Discussion started by: sanranad
1 Replies

7. Shell Programming and Scripting

Sort Decimal number in UNIX

Hello Everyone, In one of my script, I would like to sort the decimal numbers. For e.g. If I have numbers like 1.0 1.1 1.2 2.0 2.1 3.0 4.0 5.0 6.0 7.0 7.1 7.10 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 I would like to sort them 1.0 1.1 1.2 2.0 2.1 3.0 4.0 5.0 6.0 7.0 7.1 7.2 7.3 7.4... (3 Replies)
Discussion started by: sachinrastogi
3 Replies

8. UNIX for Dummies Questions & Answers

Linux Math Help

I am struggling with scripting this challenge a friend and I have. You have file1 and its contents is a single number you have file 2 and its contents are a different number you want to add file1 to file2 and have the output be put into file3 (3 Replies)
Discussion started by: minkyboodle
3 Replies

9. UNIX for Dummies Questions & Answers

How to control the decimal points for p-values in scientific format?

Dear all, I have a txt file with only one column which contains p values. My data looks like this: 5.04726976606584e-190 2.94065711152402e-189 2.94065711152402e-189 9.19932135717279e-176 1.09472516659859e-170 1.24974648916809e-170 0.1223974648916 0.9874974648916 ... what I want... (2 Replies)
Discussion started by: forevertl
2 Replies
YAML_EMIT(3)								 1							      YAML_EMIT(3)

yaml_emit - Returns the YAML representation of a value

SYNOPSIS
string yaml_emit (mixed $data, [int $encoding = YAML_ANY_ENCODING], [int $linebreak = YAML_ANY_BREAK], [array $callbacks]) DESCRIPTION
Generate a YAML representation of the provided $data. PARAMETERS
o $data - The $data being encoded. Can be any type except a resource. o $encoding - Output character encoding chosen from YAML_ANY_ENCODING, YAML_UTF8_ENCODING, YAML_UTF16LE_ENCODING, YAML_UTF16BE_ENCODING. o $linebreak - Output linebreak style chosen from YAML_ANY_BREAK, YAML_CR_BREAK, YAML_LN_BREAK, YAML_CRLN_BREAK. o $callbacks - Content handlers for emitting YAML nodes. Associative array of classname => callable mappings. See emit callbacks for more details. RETURN VALUES
Returns a YAML encoded string on success. CHANGELOG
+--------+--------------------------------------+ |Version | | | | | | | Description | | | | +--------+--------------------------------------+ | 1.1.0 | | | | | | | The $callbacks parameter was added. | | | | +--------+--------------------------------------+ EXAMPLES
Example #1 yaml_emit(3) example <?php $addr = array( "given" => "Chris", "family"=> "Dumars", "address"=> array( "lines"=> "458 Walkman Dr. Suite #292", "city"=> "Royal Oak", "state"=> "MI", "postal"=> 48046, ), ); $invoice = array ( "invoice"=> 34843, "date"=> 980208000, "bill-to"=> $addr, "ship-to"=> $addr, "product"=> array( array( "sku"=> "BL394D", "quantity"=> 4, "description"=> "Basketball", "price"=> 450, ), array( "sku"=> "BL4438H", "quantity"=> 1, "description"=> "Super Hoop", "price"=> 2392, ), ), "tax"=> 251.42, "total"=> 4443.52, "comments"=> "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.", ); var_dump(yaml_emit($invoice)); ?> The above example will output something similar to: string(628) "--- invoice: 34843 date: 980208000 bill-to: given: Chris family: Dumars address: lines: |- 458 Walkman Dr. Suite #292 city: Royal Oak state: MI postal: 48046 ship-to: given: Chris family: Dumars address: lines: |- 458 Walkman Dr. Suite #292 city: Royal Oak state: MI postal: 48046 product: - sku: BL394D quantity: 4 description: Basketball price: 450 - sku: BL4438H quantity: 1 description: Super Hoop price: 2392 tax: 251.420000 total: 4443.520000 comments: Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338. " SEE ALSO
yaml_emit_file(3), yaml_parse(3). PHP Documentation Group YAML_EMIT(3)
All times are GMT -4. The time now is 01:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy