need a program to perform polynomial division with linked lists or arrays. i already tried multiplication,subtraction and addition but stucked in division can anyone help me out on this. |
+0 forum
0 | ||

Program Design |
+0 forum
1 | ||

Hello, I wrote a library for arbitrary precision arithmetic recently and spent a long time implementing efficient multiplication algorithms. Now I am looking to see if it is possible for me to optimize anywhere else. One place that I thought should be more optimizeable is my division algorithm. Right now I use (hiding some internal implementation stuff): Int divide(Int numerator, Int denominator)const { if (denominator==0) return DIVIDE_BY_ZERO_ERROR; if (numerator==0) return 0; if (numerator.sign()!=denominator.sign())//result is negative return -((-numerator)/denominator); if (numerator==denominator) return 1; Int num=numerator.abs(); Int den=denominator.abs(); Int ret=0; while (num>den) { ret++; num-=den; } return ret; } Which is fairly slow, … |
+0 forum
7 | ||

How to dynamically add div in asp web page ?ie, if mssql server returned n rows from a query, i must place all these n rows in seperate div which has to be created dynamically.!!pls help (d case is when displaying search results in a web page like shopping sites) |
+0 forum
3 | ||

Looking for a politcal map showing countries. Colors can be added to the countries and information is shown when a region is selected. Do you know if there are any possible ways to do this? I avoid using Flash or Java. |
+0 forum
2 | ||

How do I put the following output in a table format as shown below in the code? |
+0 forum
2 | ||

Hi folks. I have a strange thing happening here. I have a loop where counter gets incrememnted by 0.1 starting from 0 and up to 1. In each iterration I use the counter in an expression with modulo operator. I get incorrect result when the counter has values of 0.8 and 1. This is the code: <?php echo '<pre>'; for($i = 0; $i <= 1; $i += 0.1) { // result of an expression $result = ($i * 10) % 10; // display $i, the expression and the result of the expression // when $i equals 0.8 and 1 the … |
+3 forum
12 | ||

Hello to everyone! This is my first post here, I hope you can help me. I'm making a class work in python and I'm a little lost: I have to use classes to represent monomials and polynomials, and the classes should contain methods to add, substract, multiply and divide them. So far, I've been able to create the whole monomials class, and almost all the polynomial class, but I can't find a way to code polynomial division. Surfing the web I've seen some methods based on binary conversion and things like that, but that doesn't seem to work for me … |
+0 forum
9 | ||

what I'm pretty sure I learned in school and what like every website said when I tried to look this up online was that the C++ code for generating a random number with floor: 1 and ceiling 100 (err I guess 101) is: [CODE]int number = rand() % 100 + 1; [/CODE] and that is generating a number... but everytime I compile the program, or run the same program more than once, 'number' always = 8... like everytime... and I tried changing it to [CODE]int number = rand() / 100 + 1; [/CODE] but then number always = 169.. not … |
+0 forum
8 | ||

Hello! To get straight to the point, I can't seem to get division to work. I haven't been programming in Assembly long, and I've been trying to get this to work for a couple of days now with no success. Anyway, here's my code: [CODE=assembly] section .text global _main extern _write _main: mov al, 5h mov bl, 2h div bl xor bh, bh mov bl, al push 1 push bx push 1 call _write add esp, 12 mov eax, 0 ret [/CODE] It compiles fine, but when I try to run it, all it does is spew out a lot … |
+0 forum
3 | ||

Hi to all, I am new to this forum..If i did any thing wrong in this thread please correct me... Let me tell you something about my project .... I am working on ARM7-LPC2148 processor with Graphical LCD. Now i am making a calculator which should be like as our PC calculator... I did in a normal way this calculations that means The steps involved in my calculator are... 1. Taking input numbers as strings 2. converting them to float values by using [B]atof()[/B] function which is having a limitation to return floating value. 3. Doing all calculations in a … |
+0 forum
4 | ||

Hello, I am trying to write a algoritm that calculates the second largest divisor of a number. But i have absolutely no idea what calculations are required for this. [CODE] for (ulong i = 1; i < Number; i++) { Number = .....? }[/CODE] Already know the largest common diviser of 2 numbers, but i cannot find anything considering the second largest divisor of a number. Kind regards. |
+0 forum
10 | ||

I have created class menu and class number. I would like that my functions in class do sum, subtract, multiply, and divide. I've done sum, but I have problems with other functions. When I do difference, it is actually sum my numbers, and result of multiplication and division is 0 all the time. Could somebody help me with this problem. I have attached my implementation files and header files. |
+0 forum
10 | ||

I am trying to divide a integer (2's complement) by a power of 2 and then round that number toward zero. I am only allowed to use bitwise operators such as shifts, ~ ^ & | etc. I've came up with 2 expression but they dont seem to work. Can anyone help me out. x/(2^y) 1) x>>y example: 15/2^1=7 00001111(15) >>1 = 00000111 (7) Why doesn't this work? 2) a=~x b=a>>y c=~b example: 15/2^1=7 00001111(15), ~15 = 11110000, shift by y = 11111000, negate c = 00000111 = 7 Can someone explain why this doesnt work either? |
+0 forum
1 | ||

I am fairly new to programming but have been working on putting together a group of functions into one program. It is coming along nicely, but for some reason I can't get the loop on the divisibility function to work properly. When you prompt it to quit to return to the main menu, it interprets q as something you want to know divisibility for, not a prompt to quit. WHY????? [CODE]#include <iostream> #include <math.h> #include <iomanip> using namespace std; int divisCalc(); int calculator(); void enterPrompt(); int byteSize(); int main1() { do { cout << "\n\n~~\n~~\n~~\n~~ \n~~\n\nPress 1 for a calculator\n" … |
+0 forum
5 | ||

I am trying to edit my current homework assignment to include a loop that lets the user repeat the computation for new values until the user says they want to end the program. I was given a hint to use integer division and the % operator to implement this function. I have created the program from scratch and researched my book for the last 3 hours (plus online), but cannot figure out how to use integer division and modulus as a loop control. Can someone help explain it to me? Below is the code I have written (it compiles and … |
+0 forum
8 | ||

in my code [B]Devide [/B]method is not working it gives an error "ExceptionHandling.Program.Devide(int, int)': not all code paths return a value" When i change public int Devide method in to void,the programe is workig , plz explain me what is the wrong with my code, im new to programming , plz help me [CODE]class Program { public int Devide(int a, int b) { try { int k; k = a / b; return k; } catch (DivideByZeroException e) { Console.WriteLine(e.Message); } } static void Main(string[] args) { int c; Program p = new Program(); c= p.Devide(8,0); } }[/CODE] |
+0 forum
6 | ||

Code Snippet
1/3=0 eliminator This function I did to improve calculator program by eliminating problems with Pythons problem of dividing integer with integer and giving integer division result. |
+0 forum
5 | ||

Hi, here is the thing, I'm trying to make my university grading table on C++, when i fill in the grades it should tell me what i have accumulate. the thing is that when i insert the text grades it shows a zero when i click the buttom. the math is simple `[ j ]` are the int and the `[ i ]` are the decimals they must add up and multiply by the percent which in this case is Edit5,E6,E7,E8 here is the code; acu= the acumulated `[ j+(i/10)]` i being the decimal. void __fastcall TForm1::B1Click(TObject *Sender) { int … |
+0 forum
5 | ||

Hello, I'm having a problem trying to trying to store a local variable in my asm program. I push 3 parameters: nbrElts (number of elements in the array), nbrArray (the address of the array), and result1 (the average). I'm trying to divide by the number of elements that I push into the local variable space [ebp-4], but it locks up at that instruction and I can't figure out why. Any help would be greatly appreciated! Main program: [CODE].386 .MODEL FLAT INCLUDE io.h cr EQU 0dh ; carriage return character LF EQU 0ah ; linefeed character maxNbrs EQU 5 ; size … |
+0 forum
1 | ||

Hello, I am having a problem with divisions.. prob: 1st container div, in this div theres another division TOP whose position is relative.. in this div.. theres another div named searchbox .. and its top is 50px.. IE shows its 50px down from the TOP division but firefox places it 50px from windows's boundry how can i correct this problem.. please help regards, |
-1 forum
2 | ||

[CODE] ;==================Prompts=============== warning db "Invalid order. The dividend should be greater than the divisor",0 prompt1 db 0dh,0ah,"Please enter a dividend ",0 prompt2 db 0dh,0ah,"Please enter a divisor ",0 Display db 0dh,0ah,"Quotient: ",0 Display2 db 0dh,0ah,"Remainder: ",0 ;==================Variables============= dividend word ? ; Holds the dividend divisor word ? ; Holds the divisor quotient word ? ; Holds the quotient Remain word ? ; Holds the remainder ;==================Main================== .code main PROC .startup mov dx, offset prompt1 call writestring call readint mov dividend, ax mov dx, offset prompt2 call writestring call readint mov divisor, bx CWD div bx mov quotient, ax mov dx, … |
+0 forum
2 | ||

Hello! I'm kind of new in assembly programming and I've been struggling with the following problem today: How to print an integer, using BIOS interrupt [B]10h[/B], with its [B]0Eh[/B] in AH register, as its function to print a character to the screen... For example, how to print the last digit of 2005. here's what I've tried, using division by 10: [CODE] mov ax, 2005 mov cx, 10 div cx ; now, AH should contain the remainder (5) and AL = 200 mov al, ah ; because AL should contain the character to print add al, 48 ; because ASCII code … |
-1 forum
2 |

The End.