Unhandled exception on float division by zero
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 540
- PR merge metrics
- No merged PRs in 30d
Description
Inky version: 0.14.1
ink version: 1.1.1
inkjs version: 2.1.0
ink:
```
{1/0}
```
output:
```
Ink compiler had an unexpected error ☹
Unhandled exception.
Ink compiler had an unexpected error ☹
System.Exception: Attempted to divide by zero. (Internal story path: 0.37)
---> System.DivideByZeroException: Attempted to divide by zero.
at Ink.Runtime.NativeFunctionCall.<>c.b__50_3(Int32 x, Int32 y) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 334
at Ink.Runtime.NativeFunctionCall.Call[T](List`1 parametersOfSingleType) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 148
at Ink.Runtime.NativeFunctionCall.Call(List`1 parameters) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 112
at Ink.Runtime.NativeFunctionCall.Call(List`1 parameters) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 89
at Ink.Runtime.Story.PerformLogicAndFlowControl(Object contentObj) in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 1695
at Ink.Runtime.Story.Step() in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 898
at Ink.Runtime.Story.ContinueSingleStep() in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 584
at Ink.Runtime.Story.ContinueInternal(Single millisecsLimitAsync) in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 462
at Ink.CommandLinePlayer.EvaluateStory()
at Ink.CommandLinePlayer.Begin() in /Users/phish/inkle/projects/ink/inklecate/CommandLinePlayer.cs:line 25
at Ink.CommandLineTool..ctor(String[] args) in /Users/phish/inkle/projects/ink/inklecate/CommandLineTool.cs:line 194
--- End of inner exception stack trace ---
at Ink.CommandLineTool..ctor(String[] args) in /Users/phish/inkle/projects/ink/inklecate/CommandLineTool.cs:line 208
at Ink.CommandLineTool.Main(String[] args) in /Users/phish/inkle/projects/ink/inklecate/CommandLineTool.cs:line 26
```
Compare with:
ink:
```
{1.0/0}
```
out:
```
Infinity
```
ink:
```
{"a"/0}
```
out:
```
Line 15: Cannot perform operation '/' on String
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in ink-engine-runtime/NativeFunctionCall.cs around line 334, where the stack trace shows integer division being evaluated, and reproduce the issue with the inklecate examples in the report. Compare the integer, floating-point, and string division cases, then run the relevant runtime or compiler tests. Done means integer float division by zero has defined, tested behavior rather than an unhandled exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100