convert numberformat (coldfusion) - coldfusion

HI folks! i got a simple question for coldfusion users, does anyone know how to convert a dynamic number into decimals, for example i have a code: #number# and it equals to, for example 10 but i need to write it as 0.10 how do i do it?
tried this: 0.#number# didnt work :)

So are you saying that your values in the variable "number" will have 2 decimal places at the end and that you need to display those decimal places?
If so :
<cfset actualNumber = incomingNumber/10>
<cfoutput>#NumberFormat(actualNumber,".00")#</cfoutput>
should do what you need.

Related

Strange number formating in ssas tabular?

I have a ssas tabular cube. I have a question regarding formatting here:
I have number 1,000,000,000.5
By using format: #,##0,.0
it gets displayed as: 1,000,000.5
I have 2 questions:
What's the logic? how is #,##0,.0 instructing to remove 000?
Also, i would like to get rid of the decimal, and show it like 1,000,000 How can I do it?
Commas before the decimal point that are not followed by # or 0 divide the result by 1000.
Whatever digits it shows will be rounded to that precision. If you want to drop the decimal rather than rounding, you can use TRUNC or INT in the measure definition.
If you use the following format #,### will give you the following.

adjust the user input in the C++

I'm writing a C++ program for bank to withdrawal money , in that code I used fixed and set precision to change the output for two decimal point but I don't want to do that , I want to make sure the user only need to input in decimal number I mean like only two decimal number .
I want like he/she can't able to enter more than two decimal number .00
You can't do this. At least not with standard input and CPP uses the same for taking input.
The best you can do is to take input into a value and cut off the decimal part after the second digit using setprecision(2), or truncate the value once you have it in the variable.
Hope it helped you.

Number conversion in Python 2.7: base6 to base10

Searched about this and didn't find useful help. Maybe I searched wrong. Figured I might just ask here and find out more by that.
Let's say I have 99 numbers with a range from 1 - 6 made from rolling a 6 sided dice 99 times.
And I want to convert this from base6 (is this already base6 format?) to base10 in python 2.7, how would I do it? Code should be non cryptic and readable.
Automatic replacement of 6's to 0's would be good to, if needed.
It's for Bitcoin Private Key generation by the way.
The dice rolls are being entered in manually right when it asks "Enter dice rolls: "
Basicly converting 6 sided dice rolls from number range 1 - 6 -> 0 - 5 -> 0 - 9
Don't laugh, basicly what I have written now is just this:
import ...????
dice_input = input("Enter dice rolls: ")
dice_convert_base6_to_base10 = base10.encode(dice_input)...????
No idea if or what I would need to import and what to do with the dice_input. My question may sound a bit stupid to most of you, please don't judge.. Thanks a lot for every help I can get!
Use the built-in int function doc.
It does conversion from string to integer types. So, you will need to get the input as a string doc.
It accepts a second (optional) parameter of the base you want to assume the source comes from.
Code would end up looking something like:
dice_input = raw_input("Enter dice rolls: ")
dice_convert_base6_to_base10 = int(dice_input, 6)
To convert any 6 to 0, then you could just use the replace method of the string doc.
Code would then be changed to something like:
dice_input = raw_input("Enter dice rolls: ").replace('6','0')
dice_convert_base6_to_base10 = int(dice_input, 6)
Not certain about if this is really the way to get the key generation you want... but, I don't think I really grokked the use-case.

What is SAS format 8.

I am new to SAS and currently working on a small piece of work with SAS.
Could I please ask what the below format means? I believe the 8. is formatting two digits to the right of the decimal place such as 896.33 but I am not sure. Not really sure what input means.
input(tablename.fieldname, 8.)
That is an INFORMAT, not a FORMAT. It means to read the first 8 characters as a number. If there is a decimal point in the data then it is used naturally. You could have up to 7 digits to the right of the decimal point (since the decimal point would use up the eighth character position). It will also support reading scientific notation so '896.33E2' would mean the number 89,633.

Remove decimal points in velocity template

I've written an Velocity email Template. The following Number Field is displaying with a decimal place.
Incident Level: $issue.getCustomFieldValue("customfield_11513") is showing to one decimal place e.g. 4.0
How can I format this number to remove the decimal place. e.g. Just 4 instead of 4.0?
Thanks for your help in advance.
Thanks
Santosh
If you always want an integer, you can use the standard Java method for transforming any Number to its integer value:
$issue.getCustomFieldValue("customfield_11513").intValue()