DIY PROM Do It Yourself PROM chip burning help. No PROM begging. No PROMs for sale. No commercial exchange. Not a referral service.

Assembly square root function

Thread Tools
 
Search this Thread
 
Old Jun 28, 2007 | 01:54 PM
  #1  
5.7RamJet's Avatar
Thread Starter
Member
iTrader: (2)
 
Joined: Mar 2006
Posts: 236
Likes: 0
From: Hudson, OH
Car: '87 Formula
Engine: Ramjet 350
Transmission: T56
Axle/Gears: 3.23
Assembly square root function

Does anyone know of or have a square root procedure (mathematical or assembly). So far I've only found long approximation methods but maybe this is really the best way of doing it? In that case how do they get so accurate with say sqrt function in high level languages (my own thought but feel free to answer if you care to).

I'm messing around trying to calculate something as practice and learning (HP and Torque due to drag) but I need to raise to power of 2.5, which can be done by square root of 5th power, but I need that sqaure root model.
Reply
Old Jun 28, 2007 | 02:08 PM
  #2  
Apeiron's Avatar
Moderator
 
Joined: Jan 2000
Posts: 20,981
Likes: 11
From: Mercedes Norte, Heredia, Costa Rica
Car: 1984 Z28 Hardtop
Engine: 383 Carb
Transmission: 4L60
Axle/Gears: 3.54 Dana 44
Re: Assembly square root function

All methods of calculating irrational roots are approximate, but can be improved through iteration to any precision desired.

Do you want an implementation in floating point? fixed point? integer? what format?

What's the equation you're trying to use?
Reply
Old Jun 28, 2007 | 02:59 PM
  #3  
5.7RamJet's Avatar
Thread Starter
Member
iTrader: (2)
 
Joined: Mar 2006
Posts: 236
Likes: 0
From: Hudson, OH
Car: '87 Formula
Engine: Ramjet 350
Transmission: T56
Axle/Gears: 3.23
Re: Assembly square root function

Rolling Resistance, cell C13.
Attached Files
File Type: zip
HP.zip (2.4 KB, 34 views)
Reply
Old Jun 28, 2007 | 04:06 PM
  #4  
Apeiron's Avatar
Moderator
 
Joined: Jan 2000
Posts: 20,981
Likes: 11
From: Mercedes Norte, Heredia, Costa Rica
Car: 1984 Z28 Hardtop
Engine: 383 Carb
Transmission: 4L60
Axle/Gears: 3.54 Dana 44
Re: Assembly square root function

Do you want floating, fixed or integer?
Reply
Old Jun 28, 2007 | 05:01 PM
  #5  
RBob's Avatar
Moderator
iTrader: (1)
 
Joined: Mar 2002
Posts: 18,432
Likes: 233
From: Chasing Electrons
Car: check
Engine: check
Transmission: check
Re: Assembly square root function

Apeiron, glad to see that you have this one. My level of math doesn't mesh that well with assembler.

Another thought would be to use a lookup table.

RBob.
Reply
Old Jun 28, 2007 | 05:38 PM
  #6  
Apeiron's Avatar
Moderator
 
Joined: Jan 2000
Posts: 20,981
Likes: 11
From: Mercedes Norte, Heredia, Costa Rica
Car: 1984 Z28 Hardtop
Engine: 383 Carb
Transmission: 4L60
Axle/Gears: 3.54 Dana 44
Re: Assembly square root function

I'd also use a lookup table, since speed is the only variable that needs a fractional root.

There are a number of interesting algorithms for calculating square roots to any desired precision though, depending on which format you're using. All of them are slow.

Last edited by Apeiron; Jun 28, 2007 at 05:47 PM.
Reply
Old Jun 29, 2007 | 01:34 AM
  #7  
5.7RamJet's Avatar
Thread Starter
Member
iTrader: (2)
 
Joined: Mar 2006
Posts: 236
Likes: 0
From: Hudson, OH
Car: '87 Formula
Engine: Ramjet 350
Transmission: T56
Axle/Gears: 3.23
Re: Assembly square root function

Thanks guys, didn't think of the lookup table, thats a good idea. I'll give it a go.

I didn't think about implementing the equation until I was actually writing the code. I think I got too far ahead of myself. BTW, I'm doing it the hard way...with a hex editor, since I don't have a source with the wideband patch, let alone all my values transferred. I guess it's not really that much harder, just have to watch the addressing. Good learning though

Thanks again.
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
oil pan 4
Fabrication
2
Oct 6, 2015 11:56 AM
gord327
Transmissions and Drivetrain
19
Oct 3, 2015 01:25 PM
timbuck
Convertibles
3
Sep 28, 2015 12:31 PM
Dragonsys
Engine/Drivetrain/Suspension Parts for Sale
2
Sep 25, 2015 03:51 PM




All times are GMT -5. The time now is 01:29 PM.