3 ms·
One of the people I went to school with (several years ahead, his assembly class was on VAX rather than MIPS) had to write a program that solved a polynomial.
by shagie 2y ago
One of the people I went to school with (several years ahead, his assembly class was on VAX rather than MIPS) had to write a program that solved a polynomial.
As he was going through the tome that represented the CISC instruction set of a VAX system (long before easy search engines), he found POLY ( https://www.ece.lsu.edu/ee4720/doc/vax.pdf https://www.ece.lsu.edu/ee4720/doc/vax.pdf page 9-118).
So, his program, instead of doing all the calculations was setting up a few registers, a large comment block that explained it, a call to POLY, and reading out the registers.
He claimed to have gotten full credit and within a handful of semesters later the course was switched from CISC architectures to RISC.
- dan-robertson 2y agoThe instruction you refer to is for evaluating polynomials, not solving them, so I’m a bit confused by your claims. It is pretty common to evaluate polynomials as part of solving them (if you’re aiming for numeric solutions), but solving tends to also require: - some kind of root finding (note that methods like Newton–Raphson don’t work when zeros have multiplicity) - dividing polynomials by (X - a) after finding one root to find the next root
- PopePompus 2y agoThe POLY instruction was the CISCiest of the VAX instructions. One machine instruction could evaluate a polynomial. I think it could even handle the situation where fetching one of the coefficients caused a page fault. If you knew the VAX instruction set well, writing code in VAX assembly was almost as easy as using a higher level language.
- dan-robertson 2y agoWas the instruction really much more complex than eg some byte-string comparison instruction? For string comparison you’re doing a simpler operation at each step, and the accumulation is much simpler, but maybe you have short-circuiting too. POLY corresponds to the following C, I think: float poly(int d, float x, float *c) { c+=d; float y = *c; while(d--) y = *c-- + y * x; return y; } I also don’t see why you consider this to be the CISCiest instruction from an architecture that includes a substring-search instruction, a vaguely printf-like instruction with its own mini instruction set for the pattern strings it takes, and an instruction to do polynomial division in the ring of polynomials over F_2 (ok this is just CRC)
- shagie 2y agoIt's me recalling a story from... '93 or there abouts. My memory about the specifics of it might have suffered a bit over three decades. I do recall that it was something to do with polynomials. It was also something that was fun to port. http://neilrieck.net/docs/openvms_notes_alpha_diary.html http://neilrieck.net/docs/openvms_notes_alpha_diary.html