Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Vanilla

Reply
 
Thread Tools Display Modes
Old August 13, 2010, 06:30   #1
miyazaki
Adept
 
miyazaki's Avatar
 
Join Date: Jan 2009
Location: BC, Canada
Age: 43
Posts: 227
miyazaki is on a distinguished road
[r2038] Weird randart thing

Found this randart in the spoilers:

Code:
The Spear 'Rhorlata' (3d6) (-11,-7)
-----------------------------------
Heavily cursed.
Slays giants.
Cannot be harmed by acid, electricity, fire, cold.
Aggravates creatures nearby.  Drains experience.  Induces random
teleportation.  


Min Level 1, Max Level 0, Generation chance 40, Power 4294967291, 5.0 lbs
miyazaki is offline   Reply With Quote
Old August 13, 2010, 07:04   #2
juggle5
Scout
 
Join Date: Feb 2009
Posts: 30
juggle5 is on a distinguished road
Looks like a signed/unsigned int bug. If the power was set to -5 (is a negative power allowed?), but printed as an unsigned integer, then the output would be 4294967291.
juggle5 is offline   Reply With Quote
Old August 13, 2010, 07:05   #3
emulord
Adept
 
Join Date: Oct 2009
Posts: 192
emulord is on a distinguished road
Looks like the Power calculation overflowed to negative. Thats near MaxUnsignedLong. It wont ever generate, but if it could it would be worth a lot according to power based pricing (??)
emulord is offline   Reply With Quote
Old August 13, 2010, 08:14   #4
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,414
Donated: $40
Pete Mack is on a distinguished road
No overflow, just a formating problem in the log file.
There are a handful of negative power artifacts. (Nobody sane would use Mormegil or Beruthiel, unless it's some kind of crazy challenge.)
Pete Mack is offline   Reply With Quote
Old August 13, 2010, 16:46   #5
miyazaki
Adept
 
miyazaki's Avatar
 
Join Date: Jan 2009
Location: BC, Canada
Age: 43
Posts: 227
miyazaki is on a distinguished road
I wondered more about the max depth.
miyazaki is offline   Reply With Quote
Old August 31, 2010, 21:49   #6
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by miyazaki View Post
I wondered more about the max depth.
Max depth is also based on power, so anything with negative power will have max depth 0. I will fix this soon, so max depth is never below 100.

@Pete: what's the right %foo formatting to print a signed int instead of unsigned?
Magnate is offline   Reply With Quote
Old September 6, 2010, 02:52   #7
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,414
Donated: $40
Pete Mack is on a distinguished road
@magnate:
In the unlikely event that you haven't figured this out already:
Code:
printf("%u", i);
Pete Mack is offline   Reply With Quote
Old September 6, 2010, 12:46   #8
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Pete Mack View Post
@magnate:
In the unlikely event that you haven't figured this out already:
Code:
printf("%u", i);
Thanks Pete - how fabulously counter-intuitive is that! %d for UNsigned, %u for signed!
Magnate is offline   Reply With Quote
Old September 6, 2010, 20:07   #9
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Quote:
Originally Posted by Magnate View Post
Thanks Pete - how fabulously counter-intuitive is that! %d for UNsigned, %u for signed!
Why would you ever want to do that? The only time I care how I print unsigned stuff is bit flags or pointers or the like, and those I want in hex. The standard %d works fine unless the high order bit is 1. If you have real unsigned stuff with high bit of 1, you are playing with fire because you'll have overflow errors sooner or really sooner.

If you have an unsigned char packed into a normal char, %d combined with a cast of the argument works fine.
PowerDiver is offline   Reply With Quote
Old September 6, 2010, 20:25   #10
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 39
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by Magnate View Post
Thanks Pete - how fabulously counter-intuitive is that! %d for UNsigned, %u for signed!
I think you have this backwards:

Code:
#import <stdio.h>
int main(void) {
    unsigned int i = -1;
    printf("%d %u\n", i, i);
    return 0;
}
Produces:

Code:
-1 4294967295
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bug (possible) with rating for OOD objects in r2038 Twilight Development 2 August 12, 2010 15:00
Is there such a thing as too much speed? Fendell Orcbane AAR 13 June 20, 2010 10:05
weird bug in r1877 shawnosullivan Vanilla 9 January 5, 2010 06:41
The saddest thing about ... PaulBlay Idle chatter 3 June 5, 2009 06:46
Just a weird thought! or not! NeoWizard Vanilla 2 January 25, 2009 08:54


All times are GMT +1. The time now is 04:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.