Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (499)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  log to parameterised base?  (Read 1554 times)
0 Members and 1 Guest are viewing this topic.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Posted 2004-05-25 00:28:14 »

Why does java.lang.Math have:

log( a ) = loge( a )

but no

log( val, base ) = logbase( a )?

I need to take floats and do a base-2 log...

Is there some obvious transformation that takes you from arbitrary base to arbitrary base that I have embarassingly forgotten?  Embarrassed

malloc will be first against the wall when the revolution comes...
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #1 - Posted 2004-05-25 02:08:25 »

logb(r) = loga(r) / loga(b)

eg:
log10(7) = log2(7) / log2(10)

弾幕 ☆ @mahonnaiseblog
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #2 - Posted 2004-05-25 02:31:34 »

Thanks, man. I went to a secondary school famous for high quality of its maths teaching/students and was in the top set, yet thanks to a f***ed up old vicar (head of maths!) was never taught basic stuff like that - he was too busy doing 2nd-year undergraduate teaching, and had a rule: Any student who was so stupid and lazy they took notes during his class was thrown out (literally: I saw him once pick up a 16 stone lad (who was one of the top rugby players in the school) one-handed, and actually *throw* him out the door in a fit of righteous (holy? unholy?) rage.

LOL. Oh, yeah, we weren't allowed text-books either; I think he considered them somewhere near to "spawn of Satan" in the wider scheme of things. No notes and no textbooks made life...well, kinda tricky. Grin

EDIT: so stuff like this I didn't find out until undergrad courses, and it will forever be kind of "new" to me...

malloc will be first against the wall when the revolution comes...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mark Thornton

Senior Member





« Reply #3 - Posted 2004-05-25 08:42:43 »

They are adding a log10 method in Tiger to help those who haven't learnt these basic rules for logarithms. A log2 method was proposed but appears to have been rejected.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4919337
Offline shmoove

Junior Member




Doh!


« Reply #4 - Posted 2004-05-25 09:01:00 »

Quote
They are adding a log10 method in Tiger to help those who haven't learnt these basic rules for logarithms. A log2 method was proposed but appears to have been rejected.

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4919337

Log2 rejected? What are they thinking of? I'll take a log2 over a log10 any day.

shmoove
Offline Mark Thornton

Senior Member





« Reply #5 - Posted 2004-05-25 09:56:07 »

Remember that the accuracy requirements for the Math package mean that simply writing log2(x) as log(x)/log(2) would probably not be sufficient. Thus this apparently simple task of implementing log2 is rather more complex than it first appears (at least for Java implementors). Sun probably don't have the resources to implement all the proposed math methods in the Tiger time frame, to the accuracy required by the specification and the performance we would like to expect.

As to log10 vs log2, I think log10 was the correct choice. It remains the most commonly understood form of logarithm outside specialist communities.
Offline shmoove

Junior Member




Doh!


« Reply #6 - Posted 2004-05-25 10:38:03 »

Quote
As to log10 vs log2, I think log10 was the correct choice. It remains the most commonly understood form of logarithm outside specialist communities.

Wouldn't you consider programmers a specialist community? One that might find log2 more useful than log10?
Well, I guess they know better...

shmoove
Offline Mark Thornton

Senior Member





« Reply #7 - Posted 2004-05-25 12:51:16 »

In my experience log2 in code (as opposed to proofs of program behaviour) is very rare.
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #8 - Posted 2004-05-25 14:37:05 »

Hehe well my math/physic skills are also a bit rusty.

I guess it's about time doing a refresh. Kinda funny actually. As you might know... the refresh intervals for keeping information for a life time are also logarithmic Wink

弾幕 ☆ @mahonnaiseblog
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (31 views)
2014-04-15 18:08:23

BurntPizza (28 views)
2014-04-15 03:46:01

UprightPath (43 views)
2014-04-14 17:39:50

UprightPath (26 views)
2014-04-14 17:35:47

Porlus (42 views)
2014-04-14 15:48:38

tom_mai78101 (64 views)
2014-04-10 04:04:31

BurntPizza (124 views)
2014-04-08 23:06:04

tom_mai78101 (223 views)
2014-04-05 13:34:39

trollwarrior1 (190 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!