homepage Welcome to WebmasterWorld Guest from 54.166.105.24
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Engineering Output Notation
neil laurance




msg:589179
 9:47 am on May 10, 2001 (gmt 0)

Quick question:

Is there a simple way of getting Engineering notation using JScript or CSS?

I know you can use number.toExponential(3) to show numbers in exponential format, but engineering is slightly different:

Number: 12345.67
Exp format: 1.234e+4
Eng format: 12.345e+3 (ie the exponent is divisible by 3)

Cheers, Neil

 

tedster




msg:589180
 11:33 am on May 10, 2001 (gmt 0)

Welcome to WebmasterWorld, Neil

That's quite a first question!

I've checked a number of references and I can't uncover a JavaScript method that will do this. Seems like it ought to exist, since I believe e-notation is a standard floating point notation for JavaScript, but...

You might want to download and search one of these documents. What you need might just be tucked away in a corner somewhere.

ECMAscript documentation [ecma.ch]

Netscape's JavaScript documentation [developer.netscape.com]

Microsoft's Jscript documentation [msdn.microsoft.com]

Xoc




msg:589181
 5:00 pm on May 10, 2001 (gmt 0)

I also looked at the EcmaScript spec and didn't see one. I think you could write your own function that uses toExponential, then parses the string and fixes it up into engineering format.

Welcome to WMW.

neil laurance




msg:589182
 10:26 am on May 11, 2001 (gmt 0)

Thanks for all the advice. Will try creating my own function and adding to Number.prototype methods...

Cheers, Neil

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved