Mike McManus wrote:
One example they have is dividing 50000 by 'a' = 515. Really? What the heck is this? This is akin to dividing 500 miles by 'apple' it just doesn't make sense as to why this is allowed.
Mike McManus wrote:But where can i find that a lower case 'a' is ALWAYs = 97 (roughly) - and why would i want to?
In the real world, why would you ever want to do math with apples and oranges - numbers and letters?
Mike McManus wrote:
Your example shows adding 'A' to ch and then subtracting 'a' - ALL character / alphabetic characters!!! This is not math! This is gibberish. Who knows what the result will be? How can you count on it?
I was able to figure out that in the previous example of 50000 / a = 515 that a = 97 (roughly) this is algebra. But where can i find that a lower case 'a' is ALWAYs = 97 (roughly) - and why would i want to?
In the real world, why would you ever want to do math with apples and oranges - numbers and letters?
Mike McManus wrote:Junilu - even with your example it still does not make sense to me. In your example of a method that converts a character to upper case, how does the "math" in your example work?
As far as imagining how I'd do this without math - there is a limited number of letters in the alphabet, how about doing this with arrays? Find the the lower case value and return the corresponding upper case value - this makes sense to me, it's simple, and does not use this goofy "math".
Perhaps it is just because I haven't been exposed to it, but I still cannot wrap my head around using alphabetic characters in a math equation.
Under what circumstances?
Mike McManus wrote:As far as imagining how I'd do this without math - there is a limited number of letters in the alphabet, how about doing this with arrays? Find the the lower case value and return the corresponding upper case value - this makes sense to me, it's simple
Mike McManus wrote:But how in the heck can a character value of 'a' be converted to a numeric value???
Why would you want to? This doesn't make sense to me.
how about doing this with arrays? Find the the lower case value and return the corresponding upper case value - this makes sense to me, it's simple, and does not use this goofy "math".
In the real world, why would you ever want to do math with apples and oranges - numbers and letters?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Mike McManus wrote:So the TOUPPER method is really just calculating an offset ('A' -'a') to apply to the character that is passed in. So in reality it is:
Thanks for everybody's help on this.
And the journey continues...
Does that only work for English characters?Junilu Lacar wrote:. . . -32
So if that's an offset, I would add it to ch. . . .
Mike McManus wrote:Paul - thank you for the link to the code table. Now this makes more sense, every letter represents a numeric equivalent. So the TOUPPER method is really just calculating an offset ('A' -'a') to apply to the character that is passed in. So in reality it is...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie wrote:Does that only work for English characters?
Be reasonable. You can't destroy everything. Where would you sit? How would you read a tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|