blob: a155210059f5b0e42f0e05748b30999017b09caf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package vexriscv.ip.fpu
object MiaouDiv extends App{
val input = 2.5
var output = 1/(input*0.95)
def y = output
def x = input
for(i <- 0 until 10) {
output = 2 * y - x * y * y
println(output)
}
//output = x*output
println(1/input)
}
object MiaouSqrt extends App{
val input = 2.0
var output = 1/Math.sqrt(input*0.95)
// def x = output
// def y = input
def y = output
def x = input
for(i <- 0 until 10) {
output = y * (1.5 - x * y * y / 2)
println(output)
}
output = x*output
println(output)
println(s"ref ${Math.sqrt(input)}")
}
object MiaouNan extends App{
println(Float.NaN + 3.0f)
println(3.0f + Float.NaN )
println(0.0f*Float.PositiveInfinity )
println(1.0f/0.0f )
println(Float.MaxValue -1 )
println(Float.PositiveInfinity - Float.PositiveInfinity)
}
|