Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000737Core InformEquations, units, arithmeticpublic2011-09-01 12:462014-05-07 07:33
Assigned Tograham 
PlatformOSOS Version
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0000737: Compiler generates unit scales too large for Z-code
Description(From discussion in forum thread [^] )

The attached code, in Z-code, displays

One meter is 0.1km.
One centimeter is 0.1km.
Ten meters is 0.1km.

This is because the unit scale of kilometers is 100000, which doesn't fit in a Z-code word.

If we add the line "now L is 1km", the compiler would (correctly) error out saying: "You wrote 'now L is 1 km' but you use a literal specification to make a value which is too large, at least with the Settings for this project as they currently are." The attached code should throw a similar problem message, whether or not such a literal is used.

Theoretically a game could proceed correctly with these units, by never using lengths over 0.31km and never printing a value in kilometers at all. But I think that's too antsy to let go.
Minimal Source Text To Reproduce
The Kitchen is a room. 

Length is a kind of value.

1m (in metric units, in m) or 1 m (in metric units, in m) or 1 meter (in meters, singular) or 1 metre 
(in metres, singular) or 2 meters (in meters, plural) or 2 metres (in metres, plural) specifies a length.

1cm (in metric units, in cm) or 1 cm (in metric units, in cm) or 1 centimeter (in centimeters, singular) 
or 1 centimetre (in centimetres, singular) or 2 centimeters (in centimeters, plural) or 2 centimetres 
(in centimetres, plural) specifies a length scaled down by 100.

1km (in metric units, in km) or 1 km (in metric units, in km) or 1 kilometer (in kilometers, singular) 
or 1 kilometre (in kilometres, singular) or 2 kilometers (in kilometers, plural) or 2 kilometres (in 
kilometres, plural) specifies a length scaled up by 1000.

When play begins:
	let L be 1 m;
	say "One meter is [L].";
	now L is 1 cm;
	say "One centimeter is [L].";
	now L is 0.01 km;
	say "Ten meters is [L].";
TagsNo tags attached.
Effect(serious/mild) Game compiles but misbehaves
Attached Files

- Relationships

-  Notes
graham (administrator)
2014-04-03 01:40

A problem message now catches this.

- Issue History
Date Modified Username Field Change
2011-09-01 12:46 zarf New Issue
2011-09-07 04:58 EmacsUser Status new => confirmed
2014-04-03 01:40 graham Note Added: 0002609
2014-04-03 01:40 graham Status confirmed => resolved
2014-04-03 01:40 graham Resolution open => fixed
2014-04-03 01:40 graham Assigned To => graham
2014-05-07 07:32 jmcgrew Fixed in Version => 6L02
2014-05-07 07:33 jmcgrew Status resolved => closed

Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker