FAQ Database Discussion Community


Cannot divide two NSNumbers in swift?

ios,swift,nsnumber,divide
I have two NSNumbers that I want to divide, but in the last line of the code I get the error: "Cannot invoke '/' with an argument list of type '(@Ivalue NSNumber,@Ivalue NSNumber)'" var firstnumber: NSNumber = object["numberone"] as NSNumber var secondnumber: NSNumber = object["numbertwo"] as NSNumber var calculated: NSNumber...

Divide cell or array of arbitrary size into pieces of defined size

arrays,matlab,cells,divide
I have a list of coordinate data that I am trying to divide into pieces small enough to send to a microcontroller. Currently I have a cell of data that looks like this which is quite large: [46.06,32.98] [15.66,78,42] Etc. I need to round the values so I convert it...

get 7 digit after point in java

java,decimal,bigdecimal,divide
I want seven digit after dividing a integer,i have ddhh.mmmmm lat long I have to convert it dd.(hhmmmm/60) with 7 digit after point. My code: public static String getCoordinates(String data) { System.out.println(data); String mm = data.substring(2).replace(".", ""); int int_mm = Integer.parseInt(mm); double d_mm = int_mm / 60.00000000; String s_mm =...

Why is dividing double values returning null?

java,null,double,divide
In Jaspersoft Studio I have tried the following expression. I am getting null but I don't understand why. This should be as simple as 3.00/2 and display 1.50 however it is not working it still shows null. I have confirmed that the fields contain values for all fields. The expression...

BigDecimal 1.0E+8 / 100000000 with ROUND_HALF_UP is 0

java,rounding,bigdecimal,divide
Can some one explain why I get 0 as result for the first line? System.out.println((new BigDecimal("1.0E+8")).divide(new BigDecimal(100000000), BigDecimal.ROUND_HALF_UP)); System.out.println((new BigDecimal("1.0E+8")).subtract(BigDecimal.ONE).divide(new BigDecimal(100000000), BigDecimal.ROUND_HALF_UP)); 0E+7 1 ...

Sublisting list of integers into lists of same integers

algorithm,list,divide,sublist
Hi I have a simple question. I am grabbing data from an API and the way that they have their data setup is that objects have an id and I return it into a list. So I will get a list of objects like so: List = {Object1, Object2, Object3,...

fixed position
with width 100% leaves some space on left

html,css,navigationbar,divide
I was writing a simple website for myself. I'm in the process of creating a fixed navigation bar at the bottom of the page for navigation (duh) and some social media links. I have only created the div right now but even with width set to 100% there is some...

divided into sections alphabetic my Tableview

ios,tableview,alphabetical,sections,divide
i have an array that contains name in string format (es.luca,marco,giuseppe,..). This array will be used to fill the table. how can I divide the table into sections (az) and put in the name of the array inside the right section?

Numpy in what situation will return “Divide by zero error”?

python,numpy,zero,divide
I have an expression as below, where as data is a matrix and theta is a vector, python constantly raise divide by 0 error. But the only denominator is (1+e^x), every element in this matrix cannot be 0 anyway np.sum(-data[:,-1]*np.log(1.0/(1.0+np.exp(-np.dot(data[:,:-1],theta.transpose()))))) Is there any occasion I've ignored that will generate this...

Divide One Pandas Dataframe by Another - Ignore index but respect columns

python,pandas,divide
I have 2 dataframes. I would like to broadcast a divide operation df1= pd.DataFrame([[1.,2.,3.,4.], [5.,6.,7.,8.], [9.,10.,11.,12.]], columns=['A','B','C','D'], index=['x','y','z']) df2= pd.DataFrame([[0.,1.,2.,3.]], columns=['A','B','D','C'], index=['q']) Notice that the columns are aligned slightly differently in df2. I would like to divide df1 by df2 where the row is broadcast but the column labels are...

How to divide string in perl for 2 parts

string,perl,divide
so I need to divide my string in perl for 2 parts. For example I have: $string = "../dira/dirb/*.txt" And I want to divide it on: $stringA = "../dira/dirb" $stringB = "*.txt" But if I have: $string = "dira/dirb/dirc/.../dirn/test.pl"; I want to divie it on: $stringA = "dira/dirb/dirc/.../dirn" $stringB =...

Dividing an image into two non-rectangular non-square sub-image in matlab

image,matlab,matrix,binary,divide
Assume that I have an image like this: http://www.mathworks.com/help/releases/R2015a/examples/images/BasicImageImportProcessingAndExportExample_03.png (It is original image in matlab pout.tif) And help image (binary mask) like this: http://upload7.ir/uploads//df17be22203e3099ba0d86e7cb203477bc909244.jpg (With the same size of the original image) I wrote this simple code for dividing the original image into two images: I=imread('pout.tif'); figure,imshow(I),title('original image') Ih=imread('helpPic.jpg'); Ih=rgb2gray(Ih);...

How do you round quotients when dividing in nasm?

assembly,decimal,nasm,divide
im not sure if m using the wrong data types or the wrong instruction or what but div,idiv,fdiv all seem to give me a 0 for the quotient. And i want to get some decimal number rounded to a couple decimal places. i think im using the correct registers for...

Divide two variables in bash

bash,variables,divide
I am trying to divide two var in bash, this is what I've got: var1=3; var2=4; echo ($var1/$var2) I always get a syntax error. Does anyone knows what's wrong?...

pandas dataframe operation (divide multiply) with two different time indices

python,pandas,divide
Trying to divide a column in one data frame with daily time index over many years by a column of a second data frame which is indexed by day of year. For example, make a dataframe indexed daily. Make a second dataframe with the median values by date. import pandas...

SQL Divide by Zero Error

sql,sql-server,divide
I have an annoying problem which is stopping me from generating some data; The SQL job has 23 steps in total and fails on the 21st. -- Step 21 Create the table z1QReportOverview -- Create z1QReportProjectOverview.sql -- Project Overview - By Category (Part 4).sql USE database SELECT z1QReportProjectOverview1.[ERA Category] AS...

İmage Dividing in C for DCT

c,image,divide,dct
Can anyone please tell us how to divide the image into 8X8 blocks? I can read the image, but not divide it into an 8x8 submatrix for DCT. int main() { FILE *image_raw; unsigned char **matriz_image; int i, j; int rows=1080, colums=1920; matriz_image = (unsigned char **) malloc (rows*sizeof(unsigned char...