Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello guys I am not a programmer so for me it is more of a hobby. I am trying to write a small routine that calculates electrical parameters' such as voltage impedance resistance current etc: I have no problems with the actual program, but what I want to do is get for example 5,000 ohms to appear as 5 K.ohms or 5,000,000 as 5 M.ohms. also working with micro and pico. for capacitors, any help would be greatly appreciated.

best regards

jack

What I have tried:

I can write the formula for the actual items but can get an answer like 1.1962222086548E+56 for example
I have not tried any thing yet as I do not have a clue what to do
Posted
Updated 1-May-19 0:53am
Comments
Member 14333655 2-May-19 10:23am    
hello OriginalGriff I am not sure how to get back to you so this is in the hope that it gets to you. firstly thank you for the speedy reply, also your solution seems to work very well, although when converted to vb the calling routine did not work I had to add SurroundingClass in front of humanscale to get it to call, as below just incase someone else takes it up.

Console.WriteLine("{0,2} {1,24} {2}", i, l, SurroundingClass.HumanScale(l))
I got arithmetic overflow when I = 18. 18 1012345678901234567 1.01E

I am now trying to fit it in to my project, so once again thankyou very much for your help it is really appreciated.
Jack
[no name] 7-May-19 11:43am    
Best is to write your comment above as a comment for OriginalGriff's answer. How do I make 5000 ohms appear as 5 kohms in VB .NET[^]
Thislike he will be notified.

1 solution

Have a look at this: A simple "human scale" number to string converter[^] - it's in C#, but it's pretty obvious, and anything you can't understand you can feed to this: Code Converter C# to VB and VB to C# – Telerik[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900