Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
| Subject: | FLASH: math errors in action script |
| From: | aaron |
| Date: | Fri, 20 Oct 2000 23:18:58 +0100 |
Hello,
This code generates two decimals that are to be subtracted. The goal is to give practice subtracting a wide range of decimals. Sometimes the end product (/:ans) has a strange value, such as -78.1210000000001, when subtracting simple numbers such as 790.72 from 868.841.
-----------------------------------------------------------------------------------------------------------------
****************CODE******************************
Set Variable: "/:part1" = ""
Set Variable: "/:part2" = ""
Set Variable: "/:count" = "1"
Comment: subtraction
Loop While (/:count < 3)
Set Variable: "/:r" = Random (3)+1
If (/:r = 1)
Set Variable: "/:firsthalf" = Random(9)+1
Else If (/:r = 2)
Set Variable: "/:firsthalf" = Random (90)+10
Else If (/:r = 3)
Set Variable: "/:firsthalf" = Random (900)+100
End If
Set Variable: "/:r2" = Random (3)+1
If (/:r2 = 1)
Set Variable: "/:secondhalf" = Random (9)+1
Set Variable: "/:secondhalf" = /:secondhalf *.1
Else If (/:r2 = 2)
Set Variable: "/:secondhalf" = Random (90)+10
Set Variable: "/:secondhalf" = /:secondhalf *.01
Else If (/:r2 = 3)
Set Variable: "/:secondhalf" = Random (900)+100
Set Variable: "/:secondhalf" = /:secondhalf *.001
End If
Set Variable: "/:part"&/:count = /:firsthalf + /:secondhalf
Set Variable: "/:count" = /:count + 1
End Loop
Set Variable: "/:ans" = /:part1 - /:part2
-----------------------------------------------------------------------------------------------------------------
*****************List of variables from test movie**********************
Layer #0:
Variable _level0:power = "0"
Variable _level0:h = "2"
Variable _level0:input = ""
Variable _level0:hint = ""
Variable _level0:part1 = "790.72"
Variable _level0:part2 = "868.841"
Variable _level0:count = "3"
Variable _level0:r = "3"
Variable _level0:firsthalf = "868"
Variable _level0:r2 = "3"
Variable _level0:secondhalf = "0.841"
Variable _level0:ans = "-78.1210000000001"
Any help on this is greatly appreciated.
TIA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NudeGuru.com is proud to sponsor the Flasher list
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IT'S THE ART OF MONEY, HONEY!
Tips and Advice from some of the most popular Flash
artists + industry power-brokers on how to hold onto
your rights, negotiate contracts and get full value
for your work.http://www.nudeguru.com from Franke James
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email help
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]

