Jump to content

Float cut Zeroes


thimblemunch
 Share

You are about to reply to a thread that has been inactive for 1630 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

The problem is that we have a sloppy language, and English speakers are not consistent in all corners of the Earth either.  I think Brits are more inclined to speak of the digits after the decimal point as "decimals".  That's not a common usage on this side of the Atlantic, but I can't swear that we have a real standard either.  Among scientific types, we always call them "significant figures", but that would confuse the average man on the street.

Link to comment
Share on other sites


Rolig Loon wrote:

The problem is that we have a sloppy language, and English speakers are not consistent in all corners of the Earth either.  I think Brits are more inclined to speak of the digits after the decimal point as "decimals".  That's not a common usage on this side of the Atlantic, but I can't swear that we have a real standard either.  Among scientific types, we always call them "significant figures", but that would confuse the average man on the street.

In my circle, they're called:

  • Base 02: significant bits
  • Base 10: significant digits
  • Base 16: significant nibbles

I'd never use the term "significant figure", except possibly to describe Richard Kiel.

Link to comment
Share on other sites

Just to muddy the waters a little more, significant digits does not mean a fixed number of decimal places.

Pi to 3 significant digits is 3.14

Jose Altuve's batting average is .337

Speed of sound is 340 m/s

Speed of light is 3.00E8 m/s

 

At least that's the way I was taught in college more years ago than I care to say :)

 

  • Like 2
Link to comment
Share on other sites


Rhonda Huntress wrote:

Just to muddy the waters a little more, significant digits does not mean a fixed number of decimal places.

Pi to 3 significant digits is 3.14

Jose Altuve's batting average is .337

Speed of sound is 340 m/s

Speed of light is 3.00E8 m/s

 

At least that's the way I was taught in college more years ago than I care to say
:)

 

I stand corrected.  My college days were farther back than yours, I'm sure, but I was taught the same.  We chemist types tend to be sloppier about numbers than the physics and math types, even physical chemists.

Link to comment
Share on other sites


Rhonda Huntress wrote:

Just to muddy the waters a little more, significant digits does not mean a fixed number of decimal places.

Pi to 3 significant digits is 3.14

Jose Altuve's batting average is .337

Speed of sound is 340 m/s

Speed of light is 3.00E8 m/s

 

At least that's the way I was taught in college more years ago than I care to say
:)

 

That's how I was taught.

It was my HP pocket calculator that drove home the difference between how scientists and normal people perceive significant digits. I can tell the thing to display in Scientific/Engineering/Fixed formats with a particular number of significant digits. Continuing your three significant digit demonstration on my HP-11C (I still have it)...

Avagadro's number (6.0221409e23):

  • S = 6.02e23
  • E = 602e21
  • F = 6.02e23

My height in mm (1574.8):

  • S = 1.57e3
  • E = 1.57e3
  • F = 1,574.80 (!)

For this reason, unless I'm checking bank statements, I use engineering or scientific notation. I find it easier to keep track of the size and precision of things when the mantissa suggests the precision and the exponent expresses the magnitude.

 

Link to comment
Share on other sites

Har har.

I used my Dad's slide rule until about 1969, when I finally shelled out $75 or so for a pocket calculator (with reverse Poilish notation).  I figured that I might need something more "precise" as a grad student than I had needed as an undergrad. That was the first of many technological missteps in my life.

Link to comment
Share on other sites


Dora Gustafson wrote:


Madelaine McMasters wrote:


Rolig Loon wrote:

reverse Poilish notation

When I encounter a calculator with an = key, I feel like tearing my hair out.

Is there any calculator but a RPN calculator ???

There sure was in 1969.  There was a serious debate about whether RPN was easier to use than algebraic notation, and HP had some rivals.  I still think algebraic notation makes more sense, but that battle was lost almost a half century ago. 

Link to comment
Share on other sites


Rolig Loon wrote:

I still think algebraic notation makes more sense, but that battle was lost almost a half century ago. 


Algebraic notation absolutely makes more sense when you can write/type out the entire equation before hitting "=". But early calculator displays could only show a small number of digits, so you couldn't see the equation you were typing. That meant you'd have to remember all the parentheses as you went along. That's something I can't do even in a fancy text editor. You'd also need parenthesis keys and substantial (for the time) storage for the equation string.

RPN addressed all this with weird elegance. And if there's one thing I can't resist, it's weird elegance.

Link to comment
Share on other sites

You're right, of course, which is why the battle was lost.  If you're looking at the period from today's perspective, it's hard to understand what all the shouting was about.  Remember, though, that we (and our ancestors for generations before) had been taught algebraic notation in high school math classes.  We had the importance of parentheses pounded into our little heads, so it was the only familiar way to write equations (and that's what we felt calculators were supposed to be doing).  Many people were not eager to cede the ground to a bunch of pointy-headed engineers from HP.

Link to comment
Share on other sites


Rolig Loon wrote:

You're right, of course, which is why the battle was lost.  If you're looking at the period from today's perspective, it's hard to understand what all the shouting was about.  Remember, though, that we (and our ancestors for generations before) had been taught algebraic notation in high school math classes.  We had the importance of parentheses pounded into our little heads, so it was the only familiar way to write equations (and that's what we felt calculators were supposed to be doing).  Many people were not eager to cede the ground to a bunch of pointy-headed engineers from HP.

My head is not pointy, I'm wearing my hair up. And yours is a li'l flat where they pounded parentheses into it.

Plplplplpl!!!

Link to comment
Share on other sites


Qie Niangao wrote:


wherorangi wrote:

i had a quick nosey to follow up on what Qie said about 6-digit decimal precision in LSL

Oh eep! I
did
kinda say that, now that I look back, but I only
meant
 the fixed 6-trailing-digit representation when a float is cast to a string, as had been mentioned before in this thread. I just used "precision" imprecisely, with precisely the same imprecision as the function being labeled "fixedPrecision()" which might more
accurately
be called "fixedPoint()".

sorry. I didnt mean to infer that you said something you never did

you just triggered me to go off and have another read about it all

Link to comment
Share on other sites

  • 3 years later...

I use those two functions:

 

string float2Str(float in)
{
    return (string)((integer)in) + "." + (string)((integer)((in - (integer)in) * 100));
}

string vector2Str(vector v) 
{
    return "<" + float2Str(v.x) + ", " + float2Str(v.y) + ", " + float2Str(v.z) + ">";
}

default
{
    state_entry()
    {
    }

    touch_start(integer total_number)
    {
        vector v = <215.7509, 235.845750, 4001.50356>;
        
        llOwnerSay((string) v + "  =======  " + vector2Str(v));
    }
}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1630 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...