L
Lenni
Hi,
I'm currently writing a web application for bicycle wheel builders
that calculate the spoke length for all sorts of variations of hubs
and rims.
I have translated the formula from an Excel spreadsheet and in
JavaScript it looks like this:
var sll=Math.sqrt(Math.pow(((fdl/2*Math.sin((2*Math.PI*cross)))/
(spokes/2)),2)+Math.pow((erd/2-((fdl/2)*Math.cos(2*Math.PI*cross/
(spokes/2)))),2)+Math.pow((c2l+osb),2)-shd/2);
The problem is that I get slightly different results when I use
JavaScript than when I use Open Office Calc. It isn't much, less than
a millimeter, which shouldn't really matter when you're building a
wheel but it is slightly worrying me.
My question, is it possible that the JavaScript Math object is not as
powerful as the Excel or OpenOffice one and that there are just slight
rounding errors that are causing this disparity? Or to rephrase the
question, can I stop checking the formula over and over again for
errors?
Thanks
Lenni
I'm currently writing a web application for bicycle wheel builders
that calculate the spoke length for all sorts of variations of hubs
and rims.
I have translated the formula from an Excel spreadsheet and in
JavaScript it looks like this:
var sll=Math.sqrt(Math.pow(((fdl/2*Math.sin((2*Math.PI*cross)))/
(spokes/2)),2)+Math.pow((erd/2-((fdl/2)*Math.cos(2*Math.PI*cross/
(spokes/2)))),2)+Math.pow((c2l+osb),2)-shd/2);
The problem is that I get slightly different results when I use
JavaScript than when I use Open Office Calc. It isn't much, less than
a millimeter, which shouldn't really matter when you're building a
wheel but it is slightly worrying me.
My question, is it possible that the JavaScript Math object is not as
powerful as the Excel or OpenOffice one and that there are just slight
rounding errors that are causing this disparity? Or to rephrase the
question, can I stop checking the formula over and over again for
errors?
Thanks
Lenni