Builtin

maths.divide

maths.divide{a:float, b:float, c:float, d:float}

a=dividend, b=divisor, c=quotient, d=remainder.

A relation generator for division functions. Needs at least two arguments. It handles finding quotients and remainders, and scalar / and * operations in a symmetrical way.

Examples

quotient remainder
import("maths")
print(maths.divide(a:=17.0, c:=5.0))
┌──────┬──────┐
│ b    │ d    │
├──────┼──────┤
│ 3.00 │ 2.00 │
└──────┴──────┘
import("maths")
print(maths.divide(a:=17.0, b:=3.0))
┌──────┬──────┐
│ c    │ d    │
├──────┼──────┤
│ 5.00 │ 2.00 │
└──────┴──────┘

quotient
import("maths")
print(maths.divide(a:=17.0, c:=5.0, d:=2.0))
┌──────┐
│ b    │
├──────┤
│ 3.00 │
└──────┘
import("maths")
print(maths.divide(a:=17.0, b:=3.0, d:=2.0))
┌──────┐
│ c    │
├──────┤
│ 5.00 │
└──────┘

remainder
import("maths")
print(maths.divide(a:=17.0, b:=3.0, c:=5.0))
┌──────┐
│ d    │
├──────┤
│ 2.00 │
└──────┘

check, true
import("maths")
print(maths.divide(a:=17.0, b:=3.0, c:=5.0, d:=2.0))
┌┐
││
├┤
││
└┘

check, false
import("maths")
print(maths.divide(a:=10.0, b:=3.0, c:=5.0, d:=2.0))
┌┐
││
├┤
└┘