### Author Topic: Digikey's cap. conversion calculator is wrong when converting nF to Farads?  (Read 1778 times)

0 Members and 1 Guest are viewing this topic.

#### akos_nemeth

• Contributor
• Posts: 30
• Country:
##### Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« on: January 13, 2017, 12:07:36 am »
Hi All,

I tried to convert 100nF to Farads, and I think it is 100/1 000 000 000 = 1 * 10 -7, but Digikey's calculator (http://www.digikey.com/en/resources/conversion-calculators/conversion-calculator-capacitance) says it is 1*10-8.
An other calculator (http://www.unit-conversion.info/capacitance.html) says it is 1 * 10 -7. So I guess nobody noticed, since nobody uses Farads for anything practical?

First image is a screen capture from the Digikey calculator's result, the second is from the result of the "Capacitance Unit Converter".

Regards,
Ákos

#### MK14

• Super Contributor
• Posts: 2580
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #1 on: January 13, 2017, 12:22:36 am »
If you look at the code (view page source, JavaScript), there seems to be one too many zeros, on line 271.

if (pOption == "nF") {
document.getElementById("nF1").value = pIn;
document.getElementById("uF1").value = parseFloat((pIn * 0.001).toFixed(12));
document.getElementById("F1").value = parseFloat((pIn * 0.0000000001).toFixed(12));
document.getElementById("pF1").value = parseFloat((pIn * 1000).toFixed(12));
};

Code: [Select]
if (pOption == "pF") { document.getElementById("pF1").value = pIn; document.getElementById("uF1").value = parseFloat((pIn * .000001).toFixed(12)); document.getElementById("nF1").value = parseFloat((pIn * 0.001).toFixed(12));; document.getElementById("F1").value = parseFloat((pIn * 0.000000000001).toFixed(12)); };if (pOption == "uF") { document.getElementById("uF1").value = pIn; document.getElementById("nF1").value = parseFloat((pIn * 1000).toFixed(12)); document.getElementById("F1").value = parseFloat((pIn * 0.000001).toFixed(12)); document.getElementById("pF1").value = parseFloat((pIn * 1000000).toFixed(12)); }; if (pOption == "nF") { document.getElementById("nF1").value = pIn; document.getElementById("uF1").value = parseFloat((pIn * 0.001).toFixed(12)); document.getElementById("F1").value = parseFloat((pIn * 0.0000000001).toFixed(12)); document.getElementById("pF1").value = parseFloat((pIn * 1000).toFixed(12)); };    if (pOption == "F") { document.getElementById("F1").value = pIn; document.getElementById("uF1").value = parseFloat((pIn * 1000000).toFixed(5)); document.getElementById("nF1").value = parseFloat((pIn * 1000000000).toFixed(5)); document.getElementById("pF1").value = parseFloat((pIn * 1000000000000).toFixed(5)); }

#### Benta

• Super Contributor
• Posts: 2463
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #2 on: January 13, 2017, 12:28:54 am »

My HP15C gets it right every time

#### akos_nemeth

• Contributor
• Posts: 30
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #3 on: January 13, 2017, 01:17:41 am »
If you look at the code (view page source, JavaScript), there seems to be one too many zeros, on line 271.

if (pOption == "nF") {
document.getElementById("nF1").value = pIn;
document.getElementById("uF1").value = parseFloat((pIn * 0.001).toFixed(12));
document.getElementById("F1").value = parseFloat((pIn * 0.0000000001).toFixed(12));
document.getElementById("pF1").value = parseFloat((pIn * 1000).toFixed(12));
};

Code: [Select]
if (pOption == "pF") { document.getElementById("pF1").value = pIn; document.getElementById("uF1").value = parseFloat((pIn * .000001).toFixed(12)); document.getElementById("nF1").value = parseFloat((pIn * 0.001).toFixed(12));; document.getElementById("F1").value = parseFloat((pIn * 0.000000000001).toFixed(12)); };if (pOption == "uF") { document.getElementById("uF1").value = pIn; document.getElementById("nF1").value = parseFloat((pIn * 1000).toFixed(12)); document.getElementById("F1").value = parseFloat((pIn * 0.000001).toFixed(12)); document.getElementById("pF1").value = parseFloat((pIn * 1000000).toFixed(12)); }; if (pOption == "nF") { document.getElementById("nF1").value = pIn; document.getElementById("uF1").value = parseFloat((pIn * 0.001).toFixed(12)); document.getElementById("F1").value = parseFloat((pIn * 0.0000000001).toFixed(12)); document.getElementById("pF1").value = parseFloat((pIn * 1000).toFixed(12)); };    if (pOption == "F") { document.getElementById("F1").value = pIn; document.getElementById("uF1").value = parseFloat((pIn * 1000000).toFixed(5)); document.getElementById("nF1").value = parseFloat((pIn * 1000000000).toFixed(5)); document.getElementById("pF1").value = parseFloat((pIn * 1000000000000).toFixed(5)); }

Hi MK14,

I have sent them a mail, with your finding this will be a very easy ticket for the web developer.

Regards,
Ákos

The following users thanked this post: MK14

#### MK14

• Super Contributor
• Posts: 2580
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #4 on: January 13, 2017, 07:24:23 am »
Hi MK14,

I have sent them a mail, with your finding this will be a very easy ticket for the web developer.

Regards,
Ákos

Thanks for doing that!

I hoped you would, and toyed over suggesting that in my original post.

#### mikeselectricstuff

• Super Contributor
• Posts: 12136
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #5 on: January 13, 2017, 08:30:42 am »
Digikey always seem to have  had a problem acknowledging that nanofarads are a thing
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs

#### Zero999

• Super Contributor
• Posts: 14392
• Country:
• 0999
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #6 on: January 13, 2017, 08:41:50 am »
I've never seen the point in those calculators. I can perform the conversion in my head faster than typing the numbers in.

For some reason, nF is less common in the states than Europe. I don't know why. It's certainly neater to write 4.7nF than it is to write 4700pF, 0.0047µF or 4.7e-9F.

#### amyk

• Super Contributor
• Posts: 6848
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #7 on: January 13, 2017, 11:58:12 am »
That code is pretty horrible, even ignoring the fact that you can write numbers directly in 1en notation in JS it looks like someone just copy-pasted the same block and changed it multiple times. Just map into exponents (e.g. ["pF", "nF", "uF", "F" ] into [-12, -9, -6, 1]), find difference between in and out exponents for each field, and multiply by 10^n. I get the feeling whoever wrote it doesn't understand SI.

#### jpanhalt

• Frequent Contributor
• Posts: 833
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #8 on: January 13, 2017, 12:58:23 pm »
That code is pretty horrible, even ignoring the fact that you can write numbers directly in 1en notation in JS it looks like someone just copy-pasted the same block and changed it multiple times. Just map into exponents (e.g. ["pF", "nF", "uF", "F" ] into [-12, -9, -6, 1]), find difference between in and out exponents for each field, and multiply by 10^n. I get the feeling whoever wrote it doesn't understand SI.

Just a small point...is the exponent for F a 1 or 0?  That is, 62 pF = 62 X 10E-12; 3 F = 3 x 10E0

John

#### Brumby

• Supporter
• Posts: 10109
• Country:
##### Re: Digikey's cap. conversion calculator is wrong when converting nF to Farads?
« Reply #9 on: January 13, 2017, 01:11:17 pm »
It is a 0.

Smf